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 39 forks source link

Problems with DataClient. #219

Closed iandobbie closed 2 years ago

iandobbie commented 2 years ago

I am trying to benchmark direct versus device server data transfer rates. My code is as simple as I can make it...

`from microscope import clients import time

remoteCam = clients.Client(url='PYRO:TestCamera@127.0.0.1:8000') remoteCam.enable() remoteCam.set_exposure_time(0.00001)

starttime=time.time()

repeats=1000 for i in range(repeats): remoteCam.trigger_and_wait()

endtime=time.time()

print("time per cycle = %f" % ((endtime-starttime)/repeats)) `

The system hangs in the trigger and wait. I don't think the data is being sent back to the receive client. An interactive shell doing the equivalent and just a trigger never sees the image queu being extended.

The local code to do this is below and produces about 5ms per image on my machine.

from microscope import devices import microscope.simulators import time cam=microscope.simulators.SimulatedCamera() cam.enable() cam.set_exposure_time(0.00) starttime=time.time() repeats=10000 for i in range(repeats): cam.grab_next_data() endtime=time.time() print("time per cycle = %f" % ((endtime-starttime)/repeats))

but trying the same with remote code doesnt work

iandobbie commented 2 years ago

I think I had some stale libraries. This morning I went through and pip install --upgrade Pyro4 and the other microscope dependencies and managed to solve my problems. Sorry I didn't check exactly what the issue was but I figure either Pyro or maybe numpy.

Anyway all fixerd, sorry for the spurious bug report.