herosdevices.hardware.picotechnology - Heros Devices 0.7.1 documentation

Skip to content
Back to top
View this page

# herosdevices.hardware.picotechnology

Driver classes for Pico Technology Ltd. devices.

## Module Contents

herosdevices.hardware.picotechnology.PICO_CHANNEL_FLAGS = [1, 2, 4, 8, 16, 32, 64, 128]

herosdevices.hardware.picotechnology.PICO_RANGE

herosdevices.hardware.picotechnology.DEFAULT_CONFIG

herosdevices.hardware.picotechnology.ps6000a = None

class herosdevices.hardware.picotechnology.Picoscope(serial_num: str, config_dict: dict, default_config: str | None = None, **kwargs)

  Bases: `herosdevices.core.templates.oscilloscope.OscilloscopeTemplate`

  A class to interface Pico Technology computer oscilloscopes.

  This is the base class for the different models and can not be used standalone. Please refer to the specific model drivers.

  serial_num: str
  default_config_dict
  assert_status(result: int) → None

    Check if a command result was successful.

    Parameters:

      result – Returnvalue from a picoscope command.

    Raises:

      AssertionError – If the result is not `PICO_OK`.

  get_scope
  acquisition_running: bool = False
  payload_metadata: dict
  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 camera:
            camera.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.

  start() → bool

    Fire a software trigger.

    Returns:

      True if successful

  stop() → bool

    Abort the exposure and release queued buffers.

    Returns:

      True if successful

  reset() → None

    Reset the device by aborting any ongoing exposure, 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 = '', metadata: dict | None = None) → 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

      - metadata – Metadata that is merged into the current payload metadata dict which is send with every emitted `acquisition_data` event.

  set_configuration
  update_payload_metadata(metadata: dict, merge: bool = True) → None

    Update metadata dict send with every emitted frame by the `acquisition_data` event method.

    Parameters:

      - metadata – Metadata that is merged into the current payload metadata dict which is send with every emitted `acquisition_data` event.

      - merge – If `True`, the new dict is merged with the current set metadata dict. If `False` the old metadata is overwritten by the given dict.

  arm(metadata: dict | None = None, kill_running: bool = False) → bool

    Arm the device with the currently active configuration.

    Parameters:

      - metadata – Metadata that is merged into the current payload metadata dict which is send with every emitted `acquisition_data` event.

      - kill_running – If `True` any running acquisition will be stopped. If `False` and an acquisition is

      - running (already)

      - raised. (an error will be)

    Returns:

      True if arming was successful else False

  acquisition_data(frame: numpy.ndarray, metadata: dict | None = None) → tuple

    Event to emit new frames.

    Note

    The dtype of the frame is not changed here.

    Parameters:

      - frame – The frame payload data (for example an image or an scope trace)

      - metadata – The metadata which is passed along the payload. This argument takes precedence over the `payload_metadata` attribute (for example set by the `update_payload_metadata` method) while merging the two dicts.

    Returns:

      A tuple of image and metadata(-dict)

  acquisition_started(metadata: dict | None = None) → dict

    Event emitted when the acquisition thread starts.

    Returns:

      A dict with acquisition metadata

  acquisition_stopped(metadata: dict | None = None) → dict

    Event emitted when the acquisition thread stops.

    Returns:

      A dict with acquisition metadata

class herosdevices.hardware.picotechnology.Picoscope6000a(serial_num: str, config_dict: dict, default_config: str | None = None, **kwargs)

  Bases: `Picoscope`

  Driver class for the Picoscope 6000 series.

  Note

  You need the official picoscope sdk installed. Note that it is not on PyPi and you need to follow the instructions here

  Example

  The class can be started with BOSS with the following example JSON dict:

      {
        "_id": "myscope",
        "classname": "herosdevices.hardware.picotechnology.Picoscope6000a",
        "arguments": {
          "serial_num": "JP306/0102",
          "default_config": "default",
          "config_dict": {
            "default": {
              "ch0": {
                "coupling": "PICO_DC_50OHM",
                "range": "PICO_100MV"
              },
              "ch1": {
                "coupling": "PICO_DC_50OHM",
                "range": "PICO_5V",
                "record_trace": false
              },
              "trigger": {
                "source": 1,
                "threshold": 1.5
              },
              "acquisition": {
                "trace_length": 0.000006,
                "sample_time": 2e-10
              }
            }
          }
        }
      }

  serial_num: str
  default_config_dict
  assert_status(result: int) → None

    Check if a command result was successful.

    Parameters:

      result – Returnvalue from a picoscope command.

    Raises:

      AssertionError – If the result is not `PICO_OK`.

  get_scope
  acquisition_running: bool = False
  payload_metadata: dict
  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 camera:
            camera.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.

  start() → bool

    Fire a software trigger.

    Returns:

      True if successful

  stop() → bool

    Abort the exposure and release queued buffers.

    Returns:

      True if successful

  reset() → None

    Reset the device by aborting any ongoing exposure, 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 = '', metadata: dict | None = None) → 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

      - metadata – Metadata that is merged into the current payload metadata dict which is send with every emitted `acquisition_data` event.

  set_configuration
  update_payload_metadata(metadata: dict, merge: bool = True) → None

    Update metadata dict send with every emitted frame by the `acquisition_data` event method.

    Parameters:

      - metadata – Metadata that is merged into the current payload metadata dict which is send with every emitted `acquisition_data` event.

      - merge – If `True`, the new dict is merged with the current set metadata dict. If `False` the old metadata is overwritten by the given dict.

  arm(metadata: dict | None = None, kill_running: bool = False) → bool

    Arm the device with the currently active configuration.

    Parameters:

      - metadata – Metadata that is merged into the current payload metadata dict which is send with every emitted `acquisition_data` event.

      - kill_running – If `True` any running acquisition will be stopped. If `False` and an acquisition is

      - running (already)

      - raised. (an error will be)

    Returns:

      True if arming was successful else False

  acquisition_data(frame: numpy.ndarray, metadata: dict | None = None) → tuple

    Event to emit new frames.

    Note

    The dtype of the frame is not changed here.

    Parameters:

      - frame – The frame payload data (for example an image or an scope trace)

      - metadata – The metadata which is passed along the payload. This argument takes precedence over the `payload_metadata` attribute (for example set by the `update_payload_metadata` method) while merging the two dicts.

    Returns:

      A tuple of image and metadata(-dict)

  acquisition_started(metadata: dict | None = None) → dict

    Event emitted when the acquisition thread starts.

    Returns:

      A dict with acquisition metadata

  acquisition_stopped(metadata: dict | None = None) → dict

    Event emitted when the acquisition thread stops.

    Returns:

      A dict with acquisition metadata