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

Problem with simulated system. #183

Closed iandobbie closed 3 years ago

iandobbie commented 3 years ago

Trying to use the new integrated simulated system with simulated_setup_from_image with the following code:

from microscope.device_server import device from microscope.simulators.stage_aware_camera import simulated_setup_from_image

DEVICES = [ device(simulated_setup_from_image, 'localhost', 8000, conf={'filepath': 'mosaicimage.tif'}), ]

The deviceserver appears to hang with:

deviceserver microscope-stageawarecam.py /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/Pillow-7.2.0-py3.8-macosx-10.9-x86_64.egg/PIL/Image.py:2832: DecompressionBombWarning: Image size (90437396 pixels) exceeds limit of 89478485 pixels, could be decompression bomb DOS attack. warnings.warn(

cockpit then cannot connect to the Pyro connection

iandobbie commented 3 years ago

Replacing the huge mosaic with a much smaller tif removed the warning about a DOSbomb but still didn't get a working camera connection. I think the problem is on the cockpit side.

It is failing in

Exception in thread toggleState: Traceback (most recent call last): File “/Users/ian/Library/Python/3.8/lib/python/site-packages/microscope_cockpit-2.9.0+dev-py3.8.egg/cockpit/handlers/deviceHandler.py”, line 246, in toggleState setEnabled(not(getIsEnabled())) File “/Users/ian/Library/Python/3.8/lib/python/site-packages/microscope_cockpit-2.9.0+dev-py3.8.egg/cockpit/interfaces/imager.py”, line 80, in wrapper result = func(*args, *kwargs) File “/Users/ian/Library/Python/3.8/lib/python/site-packages/microscope_cockpit-2.9.0+dev-py3.8.egg/cockpit/handlers/deviceHandler.py”, line 124, in wrapper return f(self, args, **kwargs) File “/Users/ian/Library/Python/3.8/lib/python/site-packages/microscope_cockpit-2.9.0+dev-py3.8.egg/cockpit/handlers/camera.py”, line 178, in setEnabled raise Exception(“Problem enabling device with handler %s” % self) Exception: Problem enabling device with handler

iandobbie commented 3 years ago

Turns out it was a cockpit problem, in that I wasn't running the version I thought I was. Fixing the setup.py allowed me to ensure I was running the latest master and then it started to work. Still a strange hanging "warnings.warn(" in the device-server console but it all works.