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

abort()[source]

Stop acquisition as soon as possible.

get_cycle_time()[source]

Return the cycle time in seconds.

get_exposure_time()[source]

Return the current exposure time in seconds.

get_trigger_type()[source]

Return the current trigger mode.

One of

TRIGGER_AFTER, TRIGGER_BEFORE or TRIGGER_DURATION (bulb exposure.)

set_exposure_time(value)[source]

Set the exposure time on the device in seconds.

soft_trigger()[source]
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

get_current_pattern()[source]

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

get_is_on()[source]

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

get_status()[source]

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.

Parameters

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}')
    axis.move_by(1)

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.

Parameters

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:
stage.axes['x'].move_by(10.2)
stage.axes['y'].move_by(-5)

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.

Parameters

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
stage.axes['x'].move_to(8)
stage.axes['y'].move_to(-5.3)

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.