python-microscope / microscope

Python library for control of microscope devices, supporting hardware triggers and distribution of devices over the network for performance and flexibility.
https://www.python-microscope.org
GNU General Public License v3.0
66 stars 38 forks source link

Question: executor.PrepareActions does not return any signal #276

Open VroniPfann opened 1 year ago

VroniPfann commented 1 year ago

Hi all,

I have a quick question regarding an issue I encountered while running our long-term experiments with the RedPitaya. When I increase the number of timepoints to e.g. 25000, the executor.PrepareActions function generating the action table takes a few seconds to finish. However, since there is no signal to read back, the code continues running, and I get an error that there are no images yet. While I could add some sleeping time and increase my timeout, I am wondering if there is a way to receive a signal once PrepareActions is finished.

I have included the code I am running below. Any help or comments would be much appreciated!

Also, I have a practical question: how do I stop the RedPitaya execution during an acquisition?

Thank you in advance!

`N_TIMEPOINTS = 20000 EXECUTOR_URI = 'PYRO:redPitaya@192.168.0.20:8005' executor = Pyro4.Proxy(EXECUTOR_URI)

actions = [] running_time = 0.0

for light_name, emitting_time in LIGHT_TO_EXPOSURE: filtermask = FILTER_TO_EXECUTOR_LINE[light_name] | FILTERSTEP_EXECUTOR_LINE action = (running_time, (filtermask, [0, 0])) actions.append(action) running_time += 70 lasermask = LIGHT_TO_EXECUTOR_LINE[light_name] | CAMERA_EXECUTOR_LINE action = (running_time, (lasermask, [0, 0])) actions.append(action) running_time += emitting_time action = (running_time, (0, [0, 0])) actions.append(action) running_time += camera.get_cycle_time() * 1000 #camera read out time action = (running_time, (0, [0, 0])) actions.append(action)# wait before start next repetition

executor.PrepareActions(actions, N_TIMEPOINTS)

time.sleep(15)

thread = threading.Thread(target=executor.RunActions) thread.start()

n_acquired = 0 expected_images = len(LIGHT_TO_EXPOSURE) * N_TIMEPOINTS timeout = (max_emission_time / 1000.0)+15 t_acc = 0

while n_acquired < expected_images: im = camera_buffer.get(timeout = timeout) path = TIFF_PATH + 'im%s'%n_acquired +'.tif' tifffile.imwrite(path, im) n_acquired = n_acquired + 1

thread.join()

time.sleep(5)`