When you aggregate all waveforms via dataset.iterate using the pyroot backend. E.g.:
dataset = Dataset(data_path=sys.argv[1], backend="pyroot")
dataset.setEntries((0, dataset.N()))
wfs = []
for ev, wf in dataset.iterate():
wfs.append(wf)
All events in wfs have the exact same waveforms. This is some reference bug where wfs contains the reference to something in memory which is updated to the last event at the end of the for loop.
When printing the wf during the for-loop they are different. Using wfs.append(wf.copy()) also fixes the problem.
I already create a PR which extends the unit tests to be sensitive to this bug (and test that it is not a feature of my system) and surely they are failing (see #127).
MWE:
import sys
import numpy as np
from mattak.Dataset import Dataset
dataset = Dataset(data_path=sys.argv[1], backend="pyroot")
dataset.setEntries((0, dataset.N()))
wfs = []
for ev, wf in dataset.iterate():
if ev.triggerType != "FORCE":
continue
wfs.append(wf) # <--- printing here shows they are different. using wf.copy fixes it.
wfs = np.array(wfs)
print(np.allclose(wfs[0], wfs[1]))
When you aggregate all waveforms via
dataset.iterateusing the pyroot backend. E.g.:All events in
wfshave the exact same waveforms. This is some reference bug where wfs contains the reference to something in memory which is updated to the last event at the end of the for loop.When printing the
wfduring the for-loop they are different. Usingwfs.append(wf.copy())also fixes the problem.I already create a PR which extends the unit tests to be sensitive to this bug (and test that it is not a feature of my system) and surely they are failing (see #127).
MWE: