microscope package

class microscope.AxisLimits(lower: float, upper: float)[source]

Bases: tuple

Limits of a microscope.abc.StageAxis.

lower: float

Alias for field number 0

upper: float

Alias for field number 1

class microscope.Binning(h: int, v: int)[source]

Bases: tuple

A tuple containing parameters for horizontal and vertical binning.

h: int

Alias for field number 0

v: int

Alias for field number 1

exception microscope.DeviceError[source]

Bases: MicroscopeError

Raised when there is an issue controlling a device.

This exception is raised when there is an issue with controlling the device, be it with its programming interface or with the physical hardware. It is most common when commands to the device fail or return something unexpected.

Note

The subclasses DisabledDeviceError, IncompatibleStateError, InitialiseError, and UnsupportedFeatureError provide more fine grained exceptions.

exception microscope.DisabledDeviceError[source]

Bases: IncompatibleStateError

Raised when an operation requires an enabled device but the device is disabled.

exception microscope.IncompatibleStateError[source]

Bases: DeviceError

Raised when an operation is incompatible with the current device state.

This exception is raised when the device is in a state incompatible with an attempted operation, e.g., calling trigger on a device that is set for hardware triggers. The subclass DisabledDeviceError provides an exception specific to the case where the issue is the device being disabled.

Note

This exception is for attempting to perform some action but device is wrong state. If the issue is about a setting that is incompatible with some other setting that this specific device does not support, then UnsupportedFeatureError should be raised.

exception microscope.InitialiseError[source]

Bases: DeviceError

Raised when a device fails to initialise.

This exception is raised when there is a failure connecting to a device, typically because the device is not connected, or the serial number or port address is incorrect.

exception microscope.LibraryLoadError[source]

Bases: MicroscopeError

Raised when the loading and initialisation of a device library fails.

This exception is raised when a shared library or DLL fails to load, typically because the required library is not found or is missing some required symbol.

If there is a module that is a straight wrapper to the C library (there should be one on the microscope._wrappers package) then this exception can easily be used chained with the exception that originated it like so:

.. code-block:: python
try:

import microscope._wrappers.libname

except Exception as e:

raise microscope.LibraryLoadError(e) from e

exception microscope.MicroscopeError[source]

Bases: Exception

Base class for Python Microscope exceptions.

class microscope.ROI(left: int, top: int, width: int, height: int)[source]

Bases: tuple

A tuple that defines a region of interest.

This rectangle format completely defines the ROI without reference to the sensor geometry.

height: int

Alias for field number 3

left: int

Alias for field number 0

top: int

Alias for field number 1

width: int

Alias for field number 2

class microscope.TriggerMode(value)[source]

Bases: Enum

Mode of a trigger for a microscope.abc.TriggerTargetMixin.

The trigger mode defines what type of action when a trigger is received, as opposed to the trigger type which defines what constitutes a trigger. The exact type of action is highly dependent on device type, so check their documentation.

TriggerMode.ONCE

Act once. For example, acquire a single image when a camera is triggered.

TriggerMode.BULB

Act while device is being triggered. For example, a laser keeps emitting emit light or a camera keeps exposing while the trigger line is high. This trigger mode is incompatible with TriggerType.SOFTWARE.

TriggerMode.STROBE

Act repeatably while device is being triggered. For example, a camera keep acquiring multiple images while the trigger line is high.

BULB = 2
ONCE = 1
START = 4
STROBE = 3
class microscope.TriggerType(value)[source]

Bases: Enum

Type of a trigger for a microscope.abc.TriggerTargetMixin.

The trigger type defines what constitutes a trigger, as opposed to the trigger mode which defines a type of action when the trigger is received.

TriggerType.SOFTWARE

when microscope.abc.TriggerTargetMixin.trigger() is called

TriggerType.RISING_EDGE

when level changes to high

TriggerType.FALLING_EDGE

when level changes to low

FALLING_EDGE = 2
HIGH = 1
LOW = 2
PULSE = 3
RISING_EDGE = 1
SOFTWARE = 0
exception microscope.UnsupportedFeatureError[source]

Bases: DeviceError

Raised when some operation requires a feature that is not supported.

This exception is raised when an operation requires some feature that is not supported, either because the physical device does not provide it, or Python Microscope has not yet implemented it. For example, most devices do not support all trigger modes.

Subpackages

Submodules