test(timepix): cover the re-enabled accumulated XES signals
This commit is contained in:
1 parent
092500a06b
commit
c7c70751b4
1 file changed
+27
@@ -471,6 +471,33 @@ def test_timepix_msg_buffer_callback_updates_xes_signals(timepix):
|
||||
assert _message_value(timepix.total_events) == 36
|
||||
|
||||
|
||||
def test_timepix_msg_buffer_callback_accumulates_xes_energy_per_scan(timepix):
|
||||
"""xes_accumulated_energy_1/2 sum the frames of one scan; staging starts a new sum."""
|
||||
timepix.troin = 4
|
||||
# one frame: xes_energy_1 = [4, 8, 12, 16], xes_energy_2 = [40, 80, 120, 160]
|
||||
frames = _xes_frames(_level_test_spectra())
|
||||
|
||||
timepix.msg_buffer_callback(*frames)
|
||||
timepix.msg_buffer_callback(*frames)
|
||||
|
||||
np.testing.assert_array_equal(
|
||||
_message_value(timepix.xes_data_accumulated_1), np.array([8, 16, 24, 32])
|
||||
)
|
||||
np.testing.assert_array_equal(
|
||||
_message_value(timepix.xes_data_accumulated_2), np.array([80, 160, 240, 320])
|
||||
)
|
||||
assert timepix.xes_data_accumulated_1.get().metadata["async_update"]["type"] == "replace"
|
||||
# the per-frame signal still carries only the last frame
|
||||
np.testing.assert_array_equal(_message_value(timepix.xes_energy_1), np.array([4, 8, 12, 16]))
|
||||
|
||||
_stage_for(timepix, "line_scan")
|
||||
timepix.msg_buffer_callback(*frames)
|
||||
|
||||
np.testing.assert_array_equal(
|
||||
_message_value(timepix.xes_data_accumulated_1), np.array([4, 8, 12, 16])
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("scan_name", [None, "line_scan"])
|
||||
def test_timepix_msg_buffer_callback_skips_levels_outside_timepix_scan(timepix, scan_name):
|
||||
"""Frames before the first stage or during other scans must not touch the on/off levels."""
|
||||
|
||||
Reference in new issue
Block a user