The main microscope class handles microscope settings, passing these between the settings file and their appropriate components (camera, stage), basic metadata about the current device status, and interfacing with the separate camera and stage components.
Defines a microscope object, binding a camera and stage with basic functionality.
Microscope(settings=<openflexure_microscope.config.OpenflexureSettingsFile object>, configuration=<openflexure_microscope.config.OpenflexureSettingsFile object>)¶
A basic microscope object.
The camera and stage objects may already be initialised, and can be passed as arguments.
Composite lock for locking both camera and stage
Currently connected camera object
Currently connected stage object
Shut down the microscope hardware.
Attach microscope components based on initially passed configuration file
set_stage(configuration: Optional[dict] = None, stage_type: Optional[str] = None)¶
Set or change the stage geometry
has_real_stage() → bool¶
Check if a real (non-mock) stage is currently attached.
has_real_camera() → bool¶
Check if a real (non-mock) camera is currently attached.
Dictionary of the basic microscope state.
Returns: Dictionary containing complete microscope state Return type: dict
Applies a settings dictionary to the microscope. Missing parameters will be left untouched.
read_settings(full: bool = True) → dict¶
Get an updated settings dictionary.
Reads current attributes and properties from connected hardware, then merges those with the currently saved settings.
This is to ensure that settings for currently disconnected hardware don’t get removed from the settings file.
Merges the current settings back to disk
force_get_metadata() → dict¶
Read cachable bits of microscope metadata. Currently ID, settings, and configuration can be cached
get_metadata(cache_key: Optional[str] = None)¶
Read microscope metadata, with partial caching