def test_blob_in_io_sum(self): p = DAQPump(IO_SUM_FILE) blob = p.next_blob() assert 'DAQSummaryslice' in blob.keys() assert 'DAQPreamble' in blob.keys() assert 'DAQHeader' in blob.keys() assert 16 == blob['DAQSummaryslice'].n_summary_frames
def test_blob_in_io_sum(self): p = DAQPump(filename=data_path("daq/IO_SUM.dat")) blob = p.next_blob() assert "DAQSummaryslice" in blob.keys() assert "DAQPreamble" in blob.keys() assert "DAQHeader" in blob.keys() assert 33 == blob["DAQSummaryslice"].n_summary_frames
def test_blob_in_io_evt(self): p = DAQPump(filename=data_path("daq/IO_EVT_legacy.dat"), legacy=True) blob = p.next_blob() assert "DAQEvent" in blob.keys() assert "DAQPreamble" in blob.keys() assert "DAQHeader" in blob.keys() event = blob["DAQEvent"] assert 13 == event.n_triggered_hits assert 28 == event.n_snapshot_hits
def test_blob_in_io_evt(self): p = DAQPump(IO_EVT_FILE) blob = p.next_blob() assert 'DAQEvent' in blob.keys() assert 'DAQPreamble' in blob.keys() assert 'DAQHeader' in blob.keys() event = blob['DAQEvent'] assert 13 == event.n_triggered_hits assert 28 == event.n_snapshot_hits
def test_get_item(self): p = DAQPump(filename=data_path("daq/IO_EVT.dat")) blob = p[0] event = blob["DAQEvent"] assert 182 == event.n_triggered_hits assert 239 == event.n_snapshot_hits assert np.allclose( [806451572, 806455814, 806455814, 806483369, 806483369], event.triggered_hits.dom_id[:5], ) assert np.allclose([23, 14, 24, 6, 11], event.triggered_hits.channel_id[:5]) assert np.allclose( [40380598, 40380623, 40380551, 40380835, 40380920], event.triggered_hits.time[:5], ) assert np.allclose([4, 4, 4, 4, 22], event.triggered_hits.trigger_mask[:5]) assert np.allclose( [806451572, 806455814, 806455814, 806483369, 806483369], event.triggered_hits.dom_id[:5], ) assert np.allclose([23, 17, 14, 24, 6], event.snapshot_hits.channel_id[:5]) assert np.allclose( [40380598, 40380623, 40380551, 40380835, 40380920], event.triggered_hits.time[:5], )
def get_pump(input_file): extension = os.path.splitext(input_file)[1][1:] if extension == "evt": pump = EvtPump(filename=input_file, cache_enabled=True) elif extension == "dat": pump = DAQPump(filename=input_file) elif extension == "dqd": pump = CLBPump(filename=input_file, cache_enabled=True) elif extension == "root": pump = OfflinePump(filename=input_file) elif extension == "h5": pump = HDF5Pump(filename=input_file) else: raise SystemExit("No pump found for '{0}' files.".format(extension)) return pump
def test_frame_positions_in_io_evt(self): p = DAQPump(filename=data_path("daq/IO_EVT.dat")) assert 3 == len(p.frame_positions) self.assertListEqual([0, 5724, 7674], p.frame_positions)
def test_frame_positions_in_io_sum(self): p = DAQPump(filename=data_path("daq/IO_SUM.dat")) assert 3 == len(p.frame_positions) self.assertListEqual([0, 1849, 5678], p.frame_positions)
def test_init_with_filename(self): DAQPump(filename=data_path("daq/IO_SUM.dat"))
def test_get_item(self): p = DAQPump(filename=data_path("daq/IO_EVT_legacy.dat"), legacy=True) blob = p[4] event = blob["DAQEvent"] assert 6 == event.n_triggered_hits assert 17 == event.n_snapshot_hits
def test_blob_iteration(self): p = DAQPump(filename=data_path("daq/IO_EVT_legacy.dat"), legacy=True) for blob in p: pass
def test_frame_positions_in_io_evt(self): p = DAQPump(filename=data_path("daq/IO_EVT_legacy.dat"), legacy=True) assert 38 == len(p.frame_positions) self.assertListEqual([0, 570, 986], p.frame_positions[:3]) self.assertListEqual([13694, 14016, 14360], p.frame_positions[-3:])
def test_frame_positions_in_io_sum(self): p = DAQPump(filename=data_path("daq/IO_SUM_legacy.dat"), legacy=True) assert 81 == len(p.frame_positions) self.assertListEqual([0, 656, 1312], p.frame_positions[:3]) self.assertListEqual([50973, 51629, 52285], p.frame_positions[-3:])
def test_init_with_filename(self): DAQPump(filename=data_path("daq/IO_SUM_legacy.dat"), legacy=True)
def test_blob_iteration(self): p = DAQPump(filename=data_path("daq/IO_EVT.dat")) for blob in p: pass