etalumacontrol
Subpackages
Submodules
Package Contents
Classes
This class provides access to the microscope and LEDs. For interacting with |
|
This class provides access to the motorized stage of an Etaluma microscope. |
- class etalumacontrol.LumaScope(resolution: int = 1600, gain: int = MIN_GLOBAL_GAIN, shutter: int = 150)
Bases:
objectThis class provides access to the microscope and LEDs. For interacting with the stage, including focusing, see
EtalumaStage.If the microscope is in an uninitialized, i.e., its firmware has not been uploaded, firmware will be uploaded upon instantiation.
This class supports the context manager, and thus the following code will ensure that resources are properly disposed handled:
with LumaScope() as lumascope: # perform microscope operations
Although the camera can also be closed manually using the
close()method:lumascope = LumaScope() try: # perform miscope operations finally: lumascope.close()
For convenience, this object can be instantiated using the following optional parameters:
resolution – the resolution of the image. See
resolution.gain – the global gain. See
gain.shutter – the shutter speed in milliseconds. See
shutter.
- MAX_GLOBAL_GAIN
- MIN_GLOBAL_GAIN
- _shutter = 0
- _gain
- __enter__(self)
- __exit__(self, exc_type, exc_value, traceback)
- close(self)
Turn off LEDs and stop streaming.
- property gain(self) int
Sets or returns the global gain of the image sensor. Valid values are between
MIN_GLOBAL_GAINandMAX_GLOBAL_GAIN. The minimum value is derived from the corresponding value in the Etaluma SDK, which is described like this: “If the gain goes below this value it was empirically observed that the image sensor cannot saturate no matter the intensity of the light source.
- property resolution(self)
Sets or returns the camera resolution. The image is always square so only a single integer is given or returned. Valid values are 100-1900 in multiples of 4.
- property shutter(self) int
Sets or retrieves the shutter speed in milliseconds.
If the shutter speed cannot be determined, this attribute is 0.
- set_led(self, brightness: int, led_no: int = LED_WHITE) bool
Set brightness of selected LED. Returns
Falseif this fails.Arguments: * led_no – LED number. Valid values are 0x41-0x44, where 0x41-0x43
are LEDs F1-F3 and 0x44 is white (A-D in ASCII hexadecimal).
brightness – desired brightness (0-255).
- get_image(self)
Return the current buffer as a
PIL(i.e.,Pillow) Image object.If an image cannot be retrieved, returns
None.
- get_raw_image_buffer(self)
Return the contents of the image buffer as bytes, or
None.
- class etalumacontrol.EtalumaStage(_init=True)
Bases:
objectThis class provides access to the motorized stage of an Etaluma microscope. When instantiated, the stage will first initialize and home all axes.
This class supports the context manager, and thus the following code will ensure that resources are properly disposed handled:
with EtalumaStage() as stage: # perform some operations
The stage may also be used directly as an object, but then its
close()method should manually be called after use:try: stage = EtalumaStage() # perform some operations finally: stage.close()
- __enter__(self)
- __exit__(self, exc_type, exc_value, traceback)
- close(self)
Closes the USB to serial link.
- static mm_to_microsteps(value: float, axis: str = 'X') int
Convert a value from millimeters to microsteps.
Arguments: * value – The value to convert.
- static _check_axis(axis: str)
- get_pos(self, axis: str, microsteps: bool = False) Union[float, int, bool]
Return the stage’s current absolute position.
Arguments: * axis – The axis to query. Valid values are [‘x’, ‘y’, ‘z’],
case-independent.
microsteps – Whether to return the value in microsteps instead of millimeters. Defaults to False.
- move(self, axis: str, pos: Union[int, float], microsteps: int = False, blocking: bool = True) None
Moves the stage to the specified absolute position. Raises StageError if the position is outside of the allowed range. Note: If using LumaView to determine values, beware that the Z axis values in LumaView are reported in micrometers.
Arguments: * axis – The axis to query. Valid values are [‘x’, ‘y’, ‘z’],
case-independent.
pos – The absolute position to travel to.
microsteps – Specify position in microsteps instead of millimeters. Defaults to False.
blocking – Specifies whether the method waits until movement is complete before returning. Defaults to True. Also see
stop().