def test_monobloc_events(self, event_setup): # the event file changed when the ILL monobloc detector was installed pth = pjoin(event_setup.data_directory, "reduce") event_file_path = pjoin(pth, "DAQ_2019-11-25T12-25-07", "DATASET_0", "EOS.bin") data = event.events(event_file_path) f, t, y, x = data[0] assert len(t) == 71223 x_bins = np.array([2.5, 28.5]) y_bins = np.linspace(-0.5, 1023.5, 1025) t_bins = np.linspace(0, 40000, 1001) frames = [np.arange(0, 57599, 1)] detector, fbins = event.process_event_stream(data[0], frames, t_bins, y_bins, x_bins) detector = np.squeeze(detector) with h5py.File(pjoin(pth, "PLP0046853.nx.hdf"), "r") as g: det = np.copy(g["entry1/data/hmm"]) det = np.squeeze(det) assert det.shape == (1000, 1024) assert_equal(np.sum(detector, 1), np.sum(det, 1))
def test_max_frames(self): # test reading only a certain number of frames with open(self.event_file_path, 'rb') as f: event_list, fpos = event.events(f, max_frames=10) f, t, y, x = event_list max_f = np.max(f) assert_equal(9, max_f)
def setUp(self): path = os.path.dirname(__file__) self.path = path self.event_file_path = os.path.join(path, 'DAQ_2012-01-19T15-45-52', 'DATASET_0', 'EOS.bin') with open(self.event_file_path, 'rb') as f: event_list, fpos = event.events(f) self.event_list = event_list self.fpos = fpos self.f, self.t, self.y, self.x = event_list
def test_events_smoke(self, event_setup): # check that the event.events function works event.events(event_setup.event_file_path)
def test_events_smoke(self): # check that the event.events function works events(self.event_file_path)
def test_open_with_path(self): # give the event reader a file path event_list, fpos = event.events(self.event_file_path, max_frames=10) f, t, y, x = event_list max_f = np.max(f) assert_equal(9, max_f)