microscope.simulators package

Simulated devices for use during development.

This module provides a series of test devices, which mimic real hardware behaviour. They implement the different ABC.

class microscope.simulators.SimulatedCamera(**kwargs)[source]

Bases: microscope._utils.OnlyTriggersOnceOnSoftwareMixin, microscope.abc.Camera


Stop acquisition as soon as possible.


Return the cycle time in seconds.


Return the current exposure time in seconds.


Return the current trigger mode.

One of



Set the exposure time on the device in seconds.

class microscope.simulators.SimulatedController(devices: Mapping[str, microscope.abc.Device])[source]

Bases: microscope.abc.Controller

property devices

Map of names to the controlled devices.

class microscope.simulators.SimulatedDeformableMirror(n_actuators, **kwargs)[source]

Bases: microscope._utils.OnlyTriggersOnceOnSoftwareMixin, microscope.abc.DeformableMirror


Method for debug purposes only.

This method is not part of the DeformableMirror ABC, it only exists on this test device to help during development.

property n_actuators
class microscope.simulators.SimulatedFilterWheel(**kwargs)[source]

Bases: microscope.abc.FilterWheel

class microscope.simulators.SimulatedLightSource(**kwargs)[source]

Bases: microscope._utils.OnlyTriggersBulbOnSoftwareMixin, microscope.abc.LightSource


Return True if the light source is currently able to produce light.


Query and return the light source status.

class microscope.simulators.SimulatedStage(limits: Mapping[str, microscope.AxisLimits], **kwargs)[source]

Bases: microscope.abc.Stage

A test stage with any number of axis.


limits – map of test axis to be created and their limits.

# Test XY motorized stage of square shape:
xy_stage = SimulatedStage({
    'X' : AxisLimits(0, 5000),
    'Y' : AxisLimits(0, 5000),

# XYZ stage, on rectangular shape and negative coordinates:
xyz_stage = SimulatedStage({
    'X' : AxisLimits(-5000, 5000),
    'Y' : AxisLimits(-10000, 12000),
    'Z' : AxisLimits(0, 1000),
property axes

Map of axis names to the corresponding StageAxis.

for name, axis in stage.axes.items():
    print(f'moving axis named {name}')

If an axis is not available then it is not included, i.e., given a stage with optional axes the missing axes will not appear on the returned dict with a value of None or some other special StageAxis instance.

move_by(delta: Mapping[str, float])None[source]

Move axes by the corresponding amounts.


delta – map of axis name to the amount to be moved.

# Move 'x' axis by 10.2 units and the y axis by -5 units:
stage.move_by({'x': 10.2, 'y': -5})

# The above is equivalent, but possibly faster than:

The axes will not move beyond limits(). If delta would move an axis beyond it limit, no exception is raised. Instead, the stage will move until the axis limit.

move_to(position: Mapping[str, float])None[source]

Move axes to the corresponding positions.


position – map of axis name to the positions to move to.

# Move 'x' axis to position 8 and the y axis to position -5.3
stage.move_to({'x': 8, 'y': -5.3})

# The above is equivalent to

The axes will not move beyond limits(). If positions is beyond the limits, no exception is raised. Instead, the stage will move until the axes limit.

class microscope.simulators.SimulatedStageAxis(limits: microscope.AxisLimits)[source]

Bases: microscope.abc.StageAxis

property limits

Upper and lower limits values for position.

move_by(delta: float)None[source]

Move axis by given amount.

move_to(pos: float)None[source]

Move axis to specified position.

property position

Current axis position.