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