This commit is contained in:
2025-10-15 12:53:50 +02:00
parent 972e56969e
commit 0e8f663fdf

View File

@@ -23,14 +23,14 @@ def main():
def accumulate(accumulator_host, accumulator_port):
zmq_socks = ZMQSocketsAccumulator(accumulator_host, accumulator_port)
run_name_before = None
output_dap = FileHandler()
previous_run_name = None
output = FileHandler()
n_frames_received = 0
while True:
if not zmq_socks.has_data():
output_dap.flush() # may be too intensive
output.flush() # may be too intensive
continue
results = zmq_socks.get_data()
@@ -40,10 +40,10 @@ def accumulate(accumulator_host, accumulator_port):
pulse_id = results.get("pulse_id", 0)
run_name = str(pulse_id // 10000 * 10000)
if run_name != run_name_before:
run_name_before = run_name
fname_output = f"{OUTPUT_DIR_NAME}/{detector}/{run_name}.dap"
output_dap.switch(fname_output)
if run_name != previous_run_name:
previous_run_name = run_name
fname = f"{OUTPUT_DIR_NAME}/{detector}/{run_name}.dap"
output.switch(fname)
res_is_good_frame = results.get("is_good_frame", -1)
res_is_hit_frame = results.get("is_hit_frame", False)
@@ -51,7 +51,7 @@ def accumulate(accumulator_host, accumulator_port):
res_laser_on = results.get("laser_on", False)
res_roi_intensities = results.get("roi_intensities", [])
print(pulse_id, res_is_good_frame, res_is_hit_frame, res_number_of_spots, res_laser_on, *res_roi_intensities, file=output_dap.file)
print(pulse_id, res_is_good_frame, res_is_hit_frame, res_number_of_spots, res_laser_on, *res_roi_intensities, file=output.file)