BioImager  4.9.0
A .NET microscopy imaging application based on Bio library. Supports various microscopes by using imported libraries & GUI automation. Supports XInput game controllers to move stage, take images, run ImageJ macros on images or Bio C# scripts.
Loading...
Searching...
No Matches
microscope.controllers.zaber.ZaberDaisyChain Class Reference
Inheritance diagram for microscope.controllers.zaber.ZaberDaisyChain:
microscope.abc.Controller microscope.abc.Device

Public Member Functions

None __init__ (self, str port, typing.Mapping[int, ZaberDeviceType] address2type, **kwargs)
 
typing.Dict[str, microscope.abc.Devicedevices (self)
 
- Public Member Functions inherited from microscope.abc.Controller
- Public Member Functions inherited from microscope.abc.Device
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)
 
 get_setting (self, str name)
 
 get_all_settings (self)
 
None set_setting (self, str name, value)
 
 describe_setting (self, str name)
 
 describe_settings (self)
 
 update_settings (self, incoming, bool init=False)
 

Protected Attributes

 _conn = _ZaberConnection(port, baudrate=115200, timeout=0.5)
 
dict _devices = {}
 
- Protected Attributes inherited from microscope.abc.Device
dict _settings = {}
 

Additional Inherited Members

- Public Attributes inherited from microscope.abc.Device
bool enabled = False
 
- Protected Member Functions inherited from microscope.abc.Controller
None _do_shutdown (self)
 
- Protected Member Functions inherited from microscope.abc.Device
 _do_disable (self)
 
 _do_enable (self)
 

Detailed Description

A daisy chain of Zaber devices.

Args:
    port: the port name to connect to.  For example, `COM1`,
        `/dev/ttyUSB0`, or `/dev/cuad1`.
    address2type: a map of device addresses to the corresponding
        :class:`ZaberDeviceType`.

Zaber devices can be daisy-chained, i.e., a set of Zaber devices
can be connected in a sequence so that each device is only wired
to the previous and next device in the sequence, and only the
first device in the sequence is connected to the computer.  Even
if there is only Zaber device, this is modelled as a one element
daisy-chain.  If there are multiple devices, all connected
directly to the computer, i.e., not chained, then each device is
its own one-element daisy-chain.

.. code-block:: python

    from microscope.controllers.zaber import ZaberDaisyChain, ZaberDeviceType
    zaber = ZaberDaisyChain("/dev/ttyUSB0",
                            {2: ZaberDeviceType.STAGE,
                             3: ZaberDeviceType.LED_CONTROLLER,
                             4: ZaberDeviceType.FILTER_WHEEL})

    # Device names are strings, not int.
    filterwheel = zaber.devices['4']

    # LEDs are not devices of the zaber daisy chain, they are
    # devices of the LED controller.
    led_controller = zaber.devices['3']
    led1 = led_controller.devices['LED1']

    # Stage axis names are the string of the axis number.
    xy_stage = zaber.devices['2']
    motor1 = xy_stage.axes['1']

Each device on a chain is identified by a device address which is
an integer between 1 and 99.  By default, the addresses start at 1
and are sorted by distance to the computer, but this can be
changed.

For an LED controller device, the names of its devices are "LED1",
"LED2", etc, the same as the labels on the LED controller itself.

Because there is no method to correctly guess a device type, a map
of device addresses to device types is required.

.. note::

   Zaber devices need to be homed before they can be moved.  A
   stage will be homed during `enable` but a filter wheel will be
   homed during the object construction.

Definition at line 531 of file zaber.py.

Constructor & Destructor Documentation

◆ __init__()

None microscope.controllers.zaber.ZaberDaisyChain.__init__ ( self,
str port,
typing.Mapping[int, ZaberDeviceType] address2type,
** kwargs )

Reimplemented from microscope.abc.Device.

Definition at line 588 of file zaber.py.

593 ) -> None:
594 super().__init__(**kwargs)
595 self._conn = _ZaberConnection(port, baudrate=115200, timeout=0.5)
596 self._devices: typing.Dict[str, microscope.abc.Device] = {}
597
598 for address, device_type in address2type.items():
599 if address < 1 or address > 99:
600 raise ValueError("address must be an integer between 1-99")
601 dev_cls = device_type.value
602 self._devices[str(address)] = dev_cls(self._conn, address)
603

Member Function Documentation

◆ devices()

typing.Dict[str, microscope.abc.Device] microscope.controllers.zaber.ZaberDaisyChain.devices ( self)
Map of names to the controlled devices.

Reimplemented from microscope.abc.Controller.

Definition at line 605 of file zaber.py.

605 def devices(self) -> typing.Dict[str, microscope.abc.Device]:
606 return self._devices

Member Data Documentation

◆ _conn

microscope.controllers.zaber.ZaberDaisyChain._conn = _ZaberConnection(port, baudrate=115200, timeout=0.5)
protected

Definition at line 595 of file zaber.py.

◆ _devices

dict microscope.controllers.zaber.ZaberDaisyChain._devices = {}
protected

Definition at line 596 of file zaber.py.


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