herosdevices.hardware.thorlabs.mdt69xb
======================================

.. py:module:: herosdevices.hardware.thorlabs.mdt69xb

.. autoapi-nested-parse::

   Device driver for ThorLabs MDT69XB Piezo Controllers.







Module Contents
---------------

.. py:data:: MDT69XB_CHANNELS

.. py:class:: MDT694B(address: str, timeout: float = 1.0)

   Bases: :py:obj:`herosdevices.core.templates.SerialDeviceTemplate`


   Device driver for the MDT694B Single Channel, Open-Loop Piezo Controller.

   :param address: Serial address of the device. Example: "/dev/ttyUSB0"
   :param timeout: timeout for read operations.


   .. py:attribute:: voltage_x
      :type:  float


   .. py:attribute:: min_voltage_x
      :type:  float


   .. py:attribute:: max_voltage_x
      :type:  float


   .. py:method:: initial_piezo_loop(voltage_start: float, voltage_stop: float, channel: int | str = 0) -> None

      Perform a piezo voltage loop to compensate for hysteresis effects.

      This function executes a voltage cycle (start -> stop -> start) on the specified piezo axis. Doing this
      before setting the target value helps compensate for the hysteresis behavior inherent in piezo actuators.

      :param channel: The piezo axis to control. Can be either:
                      - Integer (0, 1, 2) corresponding to x, y, z axes respectively
                      - String ('x', 'y', 'z') directly specifying the axis
                      For the one channel MDT694B, only x or 0 is valid.
      :param voltage_start: Starting voltage in volts for the hysteresis compensation loop
      :param voltage_stop: Stop voltage in volts for the hysteresis compensation loop

      :raises ValueError: If channel is not a valid channel for the device



   .. py:attribute:: address


   .. py:attribute:: connection


.. py:class:: MDT693B(address: str, timeout: float = 1.0)

   Bases: :py:obj:`MDT694B`


   Device driver for the MDT693B 3-Channel, Open-Loop Piezo Controller.


   .. py:attribute:: voltage_y
      :type:  float


   .. py:attribute:: min_voltage_y
      :type:  float


   .. py:attribute:: max_voltage_y
      :type:  float


   .. py:attribute:: voltage_z
      :type:  float


   .. py:attribute:: min_voltage_z
      :type:  float


   .. py:attribute:: max_voltage_z
      :type:  float


   .. py:attribute:: voltage_x
      :type:  float


   .. py:attribute:: min_voltage_x
      :type:  float


   .. py:attribute:: max_voltage_x
      :type:  float


   .. py:method:: initial_piezo_loop(voltage_start: float, voltage_stop: float, channel: int | str = 0) -> None

      Perform a piezo voltage loop to compensate for hysteresis effects.

      This function executes a voltage cycle (start -> stop -> start) on the specified piezo axis. Doing this
      before setting the target value helps compensate for the hysteresis behavior inherent in piezo actuators.

      :param channel: The piezo axis to control. Can be either:
                      - Integer (0, 1, 2) corresponding to x, y, z axes respectively
                      - String ('x', 'y', 'z') directly specifying the axis
                      For the one channel MDT694B, only x or 0 is valid.
      :param voltage_start: Starting voltage in volts for the hysteresis compensation loop
      :param voltage_stop: Stop voltage in volts for the hysteresis compensation loop

      :raises ValueError: If channel is not a valid channel for the device



   .. py:attribute:: address


   .. py:attribute:: connection


.. py:class:: MDT69xBChannel(host_device: MDT693B | MDT694B, channel: int | str = 'x')

   Bases: :py:obj:`herosdevices.interfaces.atomiq.VoltageSource`


   A single channel of a MDT69xB piezo driver.

   This class provides an :py:class:`herosdevices.interfaces.atomiq.VoltageSource` compatible interface to control a
   single channel of a MDT69xB piezo driver.

   .. note::

      This class does not directly connect to the hardware but to another object given by the host_device argument
      which can also be a HERO running on another machine. It can be used to provide a universal interface which does
      not require setting a channel for every operation.

   :param host_device: The host MDT69xB device (MDT693B or MDT694B).
   :param channel: The channel to control (can be int 0-2 or str 'x', 'y', 'z', depending on host_device)

   :raises ValueError: If the channel is not valid for the host device


   .. py:attribute:: host_device


   .. py:attribute:: channel
      :type:  str


   .. py:property:: voltage
      :type: float


      Get or set the current voltage of the channel.

      :returns: The current voltage in volts


   .. py:property:: max_voltage
      :type: float


      Get or set the maximum voltage limit for the channel.

      :returns: The maximum voltage limit in volts


   .. py:property:: min_voltage
      :type: float


      Get or set the minimum voltage limit for the channel.

      :returns: The minimum voltage limit in volts


   .. py:method:: initial_piezo_loop(voltage_start: float, voltage_stop: float) -> None

      Perform a piezo voltage loop to compensate for hysteresis effects.

      This function executes a voltage cycle (start -> stop -> start) on the specified piezo axis. Doing this
      before setting the target value helps compensate for the hysteresis behavior inherent in piezo actuators.

      :param voltage_start: Starting voltage in volts for the hysteresis compensation loop
      :param voltage_stop: Stop voltage in volts for the hysteresis compensation loop

      :raises ValueError: If channel is not a valid channel for the device



   .. py:attribute:: default_ramp_steps
      :type:  int
      :value: 30



   .. py:attribute:: blind
      :type:  bool
      :value: False



