1.) dragonboard.io only contains one public called: "File" directly added to the dragonboard namespace. So one can do: from dragonboard import File
2.) The dragonboard.File is both iterable and can be sliced like a list. So one can do
import dragonboard as dbd
my_file = dbd.File("Ped444706_1.dat")
for each_event in my_file:
# show iteration, but don't do anything with it :-)
break
some_event = next(my_file)
print(some_event.header.event_counter)
print(some_event.header.stop_cells["low"][3])
print(some_event.data["low"][3])
import dragonboard as dbd
my_file = dbd.File("Ped444706_1.dat")
the_last_ten_events = my_file[-10:]
for an_event in the_last_ten_events:
print(an_event.header.event_counter)
Or even backwards if you like:
import dragonboard as dbd
my_file = dbd.File("Ped444706_1.dat")
my_file_backwards_as_a_list = my_file[::-1]
for event in my_file_backwards_as_a_list:
print(event.header.event_counter)
3.) I don't like the fact, that event.data does not immediately reveal its interface, as in
I'd like it better, if one would clearly see, there are 8 channels, 2 gains and 1024 slices, on a single view.
So you can tell the dragon.File to not return a structured array with return_structured_array=False.
Hey,
I was still not really happy with the reader. I came up with a different interface, see https://github.com/mackaiver/lst_calibration/tree/dneise_io_File
1.) dragonboard.io only contains one public called: "File" directly added to the dragonboard namespace. So one can do:
from dragonboard import File
2.) The
dragonboard.File
is both iterable and can be sliced like a list. So one can doOr
Or
Or even backwards if you like:
3.) I don't like the fact, that
event.data
does not immediately reveal its interface, as inI'd like it better, if one would clearly see, there are 8 channels, 2 gains and 1024 slices, on a single view. So you can tell the
dragon.File
to not return a structured array withreturn_structured_array=False
.Both versions, perform equally fast on my machine. But some operations, are easier to achieve, when using the plain 3d-numpy-array, like:
What do you think?
4.) In case one is interested in having all events of a file, in a 4d-numpy-array one can also do:
and so on and so on....
What do you guys think?