Closed vigji closed 4 years ago
@vilim this (plus new attribute definition in init) seems to have done the trick:
def receive_save_parameters(self):
try:
self.save_parameters = self.saving_parameter_queue.get(timeout=0.001)
except Empty:
pass
try:
self.last_received_duration = self.duration_queue.get(timeout=0.01)
except Empty:
pass
if self.last_received_duration is not None:
#TODO could become a property
self.save_parameters.n_volumes = int(np.ceil(self.save_parameters.volumerate * self.last_received_duration))
I can commit if you have not started the merging yet, otherwise you can just change it in your branch
Oh you merged already - I'll fix it in master then
A better fix for this will be to change stytra_com.py
I suggest:
def run(self):
while not self.stop_event.is_set():
while True:
try:
self.current_settings = self.current_settings_queue.get(
timeout=0.00001
)
saved_data = dict(
lightsheet=clean_json(self.current_settings)
)
except Empty:
break
if self.start_stytra.is_set():
zmq_context = zmq.Context()
with zmq_context.socket(zmq.REQ) as zmq_socket:
zmq_socket.connect(self.zmq_tcp_address)
zmq_socket.send_json(saved_data)
poller = zmq.Poller()
poller.register(zmq_socket, zmq.POLLIN)
duration = None
if poller.poll(1000):
duration = zmq_socket.recv_json()
if duration is not None:
self.duration_queue.put(duration)
self.start_stytra.clear()
zmq_socket.close()
zmq_context.destroy()
just added if duration is not None:
What is puzzling for me is why this was not happening before. Maybe now Saver
is started before triggering Stytra and before it was not?
Also stytra_comm.py
has not been changed in the mega-merging so it is safe to change things here and they will still work fine
OK! in the long term this need to be safe for both stytra and non-stytra mode though
The code
Often fails throwing a Type error for None duration, meaning that there's nothing in the duration queue to be found. This happens before any real saving acquisition is started
Don't know if it is related to it but currently acquisition is freezing and crashing when trying to save the first stack, even though stytra is correctly triggered