.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_offline_usr.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_offline_usr.py: Reading usr data of events ========================== To access the ``usr`` data of events, use the ``.usr`` property which behaves like a dictionary and returns ``lazyarray``, compatible to the ``numpy.array`` interface. The available keys can be accessed either as attributes or via a dictionary lookup: .. GENERATED FROM PYTHON SOURCE LINES 10-14 .. code-block:: Python import km3io as ki from km3net_testdata import data_path .. GENERATED FROM PYTHON SOURCE LINES 15-17 First, pass a filename to the `OfflineReader` class to open the file. Note that only some meta information is read into memory. .. GENERATED FROM PYTHON SOURCE LINES 17-21 .. code-block:: Python r = ki.OfflineReader(data_path("offline/usr-sample.root")) .. GENERATED FROM PYTHON SOURCE LINES 22-23 Accessing the usr fields: .. GENERATED FROM PYTHON SOURCE LINES 23-27 .. code-block:: Python print(r.events.usr_names.tolist()) .. rst-class:: sphx-glr-script-out .. code-block:: none [['RecoQuality', 'RecoNDF', 'CoC', 'ToT', 'ChargeAbove', 'ChargeBelow', 'ChargeRatio', 'DeltaPosZ', 'FirstPartPosZ', 'LastPartPosZ', 'NSnapHits', 'NTrigHits', 'NTrigDOMs', 'NTrigLines', 'NSpeedVetoHits', 'NGeometryVetoHits', 'ClassficationScore'], ['RecoQuality', 'RecoNDF', 'CoC', 'ToT', 'ChargeAbove', 'ChargeBelow', 'ChargeRatio', 'DeltaPosZ', 'FirstPartPosZ', 'LastPartPosZ', 'NSnapHits', 'NTrigHits', 'NTrigDOMs', 'NTrigLines', 'NSpeedVetoHits', 'NGeometryVetoHits', 'ClassficationScore'], ['RecoQuality', 'RecoNDF', 'CoC', 'ToT', 'ChargeAbove', 'ChargeBelow', 'ChargeRatio', 'DeltaPosZ', 'FirstPartPosZ', 'LastPartPosZ', 'NSnapHits', 'NTrigHits', 'NTrigDOMs', 'NTrigLines', 'NSpeedVetoHits', 'NGeometryVetoHits', 'ClassficationScore']] .. GENERATED FROM PYTHON SOURCE LINES 28-29 to access data of a specific key: .. GENERATED FROM PYTHON SOURCE LINES 29-31 .. code-block:: Python print(ki.tools.usr(r.events, "DeltaPosZ")) .. rst-class:: sphx-glr-script-out .. code-block:: none [37.5, -10.3, 13.7] .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 1.992 seconds) **Estimated memory usage:** 153 MB .. _sphx_glr_download_auto_examples_plot_offline_usr.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_offline_usr.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_offline_usr.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_