Open maxnoe opened 1 year ago
There are I think three possible solutions:
1) Keep the current behavior of the source but remove __len__
, making it a pure iterator with an unknown a-priori length
2) Keep the current, simple length implementation but yield also "empty" events (that could then be taken care of by the Softwaretrigger
)
3) Implement a more complex __len__
that looks at the full trigger table if allowed_tels
are given
I like having a __len__
attribute, even if it is not totally reliable, as it still gives useful information. So I'd prefer either keeping it the way it is (in which case the progress bar is an upper limit, I guess, but still somewhat useful), or implement suggestion 2 or 3.
Describe the bug
When
allowed_tels
is set forHDF5EventSource
, events with no telescopes remaining in the selection are skipped, thus changing the total number of array events.Currently,
__len__
simply looks at the number of array events in the input table, thus resulting in a too large number ifallowed_tels
is given.To Reproduce
Steps to reproduce the behavior:
Run
ctapipe-process -i dataset://gamma_prod5.simtel.zst -o /tmp/test.dl1.h5
Observe that the progress bar thinks there will be 7 events but only 1 is actually encountered.
Expected behavior
__len__
provides the correct length