spectrumdevice.settings

Provides Enums and Dataclasses wrapping the register values provided by the Spectrum API, to be used for configuring hardware and interpreting responses received from hardware.

View Source
"""Provides Enums and Dataclasses wrapping the register values provided by the Spectrum API, to be used for configuring
hardware and interpreting responses received from hardware."""

# Christian Baker, King's College London
# Copyright (c) 2021 School of Biomedical Engineering & Imaging Sciences, King's College London
# Licensed under the MIT. You may obtain a copy at https://opensource.org/licenses/MIT.

from dataclasses import dataclass
from enum import Enum
from typing import List, Optional

from numpy import int16
from numpy.typing import NDArray

from spectrumdevice.settings.card_dependent_properties import ModelNumber
from spectrumdevice.settings.card_features import CardFeature, AdvancedCardFeature
from spectrumdevice.settings.channel import (
    InputImpedance,
    InputCoupling,
    InputPath,
    OutputChannelFilter,
    OutputChannelStopLevelMode,
)
from spectrumdevice.settings.device_modes import AcquisitionMode, ClockMode, GenerationMode
from spectrumdevice.settings.io_lines import IOLineMode, AvailableIOModes
from spectrumdevice.settings.transfer_buffer import (
    TransferBuffer,
)
from spectrumdevice.settings.triggering import TriggerSource, ExternalTriggerMode
from spectrumdevice.settings.status import CARD_STATUS_TYPE, DEVICE_STATUS_TYPE, StatusCode
from spectrumdevice.settings.pulse_generator import (
    PulseGeneratorTriggerSettings,
    PulseGeneratorTriggerMode,
    PulseGeneratorTriggerDetectionMode,
    PulseGeneratorMultiplexer1TriggerSource,
    PulseGeneratorMultiplexer2TriggerSource,
    PulseGeneratorOutputSettings,
)


__all__ = [
    "AcquisitionSettings",
    "TriggerSettings",
    "AcquisitionMode",
    "ClockMode",
    "CardFeature",
    "AdvancedCardFeature",
    "IOLineMode",
    "AvailableIOModes",
    "TransferBuffer",
    "TriggerSource",
    "ExternalTriggerMode",
    "CARD_STATUS_TYPE",
    "DEVICE_STATUS_TYPE",
    "StatusCode",
    "SpectrumRegisterLength",
    "ModelNumber",
    "GenerationSettings",
    "OutputChannelFilter",
    "OutputChannelStopLevelMode",
    "GenerationMode",
    "PulseGeneratorTriggerSettings",
    "PulseGeneratorTriggerMode",
    "PulseGeneratorTriggerDetectionMode",
    "PulseGeneratorMultiplexer1TriggerSource",
    "PulseGeneratorMultiplexer2TriggerSource",
    "PulseGeneratorOutputSettings",
]


@dataclass
class TriggerSettings:
    """A dataclass collecting all settings related to triggering generation and acquisition. See Spectrum documentation.
    Note that pulse generators have their own trigger options."""

    trigger_sources: List[TriggerSource]
    """The trigger sources to enable"""
    external_trigger_mode: Optional[ExternalTriggerMode] = None
    """The external trigger mode (if an external trigger is enabled)."""
    external_trigger_level_in_mv: Optional[int] = None
    """The level an external signal must reach to cause a trigger event (if an external trigger is enabled)."""
    external_trigger_pulse_width_in_samples: Optional[int] = None
    """The required width of an external trigger pulse (if an external trigger is enabled)."""


@dataclass
class AcquisitionSettings:
    """A dataclass collecting all settings required to configure an acquisition. See Spectrum documentation."""

    acquisition_mode: AcquisitionMode
    """Standard Single mode, Multi FIF mode or an averaging mode."""
    sample_rate_in_hz: int
    """Acquisition rate in samples per second."""
    acquisition_length_in_samples: int
    """The length of the recording in samples per channel."""
    pre_trigger_length_in_samples: int
    """The number of samples of the recording that will have been acquired before the trigger event."""
    timeout_in_ms: int
    """How long to wait for a trigger event before timing out."""
    enabled_channels: List[int]
    """The channel indices to enable for the acquisition."""
    vertical_ranges_in_mv: List[int]
    """The voltage range to apply to each enabled channel in mW."""
    vertical_offsets_in_percent: List[int]
    """The DC offset to apply to each enabled channel as percentages of their vertical ranges."""
    input_impedances: List[InputImpedance]
    """The input impedance settings to apply to each channel"""
    timestamping_enabled: bool
    """If True, Measurements will include the time at which the acquisition was triggered. Increases latency by ~10 ms.
    """
    batch_size: int = 1
    """The number of acquisitions to transfer to the PC before the resulting waveforms are returned by
      SpectrumDigitiserCard.get_waveforms()."""
    number_of_averages: int = 1
    """If an averaging AcquisitionMode is selected, this defines the number of averages."""
    input_couplings: Optional[List[InputCoupling]] = None
    """The coupling (AC or DC) to apply to each channel. Only available on some hardware, so default is None."""
    input_paths: Optional[List[InputPath]] = None
    """The input path (HF or Buffered) to apply to each channel. Only available on some hardware, so default is None."""


@dataclass
class GenerationSettings:
    """A dataclass collecting all settings required to configure signal generation. See Spectrum documentation."""

    generation_mode: GenerationMode
    """SPC_REP_STD_SINGLE , SPC_REP_STD_SINGLERESTART"""
    waveform: NDArray[int16]
    """The waveform to generate."""
    sample_rate_in_hz: int
    """Generation rate in samples per second."""
    num_loops: int
    """In SPC_REP_STD_SINGLE mode: the number of times to repeat the waveform after a trigger is received. In
     SPC_REP_STD_SINGLERESTART: The number of times to wait for a trigger and generate waveform once."""
    enabled_channels: list[int]
    """List of analog channel indices to enable for signal generation"""
    signal_amplitudes_in_mv: list[int]
    """The amplitude of each enabled channel."""
    dc_offsets_in_mv: list[int]
    """The dc offset of each enabled channel."""
    output_filters: list[OutputChannelFilter]
    """The output filter setting for each enabled channel."""
    stop_level_modes: list[OutputChannelStopLevelMode]
    """The behavior of each enabled channel after the waveform ends."""
    custom_stop_levels: Optional[list[Optional[int]]] = None
    """The stop level each channel will use it stop level mode is set to custom."""


class SpectrumRegisterLength(Enum):
    """Enum defining the possible lengths of a spectrum register."""

    THIRTY_TWO = 0
    """32 bit register"""
    SIXTY_FOUR = 1
    """64 bit register"""

    def __repr__(self) -> str:
        return self.name
#  
@dataclass
class AcquisitionSettings:
View Source
@dataclass
class AcquisitionSettings:
    """A dataclass collecting all settings required to configure an acquisition. See Spectrum documentation."""

    acquisition_mode: AcquisitionMode
    """Standard Single mode, Multi FIF mode or an averaging mode."""
    sample_rate_in_hz: int
    """Acquisition rate in samples per second."""
    acquisition_length_in_samples: int
    """The length of the recording in samples per channel."""
    pre_trigger_length_in_samples: int
    """The number of samples of the recording that will have been acquired before the trigger event."""
    timeout_in_ms: int
    """How long to wait for a trigger event before timing out."""
    enabled_channels: List[int]
    """The channel indices to enable for the acquisition."""
    vertical_ranges_in_mv: List[int]
    """The voltage range to apply to each enabled channel in mW."""
    vertical_offsets_in_percent: List[int]
    """The DC offset to apply to each enabled channel as percentages of their vertical ranges."""
    input_impedances: List[InputImpedance]
    """The input impedance settings to apply to each channel"""
    timestamping_enabled: bool
    """If True, Measurements will include the time at which the acquisition was triggered. Increases latency by ~10 ms.
    """
    batch_size: int = 1
    """The number of acquisitions to transfer to the PC before the resulting waveforms are returned by
      SpectrumDigitiserCard.get_waveforms()."""
    number_of_averages: int = 1
    """If an averaging AcquisitionMode is selected, this defines the number of averages."""
    input_couplings: Optional[List[InputCoupling]] = None
    """The coupling (AC or DC) to apply to each channel. Only available on some hardware, so default is None."""
    input_paths: Optional[List[InputPath]] = None
    """The input path (HF or Buffered) to apply to each channel. Only available on some hardware, so default is None."""

A dataclass collecting all settings required to configure an acquisition. See Spectrum documentation.

#   AcquisitionSettings( acquisition_mode: spectrumdevice.settings.device_modes.AcquisitionMode, sample_rate_in_hz: int, acquisition_length_in_samples: int, pre_trigger_length_in_samples: int, timeout_in_ms: int, enabled_channels: List[int], vertical_ranges_in_mv: List[int], vertical_offsets_in_percent: List[int], input_impedances: List[spectrumdevice.settings.channel.InputImpedance], timestamping_enabled: bool, batch_size: int = 1, number_of_averages: int = 1, input_couplings: Optional[List[spectrumdevice.settings.channel.InputCoupling]] = None, input_paths: Optional[List[spectrumdevice.settings.channel.InputPath]] = None )

Standard Single mode, Multi FIF mode or an averaging mode.

#   sample_rate_in_hz: int

Acquisition rate in samples per second.

#   acquisition_length_in_samples: int

The length of the recording in samples per channel.

#   pre_trigger_length_in_samples: int

The number of samples of the recording that will have been acquired before the trigger event.

#   timeout_in_ms: int

How long to wait for a trigger event before timing out.

#   enabled_channels: List[int]

The channel indices to enable for the acquisition.

#   vertical_ranges_in_mv: List[int]

The voltage range to apply to each enabled channel in mW.

#   vertical_offsets_in_percent: List[int]

The DC offset to apply to each enabled channel as percentages of their vertical ranges.

The input impedance settings to apply to each channel

#   timestamping_enabled: bool

If True, Measurements will include the time at which the acquisition was triggered. Increases latency by ~10 ms.

#   batch_size: int = 1

The number of acquisitions to transfer to the PC before the resulting waveforms are returned by SpectrumDigitiserCard.get_waveforms().

#   number_of_averages: int = 1

If an averaging AcquisitionMode is selected, this defines the number of averages.

#   input_couplings: Optional[List[spectrumdevice.settings.channel.InputCoupling]] = None

The coupling (AC or DC) to apply to each channel. Only available on some hardware, so default is None.

#   input_paths: Optional[List[spectrumdevice.settings.channel.InputPath]] = None

The input path (HF or Buffered) to apply to each channel. Only available on some hardware, so default is None.

#  
@dataclass
class TriggerSettings:
View Source
@dataclass
class TriggerSettings:
    """A dataclass collecting all settings related to triggering generation and acquisition. See Spectrum documentation.
    Note that pulse generators have their own trigger options."""

    trigger_sources: List[TriggerSource]
    """The trigger sources to enable"""
    external_trigger_mode: Optional[ExternalTriggerMode] = None
    """The external trigger mode (if an external trigger is enabled)."""
    external_trigger_level_in_mv: Optional[int] = None
    """The level an external signal must reach to cause a trigger event (if an external trigger is enabled)."""
    external_trigger_pulse_width_in_samples: Optional[int] = None
    """The required width of an external trigger pulse (if an external trigger is enabled)."""

A dataclass collecting all settings related to triggering generation and acquisition. See Spectrum documentation. Note that pulse generators have their own trigger options.

#   TriggerSettings( trigger_sources: List[spectrumdevice.settings.triggering.TriggerSource], external_trigger_mode: Optional[spectrumdevice.settings.triggering.ExternalTriggerMode] = None, external_trigger_level_in_mv: Optional[int] = None, external_trigger_pulse_width_in_samples: Optional[int] = None )

The trigger sources to enable

#   external_trigger_mode: Optional[spectrumdevice.settings.triggering.ExternalTriggerMode] = None

The external trigger mode (if an external trigger is enabled).

#   external_trigger_level_in_mv: Optional[int] = None

The level an external signal must reach to cause a trigger event (if an external trigger is enabled).

#   external_trigger_pulse_width_in_samples: Optional[int] = None

The required width of an external trigger pulse (if an external trigger is enabled).

#   class AcquisitionMode(enum.Enum):
View Source
class AcquisitionMode(Enum):
    """Enum representing the digitise acquisition modes currently support by spectrumdevice. See Spectrum documentation
    for more information about each mode."""

    SPC_REC_STD_SINGLE = SPC_REC_STD_SINGLE
    """Data acquisition to on-board memory for one single trigger event."""
    SPC_REC_FIFO_MULTI = SPC_REC_FIFO_MULTI
    """Continuous data acquisition for multiple trigger events."""
    SPC_REC_STD_AVERAGE = SPC_REC_STD_AVERAGE
    """Data acquisition to on-board memory for the average of multiple trigger events."""
    SPC_REC_FIFO_AVERAGE = SPC_REC_FIFO_AVERAGE
    """Continuous data acquisition for multiple trigger events, with on-board averaging."""

Enum representing the digitise acquisition modes currently support by spectrumdevice. See Spectrum documentation for more information about each mode.

#   SPC_REC_STD_SINGLE = <AcquisitionMode.SPC_REC_STD_SINGLE: 1>

Data acquisition to on-board memory for one single trigger event.

#   SPC_REC_FIFO_MULTI = <AcquisitionMode.SPC_REC_FIFO_MULTI: 32>

Continuous data acquisition for multiple trigger events.

#   SPC_REC_STD_AVERAGE = <AcquisitionMode.SPC_REC_STD_AVERAGE: 131072>

Data acquisition to on-board memory for the average of multiple trigger events.

#   SPC_REC_FIFO_AVERAGE = <AcquisitionMode.SPC_REC_FIFO_AVERAGE: 2097152>

Continuous data acquisition for multiple trigger events, with on-board averaging.

Inherited Members
enum.Enum
name
value
#   class ClockMode(enum.Enum):
View Source
class ClockMode(Enum):
    """Enum representing the clock modes currently supported by spectrumdevice. See Spectrum documentation for more
    information about each mode."""

    SPC_CM_INTPLL = SPC_CM_INTPLL
    """Enables internal PLL with 20 MHz internal reference for sample clock generation."""
    SPC_CM_EXTERNAL = SPC_CM_EXTERNAL
    """Enables external clock input for direct sample clock generation."""
    SPC_CM_EXTREFCLOCK = SPC_CM_EXTREFCLOCK
    """Enables internal PLL with external reference for sample clock generation."""

Enum representing the clock modes currently supported by spectrumdevice. See Spectrum documentation for more information about each mode.

#   SPC_CM_INTPLL = <ClockMode.SPC_CM_INTPLL: 1>

Enables internal PLL with 20 MHz internal reference for sample clock generation.

#   SPC_CM_EXTERNAL = <ClockMode.SPC_CM_EXTERNAL: 8>

Enables external clock input for direct sample clock generation.

#   SPC_CM_EXTREFCLOCK = <ClockMode.SPC_CM_EXTREFCLOCK: 32>

Enables internal PLL with external reference for sample clock generation.

Inherited Members
enum.Enum
name
value
#   class CardFeature(enum.Enum):
View Source
class CardFeature(Enum):
    """Enum representing the possible features of all Spectrum devices. A list of features can be read from a device
    using the feature_list property. See the Spectrum documentation for descriptions of each of the features."""

    SPCM_FEAT_MULTI = SPCM_FEAT_MULTI
    SPCM_FEAT_GATE = SPCM_FEAT_GATE
    SPCM_FEAT_DIGITAL = SPCM_FEAT_DIGITAL
    SPCM_FEAT_TIMESTAMP = SPCM_FEAT_TIMESTAMP
    SPCM_FEAT_STARHUB_4_5_6EXTM_8EXTM = SPCM_FEAT_STARHUB_4_5_6EXTM_8EXTM
    SPCM_FEAT_STARHUB_8_16_16EXTM = SPCM_FEAT_STARHUB_8_16_16EXTM
    SPCM_FEAT_ABA = SPCM_FEAT_ABA
    SPCM_FEAT_BASEXIO = SPCM_FEAT_BASEXIO
    SPCM_FEAT_AMPLIFIER_10V = SPCM_FEAT_AMPLIFIER_10V
    SPCM_FEAT_STARHUBSYSMASTER = SPCM_FEAT_STARHUBSYSMASTER
    SPCM_FEAT_DIFFMODE = SPCM_FEAT_DIFFMODE
    SPCM_FEAT_SEQUENCE = SPCM_FEAT_SEQUENCE
    SPCM_FEAT_AMPMODULE_10V = SPCM_FEAT_AMPMODULE_10V
    SPCM_FEAT_STARHUBSYSSLAVE = SPCM_FEAT_STARHUBSYSSLAVE
    SPCM_FEAT_NETBOX = SPCM_FEAT_NETBOX
    SPCM_FEAT_REMOTESERVER = SPCM_FEAT_REMOTESERVER
    SPCM_FEAT_SCAPP = SPCM_FEAT_SCAPP
    SPCM_FEAT_CUSTOMMOD_MASK = SPCM_FEAT_CUSTOMMOD_MASK

Enum representing the possible features of all Spectrum devices. A list of features can be read from a device using the feature_list property. See the Spectrum documentation for descriptions of each of the features.

#   SPCM_FEAT_MULTI = <CardFeature.SPCM_FEAT_MULTI: 1>
#   SPCM_FEAT_GATE = <CardFeature.SPCM_FEAT_GATE: 2>
#   SPCM_FEAT_DIGITAL = <CardFeature.SPCM_FEAT_DIGITAL: 4>
#   SPCM_FEAT_TIMESTAMP = <CardFeature.SPCM_FEAT_TIMESTAMP: 8>
#   SPCM_FEAT_STARHUB_4_5_6EXTM_8EXTM = <CardFeature.SPCM_FEAT_STARHUB_4_5_6EXTM_8EXTM: 32>
#   SPCM_FEAT_STARHUB_8_16_16EXTM = <CardFeature.SPCM_FEAT_STARHUB_8_16_16EXTM: 64>
#   SPCM_FEAT_ABA = <CardFeature.SPCM_FEAT_ABA: 128>
#   SPCM_FEAT_BASEXIO = <CardFeature.SPCM_FEAT_BASEXIO: 256>
#   SPCM_FEAT_AMPLIFIER_10V = <CardFeature.SPCM_FEAT_AMPLIFIER_10V: 512>
#   SPCM_FEAT_STARHUBSYSMASTER = <CardFeature.SPCM_FEAT_STARHUBSYSMASTER: 1024>
#   SPCM_FEAT_DIFFMODE = <CardFeature.SPCM_FEAT_DIFFMODE: 2048>
#   SPCM_FEAT_SEQUENCE = <CardFeature.SPCM_FEAT_SEQUENCE: 4096>
#   SPCM_FEAT_AMPMODULE_10V = <CardFeature.SPCM_FEAT_AMPMODULE_10V: 8192>
#   SPCM_FEAT_STARHUBSYSSLAVE = <CardFeature.SPCM_FEAT_STARHUBSYSSLAVE: 16384>
#   SPCM_FEAT_NETBOX = <CardFeature.SPCM_FEAT_NETBOX: 32768>
#   SPCM_FEAT_REMOTESERVER = <CardFeature.SPCM_FEAT_REMOTESERVER: 65536>
#   SPCM_FEAT_SCAPP = <CardFeature.SPCM_FEAT_SCAPP: 131072>
#   SPCM_FEAT_CUSTOMMOD_MASK = <CardFeature.SPCM_FEAT_CUSTOMMOD_MASK: 4026531840>
Inherited Members
enum.Enum
name
value
#   class AdvancedCardFeature(enum.Enum):
View Source
class AdvancedCardFeature(Enum):
    """Enum representing the possible advanced features of all Spectrum devices. A list of features can be read from a
    device using the feature_list property. See the Spectrum documentation for descriptions of each of the features.
    """

    SPCM_FEAT_EXTFW_SEGSTAT = SPCM_FEAT_EXTFW_SEGSTAT
    SPCM_FEAT_EXTFW_SEGAVERAGE = SPCM_FEAT_EXTFW_SEGAVERAGE
    SPCM_FEAT_EXTFW_BOXCAR = SPCM_FEAT_EXTFW_BOXCAR
    SPCM_FEAT_EXTFW_PULSEGEN = SPCM_FEAT_EXTFW_PULSEGEN

Enum representing the possible advanced features of all Spectrum devices. A list of features can be read from a device using the feature_list property. See the Spectrum documentation for descriptions of each of the features.

#   SPCM_FEAT_EXTFW_SEGSTAT = <AdvancedCardFeature.SPCM_FEAT_EXTFW_SEGSTAT: 1>
#   SPCM_FEAT_EXTFW_SEGAVERAGE = <AdvancedCardFeature.SPCM_FEAT_EXTFW_SEGAVERAGE: 2>
#   SPCM_FEAT_EXTFW_BOXCAR = <AdvancedCardFeature.SPCM_FEAT_EXTFW_BOXCAR: 4>
#   SPCM_FEAT_EXTFW_PULSEGEN = <AdvancedCardFeature.SPCM_FEAT_EXTFW_PULSEGEN: 8>
Inherited Members
enum.Enum
name
value
#   class IOLineMode(enum.Enum):
View Source
class IOLineMode(Enum):
    """Enum representing the possible modes that a devices multi-purpose I/O line can support. A list of available
    modes for each I/O line on a device is provided by the devices available_io_modes property. See the Spectrum
    documentation for a description of each of the modes."""

    SPCM_XMODE_DISABLE = SPCM_XMODE_DISABLE
    SPCM_XMODE_ASYNCIN = SPCM_XMODE_ASYNCIN
    SPCM_XMODE_ASYNCOUT = SPCM_XMODE_ASYNCOUT
    SPCM_XMODE_DIGIN = SPCM_XMODE_DIGIN
    SPCM_XMODE_TRIGIN = SPCM_XMODE_TRIGIN
    SPCM_XMODE_DIGOUT = SPCM_XMODE_DIGOUT
    SPCM_XMODE_TRIGOUT = SPCM_XMODE_TRIGOUT
    SPCM_XMODE_RUNSTATE = SPCM_XMODE_RUNSTATE
    SPCM_XMODE_ARMSTATE = SPCM_XMODE_ARMSTATE
    SPCM_XMODE_CONTOUTMARK = SPCM_XMODE_CONTOUTMARK
    SPCM_XMODE_PULSEGEN = SPCM_XMODE_PULSEGEN

Enum representing the possible modes that a devices multi-purpose I/O line can support. A list of available modes for each I/O line on a device is provided by the devices available_io_modes property. See the Spectrum documentation for a description of each of the modes.

#   SPCM_XMODE_DISABLE = <IOLineMode.SPCM_XMODE_DISABLE: 0>
#   SPCM_XMODE_ASYNCIN = <IOLineMode.SPCM_XMODE_ASYNCIN: 1>
#   SPCM_XMODE_ASYNCOUT = <IOLineMode.SPCM_XMODE_ASYNCOUT: 2>
#   SPCM_XMODE_DIGIN = <IOLineMode.SPCM_XMODE_DIGIN: 4>
#   SPCM_XMODE_TRIGIN = <IOLineMode.SPCM_XMODE_TRIGIN: 16>
#   SPCM_XMODE_DIGOUT = <IOLineMode.SPCM_XMODE_DIGOUT: 8>
#   SPCM_XMODE_TRIGOUT = <IOLineMode.SPCM_XMODE_TRIGOUT: 32>
#   SPCM_XMODE_RUNSTATE = <IOLineMode.SPCM_XMODE_RUNSTATE: 256>
#   SPCM_XMODE_ARMSTATE = <IOLineMode.SPCM_XMODE_ARMSTATE: 512>
#   SPCM_XMODE_CONTOUTMARK = <IOLineMode.SPCM_XMODE_CONTOUTMARK: 8192>
#   SPCM_XMODE_PULSEGEN = <IOLineMode.SPCM_XMODE_PULSEGEN: 524288>
Inherited Members
enum.Enum
name
value
#  
@dataclass
class AvailableIOModes:
View Source
@dataclass
class AvailableIOModes:
    """Stores a list of the available IOLineMode settings on each of the four I/O lines (X0, X1, X2 and X3) on a
    device. Returned by the available_io_modes() method of a device."""

    X0: List[IOLineMode]
    """IO modes available to the XO IO line."""
    X1: List[IOLineMode]
    """IO modes available to the X1 IO line."""
    X2: List[IOLineMode]
    """IO modes available to the X2 IO line."""
    X3: List[IOLineMode]
    """IO modes available to the X3 IO line."""

Stores a list of the available IOLineMode settings on each of the four I/O lines (X0, X1, X2 and X3) on a device. Returned by the available_io_modes() method of a device.

IO modes available to the XO IO line.

IO modes available to the X1 IO line.

IO modes available to the X2 IO line.

IO modes available to the X3 IO line.

#  
@dataclass
class TransferBuffer(abc.ABC):
View Source
@dataclass
class TransferBuffer(ABC):
    """A buffer for transferring samples between spectrumdevice software and a hardware device. See the 'Definition of the
    transfer buffer' section of the Spectrum documentation for more information. This implementation of the buffer
    sets the notify-size equal to the acquisition length."""

    type: BufferType
    """Specifies whether the buffer is to be used to transfer samples, timestamps or A/B data."""
    direction: BufferDirection
    """Specifies whether the buffer is to be used to transfer data from the card to the PC, or the PC to the card."""
    board_memory_offset_bytes: int
    """Sets the offset for transfer in board memory. Typically 0. See Spectrum documentation for more information."""
    data_array: ndarray
    """1D numpy array into which samples will be written during transfer."""
    notify_size_in_pages: float
    """The number of transferred pages (4096 bytes) after which a notification of transfer is sent from the device."""

    @abstractmethod
    def read_chunk(self, chunk_position_in_bytes: int, chunk_size_in_bytes: int) -> ndarray:
        raise NotImplementedError()

    @abstractmethod
    def copy_contents(self) -> ndarray:
        raise NotImplementedError()

    @property
    def data_array_pointer(self) -> c_void_p:
        """A pointer to the data array."""
        return self.data_array.ctypes.data_as(c_void_p)

    @property
    def data_array_length_in_bytes(self) -> int:
        """The length of the array into which sample will be written, in bytes."""
        return self.data_array.size * self.data_array.itemsize

    def __eq__(self, other: object) -> bool:
        if isinstance(other, TransferBuffer):
            return (
                (self.type == other.type)
                and (self.direction == other.direction)
                and (self.board_memory_offset_bytes == other.board_memory_offset_bytes)
                and (self.data_array == other.data_array).all()
            )
        else:
            raise NotImplementedError()

A buffer for transferring samples between spectrumdevice software and a hardware device. See the 'Definition of the transfer buffer' section of the Spectrum documentation for more information. This implementation of the buffer sets the notify-size equal to the acquisition length.

Specifies whether the buffer is to be used to transfer samples, timestamps or A/B data.

Specifies whether the buffer is to be used to transfer data from the card to the PC, or the PC to the card.

#   board_memory_offset_bytes: int

Sets the offset for transfer in board memory. Typically 0. See Spectrum documentation for more information.

#   data_array: numpy.ndarray

1D numpy array into which samples will be written during transfer.

#   notify_size_in_pages: float

The number of transferred pages (4096 bytes) after which a notification of transfer is sent from the device.

#  
@abstractmethod
def read_chunk( self, chunk_position_in_bytes: int, chunk_size_in_bytes: int ) -> numpy.ndarray:
View Source
    @abstractmethod
    def read_chunk(self, chunk_position_in_bytes: int, chunk_size_in_bytes: int) -> ndarray:
        raise NotImplementedError()
#  
@abstractmethod
def copy_contents(self) -> numpy.ndarray:
View Source
    @abstractmethod
    def copy_contents(self) -> ndarray:
        raise NotImplementedError()
#   data_array_pointer: ctypes.c_void_p

A pointer to the data array.

#   data_array_length_in_bytes: int

The length of the array into which sample will be written, in bytes.

#   class TriggerSource(enum.Enum):
View Source
class TriggerSource(Enum):
    """An Enum representing the possible trigger sources."""

    SPC_TMASK_SOFTWARE = SPC_TMASK_SOFTWARE
    """Enables the software trigger for the OR mask. The card will trigger immediately after start."""
    SPC_TMASK_EXT0 = SPC_TMASK_EXT0
    """Enables the external (analog) trigger 0 for the OR mask."""
    SPC_TMASK_EXT1 = SPC_TMASK_EXT1
    """Enables the X1 (logic) trigger for the OR mask."""
    SPC_TMASK_EXT2 = SPC_TMASK_EXT2
    """Enables the X2 (logic) trigger for the OR mask."""
    SPC_TMASK_EXT3 = SPC_TMASK_EXT3
    """Enables the X3 (logic) trigger for the OR mask."""
    SPC_TMASK_NONE = SPC_TMASK_NONE
    """No trigger source selected."""

An Enum representing the possible trigger sources.

#   SPC_TMASK_SOFTWARE = <TriggerSource.SPC_TMASK_SOFTWARE: 1>

Enables the software trigger for the OR mask. The card will trigger immediately after start.

#   SPC_TMASK_EXT0 = <TriggerSource.SPC_TMASK_EXT0: 2>

Enables the external (analog) trigger 0 for the OR mask.

#   SPC_TMASK_EXT1 = <TriggerSource.SPC_TMASK_EXT1: 4>

Enables the X1 (logic) trigger for the OR mask.

#   SPC_TMASK_EXT2 = <TriggerSource.SPC_TMASK_EXT2: 8>

Enables the X2 (logic) trigger for the OR mask.

#   SPC_TMASK_EXT3 = <TriggerSource.SPC_TMASK_EXT3: 16>

Enables the X3 (logic) trigger for the OR mask.

#   SPC_TMASK_NONE = <TriggerSource.SPC_TMASK_NONE: 0>

No trigger source selected.

Inherited Members
enum.Enum
name
value
#   class ExternalTriggerMode(enum.Enum):
View Source
class ExternalTriggerMode(Enum):
    """An Enum representing the supported trigger modes. See the Spectrum documentation more more Information.

    SPC_TM_NONE:
    SPC_TM_POS:
    SPC_TM_NEG:
    SPC_TM_BOTH:
    SPC_TM_HIGH:
    SPC_TM_LOW:
    SPC_TM_PW_GREATER:
    SPC_TM_PW_SMALLER:
    """

    SPC_TM_NONE = SPC_TM_NONE
    """Channel is not used for trigger detection."""
    SPC_TM_POS = SPC_TM_POS
    """Trigger detection for positive edges (crossing level 0 from below to above)."""
    SPC_TM_NEG = SPC_TM_NEG
    """Trigger detection for negative edges (crossing level 0 from above to below)."""
    SPC_TM_BOTH = SPC_TM_BOTH
    """Trigger detection for positive and negative edges (any crossing of level 0)."""
    SPC_TM_HIGH = SPC_TM_HIGH
    """Trigger detection for HIGH levels (signal above level 0)."""
    SPC_TM_LOW = SPC_TM_LOW
    """Trigger detection for LOW levels (signal below level 0)."""
    SPC_TM_PW_GREATER = SPC_TM_PW_GREATER
    """Sets the trigger mode for external trigger to detect pulses that are longer than the pulse width
    chosen using the devices set_external_trigger_pulse_width_in_samples() method. Can only be used in combination
    with one of the above modes."""
    SPC_TM_PW_SMALLER = SPC_TM_PW_SMALLER
    """Sets the trigger mode for external trigger to detect pulses that are shorter than the pulse width
    chosen using the devices set_external_trigger_pulse_width_in_samples() method. Can only be used in combination
    with one of the above modes."""

An Enum representing the supported trigger modes. See the Spectrum documentation more more Information.

SPC_TM_NONE: SPC_TM_POS: SPC_TM_NEG: SPC_TM_BOTH: SPC_TM_HIGH: SPC_TM_LOW: SPC_TM_PW_GREATER: SPC_TM_PW_SMALLER:

Channel is not used for trigger detection.

Trigger detection for positive edges (crossing level 0 from below to above).

Trigger detection for negative edges (crossing level 0 from above to below).

Trigger detection for positive and negative edges (any crossing of level 0).

Trigger detection for HIGH levels (signal above level 0).

Trigger detection for LOW levels (signal below level 0).

#   SPC_TM_PW_GREATER = <ExternalTriggerMode.SPC_TM_PW_GREATER: 67108864>

Sets the trigger mode for external trigger to detect pulses that are longer than the pulse width chosen using the devices set_external_trigger_pulse_width_in_samples() method. Can only be used in combination with one of the above modes.

#   SPC_TM_PW_SMALLER = <ExternalTriggerMode.SPC_TM_PW_SMALLER: 33554432>

Sets the trigger mode for external trigger to detect pulses that are shorter than the pulse width chosen using the devices set_external_trigger_pulse_width_in_samples() method. Can only be used in combination with one of the above modes.

Inherited Members
enum.Enum
name
value
#   CARD_STATUS_TYPE = typing.List[spectrumdevice.settings.status.StatusCode]
#   DEVICE_STATUS_TYPE = typing.List[typing.List[spectrumdevice.settings.status.StatusCode]]
#   class StatusCode(enum.Enum):
View Source
class StatusCode(Enum):
    """An Enum representing the possible status codes that can be returned by a SpectrumDigitiserCard. See the Spectrum
    documentation for a description of each status."""

    M2STAT_NONE = M2STAT_NONE
    M2STAT_CARD_PRETRIGGER = M2STAT_CARD_PRETRIGGER
    M2STAT_CARD_TRIGGER = M2STAT_CARD_TRIGGER
    M2STAT_CARD_READY = M2STAT_CARD_READY
    M2STAT_CARD_SEGMENT_PRETRG = M2STAT_CARD_SEGMENT_PRETRG
    M2STAT_DATA_BLOCKREADY = M2STAT_DATA_BLOCKREADY
    M2STAT_DATA_END = M2STAT_DATA_END
    M2STAT_DATA_OVERRUN = M2STAT_DATA_OVERRUN
    M2STAT_DATA_ERROR = M2STAT_DATA_ERROR
    M2STAT_EXTRA_BLOCKREADY = M2STAT_EXTRA_BLOCKREADY
    M2STAT_EXTRA_END = M2STAT_EXTRA_END
    M2STAT_EXTRA_OVERRUN = M2STAT_EXTRA_OVERRUN
    M2STAT_EXTRA_ERROR = M2STAT_EXTRA_ERROR

An Enum representing the possible status codes that can be returned by a SpectrumDigitiserCard. See the Spectrum documentation for a description of each status.

#   M2STAT_NONE = <StatusCode.M2STAT_NONE: 0>
#   M2STAT_CARD_PRETRIGGER = <StatusCode.M2STAT_CARD_PRETRIGGER: 1>
#   M2STAT_CARD_TRIGGER = <StatusCode.M2STAT_CARD_TRIGGER: 2>
#   M2STAT_CARD_READY = <StatusCode.M2STAT_CARD_READY: 4>
#   M2STAT_CARD_SEGMENT_PRETRG = <StatusCode.M2STAT_CARD_SEGMENT_PRETRG: 8>
#   M2STAT_DATA_BLOCKREADY = <StatusCode.M2STAT_DATA_BLOCKREADY: 256>
#   M2STAT_DATA_END = <StatusCode.M2STAT_DATA_END: 512>
#   M2STAT_DATA_OVERRUN = <StatusCode.M2STAT_DATA_OVERRUN: 1024>
#   M2STAT_DATA_ERROR = <StatusCode.M2STAT_DATA_ERROR: 2048>
#   M2STAT_EXTRA_BLOCKREADY = <StatusCode.M2STAT_EXTRA_BLOCKREADY: 4096>
#   M2STAT_EXTRA_END = <StatusCode.M2STAT_EXTRA_END: 8192>
#   M2STAT_EXTRA_OVERRUN = <StatusCode.M2STAT_EXTRA_OVERRUN: 16384>
#   M2STAT_EXTRA_ERROR = <StatusCode.M2STAT_EXTRA_ERROR: 32768>
Inherited Members
enum.Enum
name
value
#   class SpectrumRegisterLength(enum.Enum):
View Source
class SpectrumRegisterLength(Enum):
    """Enum defining the possible lengths of a spectrum register."""

    THIRTY_TWO = 0
    """32 bit register"""
    SIXTY_FOUR = 1
    """64 bit register"""

    def __repr__(self) -> str:
        return self.name

Enum defining the possible lengths of a spectrum register.

#   THIRTY_TWO = THIRTY_TWO

32 bit register

#   SIXTY_FOUR = SIXTY_FOUR

64 bit register

Inherited Members
enum.Enum
name
value
#   class ModelNumber(enum.Enum):
View Source
class ModelNumber(Enum):
    """An Enum representing the integer values returned by a device when its type identifier is queried by reading the
    SPC_PCITYP register. Only the supported card types are listed (Digitisers: 22xx, 44xx and 59xx family devices; AWGs:
     M2P 65xx devices)."""

    TYP_M4I2210_X8 = TYP_M4I2210_X8
    TYP_M4I2211_X8 = TYP_M4I2211_X8
    TYP_M4I2212_X8 = TYP_M4I2212_X8
    TYP_M4I2220_X8 = TYP_M4I2220_X8
    TYP_M4I2221_X8 = TYP_M4I2221_X8
    TYP_M4I2223_X8 = TYP_M4I2223_X8
    TYP_M4I2230_X8 = TYP_M4I2230_X8
    TYP_M4I2233_X8 = TYP_M4I2233_X8
    TYP_M4I2234_X8 = TYP_M4I2234_X8
    TYP_M4I2280_X8 = TYP_M4I2280_X8
    TYP_M4I2281_X8 = TYP_M4I2281_X8
    TYP_M4I2283_X8 = TYP_M4I2283_X8
    TYP_M4I2290_X8 = TYP_M4I2290_X8
    TYP_M4I2293_X8 = TYP_M4I2293_X8
    TYP_M4I2294_X8 = TYP_M4I2294_X8
    TYP_M4I4410_X8 = TYP_M4I4410_X8
    TYP_M4I4411_X8 = TYP_M4I4411_X8
    TYP_M4I4420_X8 = TYP_M4I4420_X8
    TYP_M4I4421_X8 = TYP_M4I4421_X8
    TYP_M4I4450_X8 = TYP_M4I4450_X8
    TYP_M4I4451_X8 = TYP_M4I4451_X8
    TYP_M4I4470_X8 = TYP_M4I4470_X8
    TYP_M4I4471_X8 = TYP_M4I4471_X8
    TYP_M4I4480_X8 = TYP_M4I4480_X8
    TYP_M4I4481_X8 = TYP_M4I4481_X8
    TYP_M4X44XX_X4 = TYP_M4X44XX_X4
    TYP_M4X4410_X4 = TYP_M4X4410_X4
    TYP_M4X4411_X4 = TYP_M4X4411_X4
    TYP_M4X4420_X4 = TYP_M4X4420_X4
    TYP_M4X4421_X4 = TYP_M4X4421_X4
    TYP_M4X4450_X4 = TYP_M4X4450_X4
    TYP_M4X4451_X4 = TYP_M4X4451_X4
    TYP_M4X4470_X4 = TYP_M4X4470_X4
    TYP_M4X4471_X4 = TYP_M4X4471_X4
    TYP_M4X4480_X4 = TYP_M4X4480_X4
    TYP_M4X4481_X4 = TYP_M4X4481_X4
    TYP_M2P5911_X4 = TYP_M2P5911_X4
    TYP_M2P5912_X4 = TYP_M2P5912_X4
    TYP_M2P5913_X4 = TYP_M2P5913_X4
    TYP_M2P5916_X4 = TYP_M2P5916_X4
    TYP_M2P5920_X4 = TYP_M2P5920_X4
    TYP_M2P5921_X4 = TYP_M2P5921_X4
    TYP_M2P5922_X4 = TYP_M2P5922_X4
    TYP_M2P5923_X4 = TYP_M2P5923_X4
    TYP_M2P5926_X4 = TYP_M2P5926_X4
    TYP_M2P5930_X4 = TYP_M2P5930_X4
    TYP_M2P5931_X4 = TYP_M2P5931_X4
    TYP_M2P5932_X4 = TYP_M2P5932_X4
    TYP_M2P5933_X4 = TYP_M2P5933_X4
    TYP_M2P5936_X4 = TYP_M2P5936_X4
    TYP_M2P5940_X4 = TYP_M2P5940_X4
    TYP_M2P5941_X4 = TYP_M2P5941_X4
    TYP_M2P5942_X4 = TYP_M2P5942_X4
    TYP_M2P5943_X4 = TYP_M2P5943_X4
    TYP_M2P5946_X4 = TYP_M2P5946_X4
    TYP_M2P5960_X4 = TYP_M2P5960_X4
    TYP_M2P5961_X4 = TYP_M2P5961_X4
    TYP_M2P5962_X4 = TYP_M2P5962_X4
    TYP_M2P5966_X4 = TYP_M2P5966_X4
    TYP_M2P5968_X4 = TYP_M2P5968_X4
    TYP_M2P6530_X4 = TYP_M2P6530_X4
    TYP_M2P6531_X4 = TYP_M2P6531_X4
    TYP_M2P6532_X4 = TYP_M2P6532_X4
    TYP_M2P6536_X4 = TYP_M2P6536_X4
    TYP_M2P6533_X4 = TYP_M2P6533_X4
    TYP_M2P6540_X4 = TYP_M2P6540_X4
    TYP_M2P6541_X4 = TYP_M2P6541_X4
    TYP_M2P6546_X4 = TYP_M2P6546_X4
    TYP_M2P6560_X4 = TYP_M2P6560_X4
    TYP_M2P6561_X4 = TYP_M2P6561_X4
    TYP_M2P6562_X4 = TYP_M2P6562_X4
    TYP_M2P6566_X4 = TYP_M2P6566_X4
    TYP_M2P6568_X4 = TYP_M2P6568_X4
    TYP_M2P6570_X4 = TYP_M2P6570_X4
    TYP_M2P6571_X4 = TYP_M2P6571_X4
    TYP_M2P6576_X4 = TYP_M2P6576_X4

An Enum representing the integer values returned by a device when its type identifier is queried by reading the SPC_PCITYP register. Only the supported card types are listed (Digitisers: 22xx, 44xx and 59xx family devices; AWGs: M2P 65xx devices).

#   TYP_M4I2210_X8 = <ModelNumber.TYP_M4I2210_X8: 467472>
#   TYP_M4I2211_X8 = <ModelNumber.TYP_M4I2211_X8: 467473>
#   TYP_M4I2212_X8 = <ModelNumber.TYP_M4I2212_X8: 467474>
#   TYP_M4I2220_X8 = <ModelNumber.TYP_M4I2220_X8: 467488>
#   TYP_M4I2221_X8 = <ModelNumber.TYP_M4I2221_X8: 467489>
#   TYP_M4I2223_X8 = <ModelNumber.TYP_M4I2223_X8: 467491>
#   TYP_M4I2230_X8 = <ModelNumber.TYP_M4I2230_X8: 467504>
#   TYP_M4I2233_X8 = <ModelNumber.TYP_M4I2233_X8: 467507>
#   TYP_M4I2234_X8 = <ModelNumber.TYP_M4I2234_X8: 467508>
#   TYP_M4I2280_X8 = <ModelNumber.TYP_M4I2280_X8: 467584>
#   TYP_M4I2281_X8 = <ModelNumber.TYP_M4I2281_X8: 467585>
#   TYP_M4I2283_X8 = <ModelNumber.TYP_M4I2283_X8: 467587>
#   TYP_M4I2290_X8 = <ModelNumber.TYP_M4I2290_X8: 467600>
#   TYP_M4I2293_X8 = <ModelNumber.TYP_M4I2293_X8: 467603>
#   TYP_M4I2294_X8 = <ModelNumber.TYP_M4I2294_X8: 467604>
#   TYP_M4I4410_X8 = <ModelNumber.TYP_M4I4410_X8: 476176>
#   TYP_M4I4411_X8 = <ModelNumber.TYP_M4I4411_X8: 476177>
#   TYP_M4I4420_X8 = <ModelNumber.TYP_M4I4420_X8: 476192>
#   TYP_M4I4421_X8 = <ModelNumber.TYP_M4I4421_X8: 476193>
#   TYP_M4I4450_X8 = <ModelNumber.TYP_M4I4450_X8: 476240>
#   TYP_M4I4451_X8 = <ModelNumber.TYP_M4I4451_X8: 476241>
#   TYP_M4I4470_X8 = <ModelNumber.TYP_M4I4470_X8: 476272>
#   TYP_M4I4471_X8 = <ModelNumber.TYP_M4I4471_X8: 476273>
#   TYP_M4I4480_X8 = <ModelNumber.TYP_M4I4480_X8: 476288>
#   TYP_M4I4481_X8 = <ModelNumber.TYP_M4I4481_X8: 476289>
#   TYP_M4X44XX_X4 = <ModelNumber.TYP_M4X44XX_X4: 541696>
#   TYP_M4X4410_X4 = <ModelNumber.TYP_M4X4410_X4: 541712>
#   TYP_M4X4411_X4 = <ModelNumber.TYP_M4X4411_X4: 541713>
#   TYP_M4X4420_X4 = <ModelNumber.TYP_M4X4420_X4: 541728>
#   TYP_M4X4421_X4 = <ModelNumber.TYP_M4X4421_X4: 541729>
#   TYP_M4X4450_X4 = <ModelNumber.TYP_M4X4450_X4: 541776>
#   TYP_M4X4451_X4 = <ModelNumber.TYP_M4X4451_X4: 541777>
#   TYP_M4X4470_X4 = <ModelNumber.TYP_M4X4470_X4: 541808>
#   TYP_M4X4471_X4 = <ModelNumber.TYP_M4X4471_X4: 541809>
#   TYP_M4X4480_X4 = <ModelNumber.TYP_M4X4480_X4: 541824>
#   TYP_M4X4481_X4 = <ModelNumber.TYP_M4X4481_X4: 541825>
#   TYP_M2P5911_X4 = <ModelNumber.TYP_M2P5911_X4: 612625>
#   TYP_M2P5912_X4 = <ModelNumber.TYP_M2P5912_X4: 612626>
#   TYP_M2P5913_X4 = <ModelNumber.TYP_M2P5913_X4: 612627>
#   TYP_M2P5916_X4 = <ModelNumber.TYP_M2P5916_X4: 612630>
#   TYP_M2P5920_X4 = <ModelNumber.TYP_M2P5920_X4: 612640>
#   TYP_M2P5921_X4 = <ModelNumber.TYP_M2P5921_X4: 612641>
#   TYP_M2P5922_X4 = <ModelNumber.TYP_M2P5922_X4: 612642>
#   TYP_M2P5923_X4 = <ModelNumber.TYP_M2P5923_X4: 612643>
#   TYP_M2P5926_X4 = <ModelNumber.TYP_M2P5926_X4: 612646>
#   TYP_M2P5930_X4 = <ModelNumber.TYP_M2P5930_X4: 612656>
#   TYP_M2P5931_X4 = <ModelNumber.TYP_M2P5931_X4: 612657>
#   TYP_M2P5932_X4 = <ModelNumber.TYP_M2P5932_X4: 612658>
#   TYP_M2P5933_X4 = <ModelNumber.TYP_M2P5933_X4: 612659>
#   TYP_M2P5936_X4 = <ModelNumber.TYP_M2P5936_X4: 612662>
#   TYP_M2P5940_X4 = <ModelNumber.TYP_M2P5940_X4: 612672>
#   TYP_M2P5941_X4 = <ModelNumber.TYP_M2P5941_X4: 612673>
#   TYP_M2P5942_X4 = <ModelNumber.TYP_M2P5942_X4: 612674>
#   TYP_M2P5943_X4 = <ModelNumber.TYP_M2P5943_X4: 612675>
#   TYP_M2P5946_X4 = <ModelNumber.TYP_M2P5946_X4: 612678>
#   TYP_M2P5960_X4 = <ModelNumber.TYP_M2P5960_X4: 612704>
#   TYP_M2P5961_X4 = <ModelNumber.TYP_M2P5961_X4: 612705>
#   TYP_M2P5962_X4 = <ModelNumber.TYP_M2P5962_X4: 612706>
#   TYP_M2P5966_X4 = <ModelNumber.TYP_M2P5966_X4: 612710>
#   TYP_M2P5968_X4 = <ModelNumber.TYP_M2P5968_X4: 612712>
#   TYP_M2P6530_X4 = <ModelNumber.TYP_M2P6530_X4: 615728>
#   TYP_M2P6531_X4 = <ModelNumber.TYP_M2P6531_X4: 615729>
#   TYP_M2P6532_X4 = <ModelNumber.TYP_M2P6532_X4: 615730>
#   TYP_M2P6536_X4 = <ModelNumber.TYP_M2P6536_X4: 615734>
#   TYP_M2P6533_X4 = <ModelNumber.TYP_M2P6533_X4: 615731>
#   TYP_M2P6540_X4 = <ModelNumber.TYP_M2P6540_X4: 615744>
#   TYP_M2P6541_X4 = <ModelNumber.TYP_M2P6541_X4: 615745>
#   TYP_M2P6546_X4 = <ModelNumber.TYP_M2P6546_X4: 615750>
#   TYP_M2P6560_X4 = <ModelNumber.TYP_M2P6560_X4: 615776>
#   TYP_M2P6561_X4 = <ModelNumber.TYP_M2P6561_X4: 615777>
#   TYP_M2P6562_X4 = <ModelNumber.TYP_M2P6562_X4: 615778>
#   TYP_M2P6566_X4 = <ModelNumber.TYP_M2P6566_X4: 615782>
#   TYP_M2P6568_X4 = <ModelNumber.TYP_M2P6568_X4: 615784>
#   TYP_M2P6570_X4 = <ModelNumber.TYP_M2P6570_X4: 615792>
#   TYP_M2P6571_X4 = <ModelNumber.TYP_M2P6571_X4: 615793>
#   TYP_M2P6576_X4 = <ModelNumber.TYP_M2P6576_X4: 615798>
Inherited Members
enum.Enum
name
value
#  
@dataclass
class GenerationSettings:
View Source
@dataclass
class GenerationSettings:
    """A dataclass collecting all settings required to configure signal generation. See Spectrum documentation."""

    generation_mode: GenerationMode
    """SPC_REP_STD_SINGLE , SPC_REP_STD_SINGLERESTART"""
    waveform: NDArray[int16]
    """The waveform to generate."""
    sample_rate_in_hz: int
    """Generation rate in samples per second."""
    num_loops: int
    """In SPC_REP_STD_SINGLE mode: the number of times to repeat the waveform after a trigger is received. In
     SPC_REP_STD_SINGLERESTART: The number of times to wait for a trigger and generate waveform once."""
    enabled_channels: list[int]
    """List of analog channel indices to enable for signal generation"""
    signal_amplitudes_in_mv: list[int]
    """The amplitude of each enabled channel."""
    dc_offsets_in_mv: list[int]
    """The dc offset of each enabled channel."""
    output_filters: list[OutputChannelFilter]
    """The output filter setting for each enabled channel."""
    stop_level_modes: list[OutputChannelStopLevelMode]
    """The behavior of each enabled channel after the waveform ends."""
    custom_stop_levels: Optional[list[Optional[int]]] = None
    """The stop level each channel will use it stop level mode is set to custom."""

A dataclass collecting all settings required to configure signal generation. See Spectrum documentation.

#   GenerationSettings( generation_mode: spectrumdevice.settings.device_modes.GenerationMode, waveform: numpy.ndarray[typing.Any, numpy.dtype[numpy.int16]], sample_rate_in_hz: int, num_loops: int, enabled_channels: list[int], signal_amplitudes_in_mv: list[int], dc_offsets_in_mv: list[int], output_filters: list[spectrumdevice.settings.channel.OutputChannelFilter], stop_level_modes: list[spectrumdevice.settings.channel.OutputChannelStopLevelMode], custom_stop_levels: Optional[list[Optional[int]]] = None )

SPC_REP_STD_SINGLE , SPC_REP_STD_SINGLERESTART

#   waveform: numpy.ndarray[typing.Any, numpy.dtype[numpy.int16]]

The waveform to generate.

#   sample_rate_in_hz: int

Generation rate in samples per second.

#   num_loops: int

In SPC_REP_STD_SINGLE mode: the number of times to repeat the waveform after a trigger is received. In SPC_REP_STD_SINGLERESTART: The number of times to wait for a trigger and generate waveform once.

#   enabled_channels: list[int]

List of analog channel indices to enable for signal generation

#   signal_amplitudes_in_mv: list[int]

The amplitude of each enabled channel.

#   dc_offsets_in_mv: list[int]

The dc offset of each enabled channel.

The output filter setting for each enabled channel.

The behavior of each enabled channel after the waveform ends.

#   custom_stop_levels: Optional[list[Optional[int]]] = None

The stop level each channel will use it stop level mode is set to custom.

#   class OutputChannelFilter(enum.Enum):
View Source
class OutputChannelFilter(Enum):
    LOW_PASS_70_MHZ = 0
    LOW_PASS_20_MHZ = 1
    LOW_PASS_5_MHZ = 2
    LOW_PASS_1_MHZ = 3

An enumeration.

Inherited Members
enum.Enum
name
value
#   class OutputChannelStopLevelMode(enum.Enum):
View Source
class OutputChannelStopLevelMode(Enum):
    """Behavior of output channel when output is stopped or playback completes."""

    SPCM_STOPLVL_ZERO = SPCM_STOPLVL_ZERO
    """ Output level will go to zero."""
    SPCM_STOPLVL_LOW = SPCM_STOPLVL_LOW
    """ Output level will go to minimum possible negative value."""
    SPCM_STOPLVL_HIGH = SPCM_STOPLVL_HIGH
    """ Output level will go to maximum possible positive value."""
    SPCM_STOPLVL_HOLDLAST = SPCM_STOPLVL_HOLDLAST
    """ Output level will stay at the level of the last played sample."""
    SPCM_STOPLVL_CUSTOM = SPCM_STOPLVL_CUSTOM
    """ Output level will go to the value defined using SpectrumAWGChannel.set_stop_level_custom_value()"""

Behavior of output channel when output is stopped or playback completes.

Output level will go to zero.

Output level will go to minimum possible negative value.

Output level will go to maximum possible positive value.

Output level will stay at the level of the last played sample.

Output level will go to the value defined using SpectrumAWGChannel.set_stop_level_custom_value()

Inherited Members
enum.Enum
name
value
#   class GenerationMode(enum.Enum):
View Source
class GenerationMode(Enum):
    """Enum representing the AWG generation modes currently supported by spectrumdevice. See Spectrum documentation for
    more information about each mode."""

    SPC_REP_STD_SINGLE = SPC_REP_STD_SINGLE
    """Data generation from on-board memory repeating the complete programmed memory either once, infinite or for a
    defined number of times after one single trigger event."""
    SPC_REP_STD_SINGLERESTART = SPC_REP_STD_SINGLERESTART
    """Data generation from on-board memory. The programmed memory is repeated once after each single trigger event."""

Enum representing the AWG generation modes currently supported by spectrumdevice. See Spectrum documentation for more information about each mode.

#   SPC_REP_STD_SINGLE = <GenerationMode.SPC_REP_STD_SINGLE: 256>

Data generation from on-board memory repeating the complete programmed memory either once, infinite or for a defined number of times after one single trigger event.

#   SPC_REP_STD_SINGLERESTART = <GenerationMode.SPC_REP_STD_SINGLERESTART: 32768>

Data generation from on-board memory. The programmed memory is repeated once after each single trigger event.

Inherited Members
enum.Enum
name
value
#  
@dataclass
class PulseGeneratorTriggerSettings:
View Source
@dataclass
class PulseGeneratorTriggerSettings:
    trigger_mode: PulseGeneratorTriggerMode
    trigger_detection_mode: PulseGeneratorTriggerDetectionMode
    multiplexer_1_source: PulseGeneratorMultiplexer1TriggerSource
    multiplexer_1_output_inversion: bool
    multiplexer_2_source: PulseGeneratorMultiplexer2TriggerSource
    multiplexer_2_output_inversion: bool
#   class PulseGeneratorTriggerMode(enum.Enum):
View Source
class PulseGeneratorTriggerMode(Enum):
    SPCM_PULSEGEN_MODE_GATED = SPCM_PULSEGEN_MODE_GATED
    """Pulse generator will start if the trigger condition or “gate” is met and will stop, if either the gate becomes
    inactive or the defined number of LOOPS have been generated. Will reset its loop counter, when the gate becomes LOW.
    """
    SPCM_PULSEGEN_MODE_TRIGGERED = SPCM_PULSEGEN_MODE_TRIGGERED
    """The pulse generator will start if the trigger condition is met and will replay the defined number of loops
    before re-arm- ing itself and waiting for another trigger event. Changes in the trigger signal while replaying will
    be ignored."""
    SPCM_PULSEGEN_MODE_SINGLESHOT = SPCM_PULSEGEN_MODE_SINGLESHOT
    """The pulse generator will start if the trigger condition is met and will replay the defined number of loops once.
    """

An enumeration.

Pulse generator will start if the trigger condition or “gate” is met and will stop, if either the gate becomes inactive or the defined number of LOOPS have been generated. Will reset its loop counter, when the gate becomes LOW.

The pulse generator will start if the trigger condition is met and will replay the defined number of loops before re-arm- ing itself and waiting for another trigger event. Changes in the trigger signal while replaying will be ignored.

The pulse generator will start if the trigger condition is met and will replay the defined number of loops once.

Inherited Members
enum.Enum
name
value
#   class PulseGeneratorTriggerDetectionMode(enum.Enum):
View Source
class PulseGeneratorTriggerDetectionMode(Enum):
    RISING_EDGE = 0  # this value is not defined in reg as really its just "HIGH" mode on or off
    SPCM_PULSEGEN_CONFIG_HIGH = SPCM_PULSEGEN_CONFIG_HIGH

An enumeration.

Inherited Members
enum.Enum
name
value
#   class PulseGeneratorMultiplexer1TriggerSource(spectrumdevice.settings.pulse_generator.PulseGeneratorMultiplexerTriggerSource, enum.Enum):
View Source
class PulseGeneratorMultiplexer1TriggerSource(PulseGeneratorMultiplexerTriggerSource, Enum):
    SPCM_PULSEGEN_MUX1_SRC_UNUSED = SPCM_PULSEGEN_MUX1_SRC_UNUSED
    """Inputs of MUX1 are not used in creating the trigger condition and instead a static logic HIGH is used for MUX1.
    """
    SPCM_PULSEGEN_MUX1_SRC_RUN = SPCM_PULSEGEN_MUX1_SRC_RUN
    """This input of MUX1 reflects the current run state of the card. If acquisition/output is running the signal is
    HIGH. If card has stopped the signal is LOW. The signal is identical to XIO output using SPCM_XMODE_RUNSTATE."""
    SPCM_PULSEGEN_MUX1_SRC_ARM = SPCM_PULSEGEN_MUX1_SRC_ARM
    """This input of MUX1 reflects the current ARM state of the card. If the card is armed and ready to receive a
    trigger the signal is HIGH. If the card isn’t running or the card is still acquiring pretrigger data or the trigger
    has already been detected. the signal is LOW. The signal is identical to XIO output using SPCM_XMODE_ARMSTATE."""

An enumeration.

Inputs of MUX1 are not used in creating the trigger condition and instead a static logic HIGH is used for MUX1.

This input of MUX1 reflects the current run state of the card. If acquisition/output is running the signal is HIGH. If card has stopped the signal is LOW. The signal is identical to XIO output using SPCM_XMODE_RUNSTATE.

This input of MUX1 reflects the current ARM state of the card. If the card is armed and ready to receive a trigger the signal is HIGH. If the card isn’t running or the card is still acquiring pretrigger data or the trigger has already been detected. the signal is LOW. The signal is identical to XIO output using SPCM_XMODE_ARMSTATE.

Inherited Members
enum.Enum
name
value
#   class PulseGeneratorMultiplexer2TriggerSource(spectrumdevice.settings.pulse_generator.PulseGeneratorMultiplexerTriggerSource, enum.Enum):
View Source
class PulseGeneratorMultiplexer2TriggerSource(PulseGeneratorMultiplexerTriggerSource, Enum):
    SPCM_PULSEGEN_MUX2_SRC_UNUSED = SPCM_PULSEGEN_MUX2_SRC_UNUSED
    SPCM_PULSEGEN_MUX2_SRC_SOFTWARE = SPCM_PULSEGEN_MUX2_SRC_SOFTWARE
    SPCM_PULSEGEN_MUX2_SRC_PULSEGEN0 = SPCM_PULSEGEN_MUX2_SRC_PULSEGEN0
    SPCM_PULSEGEN_MUX2_SRC_PULSEGEN1 = SPCM_PULSEGEN_MUX2_SRC_PULSEGEN1
    SPCM_PULSEGEN_MUX2_SRC_PULSEGEN2 = SPCM_PULSEGEN_MUX2_SRC_PULSEGEN2
    SPCM_PULSEGEN_MUX2_SRC_PULSEGEN3 = SPCM_PULSEGEN_MUX2_SRC_PULSEGEN3
    SPCM_PULSEGEN_MUX2_SRC_XIO0 = SPCM_PULSEGEN_MUX2_SRC_XIO0
    SPCM_PULSEGEN_MUX2_SRC_XIO1 = SPCM_PULSEGEN_MUX2_SRC_XIO1
    SPCM_PULSEGEN_MUX2_SRC_XIO2 = SPCM_PULSEGEN_MUX2_SRC_XIO2
    SPCM_PULSEGEN_MUX2_SRC_XIO3 = SPCM_PULSEGEN_MUX2_SRC_XIO3

An enumeration.

Inherited Members
enum.Enum
name
value
#  
@dataclass
class PulseGeneratorOutputSettings:
View Source
@dataclass
class PulseGeneratorOutputSettings:
    period_in_seconds: float
    duty_cycle: float
    num_pulses: int
    delay_in_seconds: float
    output_inversion: bool

PulseGeneratorOutputSettings(period_in_seconds: float, duty_cycle: float, num_pulses: int, delay_in_seconds: float, output_inversion: bool)

#   PulseGeneratorOutputSettings( period_in_seconds: float, duty_cycle: float, num_pulses: int, delay_in_seconds: float, output_inversion: bool )