etalumacontrol.lumascope

Module Contents

Classes

LumaScope

This class provides access to the microscope and LEDs. For interacting with

Attributes

LUMAUSB_DLL

etalumacontrol.lumascope.LUMAUSB_DLL
exception etalumacontrol.lumascope.CameraError

Bases: Exception

Common base class for all non-exit exceptions.

class etalumacontrol.lumascope.LumaScope(resolution: int = 1600, gain: int = MIN_GLOBAL_GAIN, shutter: int = 150)

Bases: object

This 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_GAIN and MAX_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 False if 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.