BioImager  3.9.1
A .NET microscopy imaging library. Supports various microscopes by using imported libraries & GUI automation. Supported libraries include PriorĀ® & ZeissĀ® & all devices supported by Micromanager 2.0 and python-microscope.
Loading...
Searching...
No Matches
microscope.abc.Stage Class Reference
Inheritance diagram for microscope.abc.Stage:
microscope.abc.Device microscope.controllers.zaber._ZaberStage microscope.simulators.SimulatedStage microscope.stages.ludl._LudlStage

Public Member Functions

typing.Mapping[str, StageAxisaxes (self)
 
bool may_move_on_enable (self)
 
typing.Mapping[str, float] position (self)
 
typing.Mapping[str, microscope.AxisLimitslimits (self)
 
None move_by (self, typing.Mapping[str, float] delta)
 
None move_to (self, typing.Mapping[str, float] position)
 
- Public Member Functions inherited from microscope.abc.Device
None __init__ (self)
 
None __del__ (self)
 
bool get_is_enabled (self)
 
None disable (self)
 
None enable (self)
 
None initialize (self)
 
None shutdown (self)
 
None add_setting (self, name, dtype, get_func, set_func, values, typing.Optional[typing.Callable[[], bool]] readonly=None)
 
def get_setting (self, str name)
 
def get_all_settings (self)
 
None set_setting (self, str name, value)
 
def describe_setting (self, str name)
 
def describe_settings (self)
 
def update_settings (self, incoming, bool init=False)
 

Additional Inherited Members

- Public Attributes inherited from microscope.abc.Device
 enabled
 

Detailed Description

A stage device, composed of :class:`StageAxis` instances.

A stage device can have any number of axes and dimensions.  For a
single `StageDevice` instance each axis has a name that uniquely
identifies it.  The names of the individual axes are hardware
dependent and will be part of the concrete class documentation.
They are typically strings such as `"x"` or `"y"`.

.. code-block:: python

    stage = SomeStageDevice()
    stage.enable()  # may trigger a stage move

    # move operations
    stage.move_to({'x': 42.0, 'y': -5.1})
    stage.move_by({'x': -5.3, 'y': 14.6})

    # Individual StageAxis can be controlled directly.
    x_axis = stage.axes['x']
    y_axis = stage.axes['y']
    x_axis.move_to(42.0)
    y_axis.move_by(-5.3)

Not all stage devices support simultaneous move of multiple axes.
Because of this, there is no guarantee that move operations with
multiple axes are done simultaneously.  Refer to the concrete
class documentation for hardware specific details.

If a move operation involves multiple axes and there is no support
for simultaneous move, the order of the moves is undefined.  If a
specific order is required, one can either call the move functions
multiple times in the expected order, or do so via the individual
axes, like so:

.. code-block:: python

    # Move the x axis first, then mvoe the y axis:
    stage.move_by({'x': 10})
    stage.move_by({'y': 4})

    # The same thing but via the individual axes:
    stage.axes['x'].move_by(10)
    stage.axes['y'].move_by(4)

Move operations will not attempt to move a stage beyond its
limits.  If a call to the move functions would require the stage
to move beyond its limits the move operation is clipped to the
axes limits.  No exception is raised.

.. code-block:: python

    # Moves x axis to the its upper limit:
    x_axis.move_to(x_axis.limits.upper)

    # The same as above since the move operations are clipped to
    # the axes limits automatically.
    import math
    x_axis.move_to(math.inf)
    x_axis.move_by(math.inf)

Some stages need to find a reference position, home, before being
able to be moved.  If required, this happens automatically during
:func:`enable` (see also :func:`may_move_on_enable`).

Definition at line 1387 of file abc.py.

Member Function Documentation

◆ axes()

typing.Mapping[str, StageAxis] microscope.abc.Stage.axes (   self)
Map of axis names to the corresponding :class:`StageAxis`.

.. code-block:: python

    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.

Reimplemented in microscope.controllers.zaber._ZaberStage, microscope.simulators.SimulatedStage, and microscope.stages.ludl._LudlStage.

Definition at line 1455 of file abc.py.

1455 def axes(self) -> typing.Mapping[str, StageAxis]:
1456 """Map of axis names to the corresponding :class:`StageAxis`.
1457
1458 .. code-block:: python
1459
1460 for name, axis in stage.axes.items():
1461 print(f'moving axis named {name}')
1462 axis.move_by(1)
1463
1464 If an axis is not available then it is not included, i.e.,
1465 given a stage with optional axes the missing axes will *not*
1466 appear on the returned dict with a value of `None` or some
1467 other special `StageAxis` instance.
1468 """
1469 raise NotImplementedError()
1470
1471

Referenced by microscope.abc.Stage.limits(), microscope.simulators.SimulatedStage.move_by(), microscope.simulators.SimulatedStage.move_to(), and microscope.abc.Stage.position().

◆ limits()

typing.Mapping[str, microscope.AxisLimits] microscope.abc.Stage.limits (   self)
Map of axis name to its upper and lower limits.

.. code-block:: python

    for name, limits in stage.limits.items():
        print(f'{name} axis lower limit is {limits.lower}')
        print(f'{name} axis upper limit is {limits.upper}')

These are the limits currently imposed by the device or
underlying software and may change over the time of the
`StageDevice` object.

The units of the limits is the same as the ones being
currently used for the move operations.

Definition at line 1515 of file abc.py.

1515 def limits(self) -> typing.Mapping[str, microscope.AxisLimits]:
1516 """Map of axis name to its upper and lower limits.
1517
1518 .. code-block:: python
1519
1520 for name, limits in stage.limits.items():
1521 print(f'{name} axis lower limit is {limits.lower}')
1522 print(f'{name} axis upper limit is {limits.upper}')
1523
1524 These are the limits currently imposed by the device or
1525 underlying software and may change over the time of the
1526 `StageDevice` object.
1527
1528 The units of the limits is the same as the ones being
1529 currently used for the move operations.
1530
1531 """
1532 return {name: axis.limits for name, axis in self.axes.items()}
1533

References microscope.abc.Stage.axes(), microscope.controllers.zaber._ZaberStage.axes(), microscope.simulators.SimulatedStage.axes(), and microscope.stages.ludl._LudlStage.axes().

Referenced by microscope.stages.ludl._LudlStageAxis.limits().

◆ may_move_on_enable()

bool microscope.abc.Stage.may_move_on_enable (   self)
Whether calling :func:`enable` is likely to make the stage move.

Most stages need to be driven to their limits at startup to
find a repeatable zero position and sometimes to find their
limits as well.  This is typically called "homing".

Stages that need to "home" differ on how often they need it
but they only do it during :func:`enable`.  They may need to
move each time `enable` is called, the first time after the
`Stage` object has been created, or even only the first time
since the device was powered up.

Note the "*may*" on "may_move_on_enable".  This is because it
can be difficult to know for certain if `enable` will cause
the stage to home.  Still, knowing that the stage *may* move
is essential for safety.  An unexpected movement of the stage,
particularly large movements such as moving to the stage
limits, can destroy a sample on the stage --- or even worse,
it can damage an objective or the stage itself.  When in
doubt, implementations should return `True`.

Reimplemented in microscope.controllers.zaber._ZaberStage, microscope.simulators.SimulatedStage, and microscope.stages.ludl._LudlStage.

Definition at line 1473 of file abc.py.

1473 def may_move_on_enable(self) -> bool:
1474 """Whether calling :func:`enable` is likely to make the stage move.
1475
1476 Most stages need to be driven to their limits at startup to
1477 find a repeatable zero position and sometimes to find their
1478 limits as well. This is typically called "homing".
1479
1480 Stages that need to "home" differ on how often they need it
1481 but they only do it during :func:`enable`. They may need to
1482 move each time `enable` is called, the first time after the
1483 `Stage` object has been created, or even only the first time
1484 since the device was powered up.
1485
1486 Note the "*may*" on "may_move_on_enable". This is because it
1487 can be difficult to know for certain if `enable` will cause
1488 the stage to home. Still, knowing that the stage *may* move
1489 is essential for safety. An unexpected movement of the stage,
1490 particularly large movements such as moving to the stage
1491 limits, can destroy a sample on the stage --- or even worse,
1492 it can damage an objective or the stage itself. When in
1493 doubt, implementations should return `True`.
1494
1495 """
1496 raise NotImplementedError()
1497
1498

◆ move_by()

None microscope.abc.Stage.move_by (   self,
typing.Mapping[str, float]  delta 
)
Move axes by the corresponding amounts.

Args:
    delta: map of axis name to the amount to be moved.

.. code-block:: python

    # 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 :func:`limits`.  If `delta`
would move an axis beyond it limit, no exception is raised.
Instead, the stage will move until the axis limit.

Reimplemented in microscope.controllers.zaber._ZaberStage, microscope.simulators.SimulatedStage, and microscope.stages.ludl._LudlStage.

Definition at line 1535 of file abc.py.

1535 def move_by(self, delta: typing.Mapping[str, float]) -> None:
1536 """Move axes by the corresponding amounts.
1537
1538 Args:
1539 delta: map of axis name to the amount to be moved.
1540
1541 .. code-block:: python
1542
1543 # Move 'x' axis by 10.2 units and the y axis by -5 units:
1544 stage.move_by({'x': 10.2, 'y': -5})
1545
1546 # The above is equivalent, but possibly faster than:
1547 stage.axes['x'].move_by(10.2)
1548 stage.axes['y'].move_by(-5)
1549
1550 The axes will not move beyond :func:`limits`. If `delta`
1551 would move an axis beyond it limit, no exception is raised.
1552 Instead, the stage will move until the axis limit.
1553
1554 """
1555 # TODO: implement a software fallback that moves the
1556 # individual axis, for stages that don't have provide
1557 # simultaneous move of multiple axes.
1558 raise NotImplementedError()
1559

References microscope.abc.Stage.move_by().

Referenced by microscope.abc.Stage.move_by().

◆ move_to()

None microscope.abc.Stage.move_to (   self,
typing.Mapping[str, float]  position 
)
Move axes to the corresponding positions.

Args:
    position: map of axis name to the positions to move to.

.. code-block:: python

    # 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 :func:`limits`.  If `positions`
is beyond the limits, no exception is raised.  Instead, the
stage will move until the axes limit.

Reimplemented in microscope.controllers.zaber._ZaberStage, microscope.simulators.SimulatedStage, and microscope.stages.ludl._LudlStage.

Definition at line 1561 of file abc.py.

1561 def move_to(self, position: typing.Mapping[str, float]) -> None:
1562 """Move axes to the corresponding positions.
1563
1564 Args:
1565 position: map of axis name to the positions to move to.
1566
1567 .. code-block:: python
1568
1569 # Move 'x' axis to position 8 and the y axis to position -5.3
1570 stage.move_to({'x': 8, 'y': -5.3})
1571
1572 # The above is equivalent to
1573 stage.axes['x'].move_to(8)
1574 stage.axes['y'].move_to(-5.3)
1575
1576 The axes will not move beyond :func:`limits`. If `positions`
1577 is beyond the limits, no exception is raised. Instead, the
1578 stage will move until the axes limit.
1579
1580 """
1581 raise NotImplementedError()

References microscope.abc.Stage.move_to().

Referenced by microscope.stages.ludl._LudlStageAxis.limits(), microscope.simulators.SimulatedStageAxis.move_by(), and microscope.abc.Stage.move_to().

◆ position()

typing.Mapping[str, float] microscope.abc.Stage.position (   self)
Map of axis name to their current position.

.. code-block:: python

    for name, position in stage.position.items():
        print(f'{name} axis is at position {position}')

The units of the position is the same as the ones being
currently used for the absolute move (:func:`move_to`)
operations.

Definition at line 1500 of file abc.py.

1500 def position(self) -> typing.Mapping[str, float]:
1501 """Map of axis name to their current position.
1502
1503 .. code-block:: python
1504
1505 for name, position in stage.position.items():
1506 print(f'{name} axis is at position {position}')
1507
1508 The units of the position is the same as the ones being
1509 currently used for the absolute move (:func:`move_to`)
1510 operations.
1511 """
1512 return {name: axis.position for name, axis in self.axes.items()}
1513

References microscope.abc.Stage.axes(), microscope.controllers.zaber._ZaberStage.axes(), microscope.simulators.SimulatedStage.axes(), and microscope.stages.ludl._LudlStage.axes().

Referenced by microscope.abc.FilterWheel.get_num_positions(), and microscope.stages.ludl._LudlStageAxis.limits().


The documentation for this class was generated from the following file: