herosdevices.hardware.dummy.displays - Heros Devices 0.6.0 documentation

Skip to content
Back to top
View this page

# herosdevices.hardware.dummy.displays

Dummy SLM for testing purposes.

## Module Contents

herosdevices.hardware.dummy.displays.compute_intensity_in_focal_plane(phase_pattern: numpy.array, value_2_pi: float = 1024) → numpy.array

  Compute intensity in the focal plane of a lens after imprinting the given phase pattern.

class herosdevices.hardware.dummy.displays.SlmDummy(config_dict: dict, default_config: str | None = None, keep_device_open: bool = True, simulate: bool = True)

  Bases: `herosdevices.core.templates.DisplayDeviceTemplate`

  Dummy SLM for testing purposes.

  default_config_dict: dict
  image_size: tuple | list
  value_2_pi: float
  simulate: bool
  firmware_serialnumber() → str

    Return a dummy firmware serial number.

  simulation_data(image: numpy.ndarray, metadata: dict = {}) → tuple

    Publish simulation results.

  phase_data(phase: numpy.ndarray, metadata: dict = {}) → tuple

    Publish phase pattern.

  keep_device_open = True
  default_config: str
  get_device() → collections.abc.Iterator[None]

    Yield a device handle.

        # use the device in a with statement
        with self.get_device() as slm:
            slm.do_something()

  open() → Any

    Open the device handler and assign it to self._device.

  teardown() → None

    Release the device handler and potentially de-initialize the API.

  reset() → None

    Reset the device by closing and re-opening the handler.

  get_status() → dict

    Get a dict with the current device status.

    Returns:

      A dict with the device status

  property config_dict: dict

    Get a copy of the configuration dict.

    Returns:

      Copy of the configuration dict

  update_configuration(new_config_dict: dict, merge: bool = True) → None

    Update the configuration dict with new configuration.

    Each dict key corresponds a (new) configuration name. Each value is a dict with config property -> config value.

    Parameters:

      - new_config_dict – A dict of configurations where the keys are the configuration names

      - merge – If `True`, the new dict is recursively merged with the current set config dict. If `False` the old configurations with the provided names (keys) are overwritten.

  get_configuration() → dict

    Get the currently active configuration.

    Returns:

      The currently active configuration.

  configure(config: str = '') → bool

    Configure the device with the known configuration config.

    To add a configuration to the device, use `update_configuration()`.

    Parameters:

      config – Key (name) of the configuration

  set_configuration
  push_image(slot: int, image: numpy.typing.NDArray[numpy.uint16], display_now: bool = True) → bool

    Upload an image into a specified memory slot.

    Parameters:

      - slot – Slot number

      - image – The image

      - display_now – Flag whether to display the image immediately

  display_slot(slot: int = 1) → bool

    Set the memory slot to display on the SLM.

    Parameters:

      slot – Slot number