aics-int / microscope_automation

Automation software for the AICS Microscopes.
Other
4 stars 0 forks source link

BUG: HardwareDoesNotExistError in setup_microscope with ZEN Blue Dummy #21

Open fletchapin opened 3 years ago

fletchapin commented 3 years ago

Description

microscop_automation.microscope_automation calls setup_microscope, and when using the ZEN Blue Dummy it fails with a HardwareDoesNotExistError

Expected Behavior

More investigation is needed to determine if this error is expected.

Reproduction

D:\Users\Winfried>python main.py

Read preferences from D:/Users/Winfried/GeneralSettings/Pipeline5.2.yml

Author: Calysta (based on Shailja Dhaka and Winfried)
Date:   11/18/2020
Version:        090419_1
System: ZSD1
Type:   Pipeline 5.2
Note:   Get overview images of wells and use automated position selection
State was saved in the recovery file

Read preferences from D:\Automation\GeneralSettings\microscopeSpecifications_ZSD1.yml

Date:   01/08/2020
Version:        010820_1
Type:   Specifications
Note:   Specifictions for spinning disk ZSD_1
Failed to connect to Zen Blue Production SW,connecting to simulated hardware
Key  Type  is not defined and there are no parent preferences
Key  Type  is not defined and there are no parent preferences
Traceback (most recent call last):
  File "D:\Users\Winfried\main.py", line 3, in <module>
    mic_auto.main()
  File "C:\Users\winfriedw\AppData\Local\Programs\Python\Python39\lib\site-packages\microscope_automation\microscope_automation.py", line 2605, in main
    mic.microscope_automation()
  File "C:\Users\winfriedw\AppData\Local\Programs\Python\Python39\lib\site-packages\microscope_automation\microscope_automation.py", line 2308, in microscope_automation
    microscope_object = setup_microscope.setup_microscope(self.prefs)
  File "C:\Users\winfriedw\AppData\Local\Programs\Python\Python39\lib\site-packages\microscope_automation\hardware\setup_microscope.py", line 251, in setup_microscope
    raise ae.HardwareDoesNotExistError(
microscope_automation.automation_exceptions.HardwareDoesNotExistError: 'Microscope not defined in module hardware_control.py'

Environment

Windows 10 with microscope_automation v0.0.1

fletchapin commented 3 years ago

After investigation, the preferences file was missing the Type field under Microscope. The correct structure is:

Microscope:
 Name: ZSD_01
 Type: SpinningDisk_Zeiss

To fix this, we should emulate the VALID_TAG model used in microscope_automation.microscope_automation for hardware preferences and prompt the user to select from a dropdown to correct an invalid field.

The error message on line 251 of setup_microscope can also be improved to say something like Microscope Type field is invalid instead of the generic Microscope not defined in module hardware_control.py