instamatic-dev / instamatic

Python program for automated electron diffraction data collection
https://instamatic.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
58 stars 27 forks source link

Collection of Merlin todo's #71

Closed stefsmeets closed 1 year ago

stefsmeets commented 1 year ago
stefsmeets commented 1 year ago

Merlin command port already connected is misleading, this is without a Merlin instance running or available:

timeout                                   Traceback (most recent call last)
File ~\python\instamatic\instamatic\camera\camera_merlin.py:304, in CameraMerlin.establishConnection(self)
    303 try:
--> 304     self.s_cmd.connect((self.host, self.commandport))
    306 except ConnectionRefusedError as e:

timeout: timed out

The above exception was the direct cause of the following exception:

RuntimeError                              Traceback (most recent call last)
Cell In[1], line 4
      1 from instamatic import TEMController
      2 from instamatic.formats import write_tiff
----> 4 ctrl = TEMController.initialize()

File ~\python\instamatic\instamatic\TEMController\TEMController.py:60, in initialize(tem_name, cam_name, stream)
     56         cam_tag = ''
     58     print(f'Camera    : {cam_name}{cam_tag}')
---> 60     cam = Camera(cam_name, as_stream=stream, use_server=use_cam_server)
     61 else:
     62     cam = None

File ~\python\instamatic\instamatic\camera\camera.py:67, in Camera(name, as_stream, use_server)
     65         as_stream = False  # override `as_stream` for this interface
     66     else:
---> 67         cam = cam_cls(name=name)
     69 if as_stream:
     70     if cam.streamable:

File ~\python\instamatic\instamatic\camera\camera_merlin.py:63, in CameraMerlin.__init__(self, name)
     59 self._soft_trigger_exposure = None
     61 self.load_defaults()
---> 63 self.establishConnection()
     64 self.establishDataConnection()
     66 msg = f'Camera {self.getName()} initialized'

File ~\python\instamatic\instamatic\camera\camera_merlin.py:311, in CameraMerlin.establishConnection(self)
    307     raise RuntimeError(
    308         f'Could not establish command connection to {self.name}, '
    309         '(Merlin command port not responding).') from e
    310 except OSError as e:
--> 311     raise RuntimeError(
    312         f'Could not establish command connection to {self.name}, '
    313         '(Merlin command port already connected).') from e
    315 version = self.merlin_get(key='SOFTWAREVERSION')
    316 logger.info('Merlin version: %s', version)

RuntimeError: Could not establish command connection to merlin, (Merlin command port already connected).