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:

import km3io as ki

First, pass a filename to the OfflineReader class to open the file. Note that only some meta information is read into memory.

r = ki.OfflineReader("samples/usr-sample.root")

Accessing the usr data:

usr = r.events.usr
print(usr)

Out:

/builds/km3py/km3io/venv/lib/python3.6/site-packages/awkward/array/base.py:394: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
  return cls.numpy.array(value, copy=False)
RecoQuality: [85.45957235835593 68.74744265572737 50.18704013646688]
RecoNDF: [37.0 37.0 29.0]
CoC: [118.6302815337638 44.33580521344907 99.93916717621543]
ToT: [825.0 781.0 318.0]
ChargeAbove: [176.0 278.0 53.0]
ChargeBelow: [649.0 503.0 265.0]
ChargeRatio: [0.21333333333333335 0.3559539052496799 0.16666666666666666]
DeltaPosZ: [37.51967774166617 -10.280346193553832 13.67595659707355]
FirstPartPosZ: [135.29499707179326 41.46665612378939 107.39596803432326]
LastPartPosZ: [97.77531933012709 51.747002317343224 93.72001143724971]
NSnapHits: [51.0 107.0 98.0]
NTrigHits: [30.0 32.0 14.0]
NTrigDOMs: [7.0 11.0 7.0]
NTrigLines: [6.0 5.0 4.0]
NSpeedVetoHits: [0.0 0.0 0.0]
NGeometryVetoHits: [0.0 0.0 0.0]
ClassficationScore: [0.16863382173469108 0.17944356593281038 0.08155750660727408]

to access data of a specific key, you can either do:

print(usr.DeltaPosZ)

Out:

[37.51967774166617 -10.280346193553832 13.67595659707355]

or

print(usr['RecoQuality'])

Out:

[85.45957235835593 68.74744265572737 50.18704013646688]

Total running time of the script: ( 0 minutes 1.765 seconds)

Estimated memory usage: 86 MB

Gallery generated by Sphinx-Gallery