From d6371807fb5dd7d8d2d7ee16b8281ba86b5d616f Mon Sep 17 00:00:00 2001 From: appel_c Date: Fri, 29 May 2026 16:44:05 +0200 Subject: [PATCH] refactor(timepix): comment accumalated data signals. --- superxas_bec/devices/timepix/timepix.py | 36 ++++++++++++------------- tests/tests_devices/test_timepix.py | 6 ----- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/superxas_bec/devices/timepix/timepix.py b/superxas_bec/devices/timepix/timepix.py index f3f2e06..5ebe319 100644 --- a/superxas_bec/devices/timepix/timepix.py +++ b/superxas_bec/devices/timepix/timepix.py @@ -221,8 +221,8 @@ class Timepix(PSIDeviceBase, TimePixControl): static_spectra = Cpt(AsyncSignal, name="static_spectra", ndim=1, max_size=1000, acquisition_group="monitored", async_update={"type": "add", "max_shape": [None, DETECTOR_SHAPE[0]]}, doc="Spectra signal of the TimePix detector.") - xes_data_accumulated_1 = Cpt(AsyncSignal, name="xes_accumulated_energy_1", ndim=1, max_size=1000, doc="1D time spectra for energy bin 2.") - xes_data_accumulated_2 = Cpt(AsyncSignal, name="xes_accumulated_energy_2", ndim=1, max_size=1000, doc="1D time spectra for energy bin 2.") + # xes_data_accumulated_1 = Cpt(AsyncSignal, name="xes_accumulated_energy_1", ndim=1, max_size=1000, doc="1D time spectra for energy bin 2.") + # xes_data_accumulated_2 = Cpt(AsyncSignal, name="xes_accumulated_energy_2", ndim=1, max_size=1000, doc="1D time spectra for energy bin 2.") file_event = Cpt(FileEventSignal, name="file_event", doc="File event signal for TimePix detector.") # fmt: on @@ -407,22 +407,22 @@ class Timepix(PSIDeviceBase, TimePixControl): data_2 = np.sum(xes_data[:, 4:8], axis=1) self.xes_energy_1.put(data_1, async_update={"type": "add", "max_shape": [None, troin]}) self.xes_energy_2.put(data_2, async_update={"type": "add", "max_shape": [None, troin]}) - if self.accumulated_data_e1 is None: - self.accumulated_data_e1 = data_1 - else: - self.accumulated_data_e1 += data_1 - if self.accumulated_data_e2 is None: - self.accumulated_data_e2 = data_2 - else: - self.accumulated_data_e2 += data_2 - self.xes_data_accumulated_1.put( - self.accumulated_data_e1, - async_update={"type": "replace", "max_shape": [None, troin]}, - ) - self.xes_data_accumulated_2.put( - self.accumulated_data_e2, - async_update={"type": "replace", "max_shape": [None, troin]}, - ) + # if self.accumulated_data_e1 is None: + # self.accumulated_data_e1 = data_1 + # else: + # self.accumulated_data_e1 += data_1 + # if self.accumulated_data_e2 is None: + # self.accumulated_data_e2 = data_2 + # else: + # self.accumulated_data_e2 += data_2 + # self.xes_data_accumulated_1.put( + # self.accumulated_data_e1, + # async_update={"type": "replace", "max_shape": [None, troin]}, + # ) + # self.xes_data_accumulated_2.put( + # self.accumulated_data_e2, + # async_update={"type": "replace", "max_shape": [None, troin]}, + # ) self.xes_spectra.put( xes_data.sum(axis=1), async_update={"type": "add", "max_shape": [None, troin]} ) diff --git a/tests/tests_devices/test_timepix.py b/tests/tests_devices/test_timepix.py index c316937..0010025 100644 --- a/tests/tests_devices/test_timepix.py +++ b/tests/tests_devices/test_timepix.py @@ -374,12 +374,6 @@ def test_timepix_msg_buffer_callback_updates_xes_signals(timepix): np.testing.assert_array_equal( _message_value(timepix.xes_energy_2), np.array([22, 54], dtype=np.float32) ) - np.testing.assert_array_equal( - _message_value(timepix.xes_data_accumulated_1), np.array([6, 38], dtype=np.float32) - ) - np.testing.assert_array_equal( - _message_value(timepix.xes_data_accumulated_2), np.array([22, 54], dtype=np.float32) - ) assert _message_value(timepix.total_periods) == pytest.approx(4 / 131000) np.testing.assert_array_equal(_message_value(timepix.tds_period), np.array([1.0])) assert _message_value(timepix.total_events) == 36