From 37a86ba423038fb39e8ee38e68fba0be393b92b4 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Sat, 18 Oct 2025 00:41:19 +0200 Subject: [PATCH] move bsread_port check into make_bsread_sender --- dap/accumulator.py | 5 ++--- dap/utils/bsreadext.py | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dap/accumulator.py b/dap/accumulator.py index 9be5745..1bc8a55 100644 --- a/dap/accumulator.py +++ b/dap/accumulator.py @@ -29,8 +29,7 @@ def accumulate(accumulator_addr, bsread_port): sorter = Sorter() - if bsread_port: - sender = make_bsread_sender(bsread_port) + sender = make_bsread_sender(bsread_port) while True: if not zmq_socks.has_data(): @@ -54,7 +53,7 @@ def accumulate(accumulator_addr, bsread_port): output.write(pulse_id, res_is_good_frame, res_is_hit_frame, res_number_of_spots, res_laser_on, *res_roi_intensities) - if not bsread_port: + if not sender: continue timestamp = tuple(results["timestamp"]) diff --git a/dap/utils/bsreadext.py b/dap/utils/bsreadext.py index 61cb85a..2c1b4c2 100644 --- a/dap/utils/bsreadext.py +++ b/dap/utils/bsreadext.py @@ -2,6 +2,8 @@ from bsread.sender import Sender, PUB def make_bsread_sender(bsread_port): + if not bsread_port: + return None sender = Sender(port=bsread_port, block=False, mode=PUB) sender.open() return sender