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.

  1"""Provides Enums and Dataclasses wrapping the register values provided by the Spectrum API, to be used for configuring
  2hardware and interpreting responses received from hardware."""
  3
  4# Christian Baker, King's College London
  5# Copyright (c) 2024 School of Biomedical Engineering & Imaging Sciences, King's College London
  6# Licensed under the MIT. You may obtain a copy at https://opensource.org/licenses/MIT.
  7
  8from dataclasses import dataclass
  9from enum import Enum
 10from typing import List, Optional
 11
 12from numpy import int16
 13from numpy.typing import NDArray
 14
 15from spectrumdevice.settings.card_dependent_properties import ModelNumber
 16from spectrumdevice.settings.card_features import CardFeature, AdvancedCardFeature
 17from spectrumdevice.settings.channel import (
 18    InputImpedance,
 19    InputCoupling,
 20    InputPath,
 21    OutputChannelFilter,
 22    OutputChannelStopLevelMode,
 23)
 24from spectrumdevice.settings.device_modes import AcquisitionMode, ClockMode, GenerationMode
 25from spectrumdevice.settings.io_lines import IOLineMode, AvailableIOModes
 26from spectrumdevice.settings.transfer_buffer import (
 27    TransferBuffer,
 28)
 29from spectrumdevice.settings.triggering import TriggerSource, ExternalTriggerMode
 30from spectrumdevice.settings.status import CARD_STATUS_TYPE, DEVICE_STATUS_TYPE, StatusCode
 31from spectrumdevice.settings.pulse_generator import (
 32    PulseGeneratorTriggerSettings,
 33    PulseGeneratorTriggerMode,
 34    PulseGeneratorTriggerDetectionMode,
 35    PulseGeneratorMultiplexer1TriggerSource,
 36    PulseGeneratorMultiplexer2TriggerSource,
 37    PulseGeneratorOutputSettings,
 38)
 39
 40
 41__all__ = [
 42    "AcquisitionSettings",
 43    "TriggerSettings",
 44    "AcquisitionMode",
 45    "ClockMode",
 46    "CardFeature",
 47    "AdvancedCardFeature",
 48    "IOLineMode",
 49    "AvailableIOModes",
 50    "TransferBuffer",
 51    "TriggerSource",
 52    "ExternalTriggerMode",
 53    "CARD_STATUS_TYPE",
 54    "DEVICE_STATUS_TYPE",
 55    "StatusCode",
 56    "SpectrumRegisterLength",
 57    "ModelNumber",
 58    "GenerationSettings",
 59    "OutputChannelFilter",
 60    "OutputChannelStopLevelMode",
 61    "GenerationMode",
 62    "PulseGeneratorTriggerSettings",
 63    "PulseGeneratorTriggerMode",
 64    "PulseGeneratorTriggerDetectionMode",
 65    "PulseGeneratorMultiplexer1TriggerSource",
 66    "PulseGeneratorMultiplexer2TriggerSource",
 67    "PulseGeneratorOutputSettings",
 68]
 69
 70
 71@dataclass
 72class TriggerSettings:
 73    """A dataclass collecting all settings related to triggering generation and acquisition. See Spectrum documentation.
 74    Note that pulse generators have their own trigger options."""
 75
 76    trigger_sources: List[TriggerSource]
 77    """The trigger sources to enable"""
 78    external_trigger_mode: Optional[ExternalTriggerMode] = None
 79    """The external trigger mode (if an external trigger is enabled)."""
 80    external_trigger_level_in_mv: Optional[int] = None
 81    """The level an external signal must reach to cause a trigger event (if an external trigger is enabled)."""
 82    external_trigger_pulse_width_in_samples: Optional[int] = None
 83    """The required width of an external trigger pulse (if an external trigger is enabled)."""
 84
 85
 86@dataclass
 87class AcquisitionSettings:
 88    """A dataclass collecting all settings required to configure an acquisition. See Spectrum documentation."""
 89
 90    acquisition_mode: AcquisitionMode
 91    """Standard Single mode, Multi FIF mode or an averaging mode."""
 92    sample_rate_in_hz: int
 93    """Acquisition rate in samples per second."""
 94    acquisition_length_in_samples: int
 95    """The length of the recording in samples per channel."""
 96    pre_trigger_length_in_samples: int
 97    """The number of samples of the recording that will have been acquired before the trigger event."""
 98    timeout_in_ms: int
 99    """How long to wait for a trigger event before timing out."""
100    enabled_channels: List[int]
101    """The channel indices to enable for the acquisition."""
102    vertical_ranges_in_mv: List[int]
103    """The voltage range to apply to each enabled channel in mW."""
104    vertical_offsets_in_percent: List[int]
105    """The DC offset to apply to each enabled channel as percentages of their vertical ranges."""
106    input_impedances: List[InputImpedance]
107    """The input impedance settings to apply to each channel"""
108    timestamping_enabled: bool
109    """If True, Measurements will include the time at which the acquisition was triggered. Increases latency by ~10 ms.
110    """
111    batch_size: int = 1
112    """The number of acquisitions to transfer to the PC before the resulting waveforms are returned by
113      SpectrumDigitiserCard.get_waveforms()."""
114    number_of_averages: int = 1
115    """If an averaging AcquisitionMode is selected, this defines the number of averages."""
116    input_couplings: Optional[List[InputCoupling]] = None
117    """The coupling (AC or DC) to apply to each channel. Only available on some hardware, so default is None."""
118    input_paths: Optional[List[InputPath]] = None
119    """The input path (HF or Buffered) to apply to each channel. Only available on some hardware, so default is None."""
120
121
122@dataclass
123class GenerationSettings:
124    """A dataclass collecting all settings required to configure signal generation. See Spectrum documentation."""
125
126    generation_mode: GenerationMode
127    """SPC_REP_STD_SINGLE , SPC_REP_STD_SINGLERESTART"""
128    waveform: NDArray[int16]
129    """The waveform to generate."""
130    sample_rate_in_hz: int
131    """Generation rate in samples per second."""
132    num_loops: int
133    """In SPC_REP_STD_SINGLE mode: the number of times to repeat the waveform after a trigger is received. In
134     SPC_REP_STD_SINGLERESTART: The number of times to wait for a trigger and generate waveform once."""
135    enabled_channels: list[int]
136    """List of analog channel indices to enable for signal generation"""
137    signal_amplitudes_in_mv: list[int]
138    """The amplitude of each enabled channel."""
139    dc_offsets_in_mv: list[int]
140    """The dc offset of each enabled channel."""
141    output_filters: list[OutputChannelFilter]
142    """The output filter setting for each enabled channel."""
143    stop_level_modes: list[OutputChannelStopLevelMode]
144    """The behavior of each enabled channel after the waveform ends."""
145    custom_stop_levels: Optional[list[Optional[int]]] = None
146    """The stop level each channel will use it stop level mode is set to custom."""
147
148
149class SpectrumRegisterLength(Enum):
150    """Enum defining the possible lengths of a spectrum register."""
151
152    THIRTY_TWO = 0
153    """32 bit register"""
154    SIXTY_FOUR = 1
155    """64 bit register"""
156
157    def __repr__(self) -> str:
158        return self.name
@dataclass
class AcquisitionSettings:
 87@dataclass
 88class AcquisitionSettings:
 89    """A dataclass collecting all settings required to configure an acquisition. See Spectrum documentation."""
 90
 91    acquisition_mode: AcquisitionMode
 92    """Standard Single mode, Multi FIF mode or an averaging mode."""
 93    sample_rate_in_hz: int
 94    """Acquisition rate in samples per second."""
 95    acquisition_length_in_samples: int
 96    """The length of the recording in samples per channel."""
 97    pre_trigger_length_in_samples: int
 98    """The number of samples of the recording that will have been acquired before the trigger event."""
 99    timeout_in_ms: int
100    """How long to wait for a trigger event before timing out."""
101    enabled_channels: List[int]
102    """The channel indices to enable for the acquisition."""
103    vertical_ranges_in_mv: List[int]
104    """The voltage range to apply to each enabled channel in mW."""
105    vertical_offsets_in_percent: List[int]
106    """The DC offset to apply to each enabled channel as percentages of their vertical ranges."""
107    input_impedances: List[InputImpedance]
108    """The input impedance settings to apply to each channel"""
109    timestamping_enabled: bool
110    """If True, Measurements will include the time at which the acquisition was triggered. Increases latency by ~10 ms.
111    """
112    batch_size: int = 1
113    """The number of acquisitions to transfer to the PC before the resulting waveforms are returned by
114      SpectrumDigitiserCard.get_waveforms()."""
115    number_of_averages: int = 1
116    """If an averaging AcquisitionMode is selected, this defines the number of averages."""
117    input_couplings: Optional[List[InputCoupling]] = None
118    """The coupling (AC or DC) to apply to each channel. Only available on some hardware, so default is None."""
119    input_paths: Optional[List[InputPath]] = None
120    """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: 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)
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[spectrumdevice.settings.channel.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[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:
72@dataclass
73class TriggerSettings:
74    """A dataclass collecting all settings related to triggering generation and acquisition. See Spectrum documentation.
75    Note that pulse generators have their own trigger options."""
76
77    trigger_sources: List[TriggerSource]
78    """The trigger sources to enable"""
79    external_trigger_mode: Optional[ExternalTriggerMode] = None
80    """The external trigger mode (if an external trigger is enabled)."""
81    external_trigger_level_in_mv: Optional[int] = None
82    """The level an external signal must reach to cause a trigger event (if an external trigger is enabled)."""
83    external_trigger_pulse_width_in_samples: Optional[int] = None
84    """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[TriggerSource], external_trigger_mode: Optional[ExternalTriggerMode] = None, external_trigger_level_in_mv: Optional[int] = None, external_trigger_pulse_width_in_samples: Optional[int] = None)
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).

class AcquisitionMode(enum.Enum):
23class AcquisitionMode(Enum):
24    """Enum representing the digitise acquisition modes currently support by spectrumdevice. See Spectrum documentation
25    for more information about each mode."""
26
27    SPC_REC_STD_SINGLE = SPC_REC_STD_SINGLE
28    """Data acquisition to on-board memory for one single trigger event."""
29    SPC_REC_FIFO_MULTI = SPC_REC_FIFO_MULTI
30    """Continuous data acquisition for multiple trigger events."""
31    SPC_REC_STD_AVERAGE = SPC_REC_STD_AVERAGE
32    """Data acquisition to on-board memory for the average of multiple trigger events."""
33    SPC_REC_FIFO_AVERAGE = SPC_REC_FIFO_AVERAGE
34    """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):
48class ClockMode(Enum):
49    """Enum representing the clock modes currently supported by spectrumdevice. See Spectrum documentation for more
50    information about each mode."""
51
52    SPC_CM_INTPLL = SPC_CM_INTPLL
53    """Enables internal PLL with 20 MHz internal reference for sample clock generation."""
54    SPC_CM_EXTERNAL = SPC_CM_EXTERNAL
55    """Enables external clock input for direct sample clock generation."""
56    SPC_CM_EXTREFCLOCK = SPC_CM_EXTREFCLOCK
57    """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):
46class CardFeature(Enum):
47    """Enum representing the possible features of all Spectrum devices. A list of features can be read from a device
48    using the feature_list property. See the Spectrum documentation for descriptions of each of the features."""
49
50    SPCM_FEAT_MULTI = SPCM_FEAT_MULTI
51    SPCM_FEAT_GATE = SPCM_FEAT_GATE
52    SPCM_FEAT_DIGITAL = SPCM_FEAT_DIGITAL
53    SPCM_FEAT_TIMESTAMP = SPCM_FEAT_TIMESTAMP
54    SPCM_FEAT_STARHUB_4_5_6EXTM_8EXTM = SPCM_FEAT_STARHUB_4_5_6EXTM_8EXTM
55    SPCM_FEAT_STARHUB_8_16_16EXTM = SPCM_FEAT_STARHUB_8_16_16EXTM
56    SPCM_FEAT_ABA = SPCM_FEAT_ABA
57    SPCM_FEAT_BASEXIO = SPCM_FEAT_BASEXIO
58    SPCM_FEAT_AMPLIFIER_10V = SPCM_FEAT_AMPLIFIER_10V
59    SPCM_FEAT_STARHUBSYSMASTER = SPCM_FEAT_STARHUBSYSMASTER
60    SPCM_FEAT_DIFFMODE = SPCM_FEAT_DIFFMODE
61    SPCM_FEAT_SEQUENCE = SPCM_FEAT_SEQUENCE
62    SPCM_FEAT_AMPMODULE_10V = SPCM_FEAT_AMPMODULE_10V
63    SPCM_FEAT_STARHUBSYSSLAVE = SPCM_FEAT_STARHUBSYSSLAVE
64    SPCM_FEAT_NETBOX = SPCM_FEAT_NETBOX
65    SPCM_FEAT_REMOTESERVER = SPCM_FEAT_REMOTESERVER
66    SPCM_FEAT_SCAPP = SPCM_FEAT_SCAPP
67    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):
77class AdvancedCardFeature(Enum):
78    """Enum representing the possible advanced features of all Spectrum devices. A list of features can be read from a
79    device using the feature_list property. See the Spectrum documentation for descriptions of each of the features.
80    """
81
82    SPCM_FEAT_EXTFW_SEGSTAT = SPCM_FEAT_EXTFW_SEGSTAT
83    SPCM_FEAT_EXTFW_SEGAVERAGE = SPCM_FEAT_EXTFW_SEGAVERAGE
84    SPCM_FEAT_EXTFW_BOXCAR = SPCM_FEAT_EXTFW_BOXCAR
85    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):
79class IOLineMode(Enum):
80    """Enum representing the possible modes that a devices multi-purpose I/O line can support. A list of available
81    modes for each I/O line on a device is provided by the devices available_io_modes property. See the Spectrum
82    documentation for a description of each of the modes."""
83
84    SPCM_XMODE_DISABLE = SPCM_XMODE_DISABLE
85    SPCM_XMODE_ASYNCIN = SPCM_XMODE_ASYNCIN
86    SPCM_XMODE_ASYNCOUT = SPCM_XMODE_ASYNCOUT
87    SPCM_XMODE_DIGIN = SPCM_XMODE_DIGIN
88    SPCM_XMODE_TRIGIN = SPCM_XMODE_TRIGIN
89    SPCM_XMODE_DIGOUT = SPCM_XMODE_DIGOUT
90    SPCM_XMODE_TRIGOUT = SPCM_XMODE_TRIGOUT
91    SPCM_XMODE_RUNSTATE = SPCM_XMODE_RUNSTATE
92    SPCM_XMODE_ARMSTATE = SPCM_XMODE_ARMSTATE
93    SPCM_XMODE_CONTOUTMARK = SPCM_XMODE_CONTOUTMARK
94    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:
165@dataclass
166class AvailableIOModes:
167    """Stores a list of the available IOLineMode settings on each of the four I/O lines (X0, X1, X2 and X3) on a
168    device. Returned by the available_io_modes() method of a device."""
169
170    X0: List[IOLineMode]
171    """IO modes available to the XO IO line."""
172    X1: List[IOLineMode]
173    """IO modes available to the X1 IO line."""
174    X2: List[IOLineMode]
175    """IO modes available to the X2 IO line."""
176    X3: List[IOLineMode]
177    """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.

AvailableIOModes( X0: List[IOLineMode], X1: List[IOLineMode], X2: List[IOLineMode], X3: List[IOLineMode])
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.

@dataclass
class TransferBuffer(abc.ABC):
 59@dataclass
 60class TransferBuffer(ABC):
 61    """A buffer for transferring samples between spectrumdevice software and a hardware device. See the 'Definition of the
 62    transfer buffer' section of the Spectrum documentation for more information. This implementation of the buffer
 63    sets the notify-size equal to the acquisition length."""
 64
 65    type: BufferType
 66    """Specifies whether the buffer is to be used to transfer samples, timestamps or A/B data."""
 67    direction: BufferDirection
 68    """Specifies whether the buffer is to be used to transfer data from the card to the PC, or the PC to the card."""
 69    board_memory_offset_bytes: int
 70    """Sets the offset for transfer in board memory. Typically 0. See Spectrum documentation for more information."""
 71    data_array: ndarray
 72    """1D numpy array into which samples will be written during transfer."""
 73    notify_size_in_pages: float
 74    """The number of transferred pages (4096 bytes) after which a notification of transfer is sent from the device."""
 75
 76    @abstractmethod
 77    def read_chunk(self, chunk_position_in_bytes: int, chunk_size_in_bytes: int) -> ndarray:
 78        raise NotImplementedError()
 79
 80    @abstractmethod
 81    def copy_contents(self) -> ndarray:
 82        raise NotImplementedError()
 83
 84    @property
 85    def data_array_pointer(self) -> c_void_p:
 86        """A pointer to the data array."""
 87        return self.data_array.ctypes.data_as(c_void_p)
 88
 89    @property
 90    def data_array_length_in_bytes(self) -> int:
 91        """The length of the array into which sample will be written, in bytes."""
 92        return self.data_array.size * self.data_array.itemsize
 93
 94    def __eq__(self, other: object) -> bool:
 95        if isinstance(other, TransferBuffer):
 96            return (
 97                (self.type == other.type)
 98                and (self.direction == other.direction)
 99                and (self.board_memory_offset_bytes == other.board_memory_offset_bytes)
100                and (self.data_array == other.data_array).all()
101            )
102        else:
103            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.

type: spectrumdevice.settings.transfer_buffer.BufferType

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

direction: spectrumdevice.settings.transfer_buffer.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: 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:
76    @abstractmethod
77    def read_chunk(self, chunk_position_in_bytes: int, chunk_size_in_bytes: int) -> ndarray:
78        raise NotImplementedError()
@abstractmethod
def copy_contents(self) -> numpy.ndarray:
80    @abstractmethod
81    def copy_contents(self) -> ndarray:
82        raise NotImplementedError()
data_array_pointer: ctypes.c_void_p
84    @property
85    def data_array_pointer(self) -> c_void_p:
86        """A pointer to the data array."""
87        return self.data_array.ctypes.data_as(c_void_p)

A pointer to the data array.

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

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

class TriggerSource(enum.Enum):
48class TriggerSource(Enum):
49    """An Enum representing the possible trigger sources."""
50
51    SPC_TMASK_SOFTWARE = SPC_TMASK_SOFTWARE
52    """Enables the software trigger for the OR mask. The card will trigger immediately after start."""
53    SPC_TMASK_EXT0 = SPC_TMASK_EXT0
54    """Enables the external (analog) trigger 0 for the OR mask."""
55    SPC_TMASK_EXT1 = SPC_TMASK_EXT1
56    """Enables the X1 (logic) trigger for the OR mask."""
57    SPC_TMASK_EXT2 = SPC_TMASK_EXT2
58    """Enables the X2 (logic) trigger for the OR mask."""
59    SPC_TMASK_EXT3 = SPC_TMASK_EXT3
60    """Enables the X3 (logic) trigger for the OR mask."""
61    SPC_TMASK0_CH0 = SPC_TMASK0_CH0
62    """Enables channel 0 for recognition within the channel OR mask"""
63    SPC_TMASK0_CH1 = SPC_TMASK0_CH1
64    """Enables channel 1 for recognition within the channel OR mask"""
65    SPC_TMASK0_CH2 = SPC_TMASK0_CH2
66    """Enables channel 2 for recognition within the channel OR mask"""
67    SPC_TMASK0_CH3 = SPC_TMASK0_CH3
68    """Enables channel 3 for recognition within the channel OR mask"""
69    SPC_TMASK0_CH4 = SPC_TMASK0_CH4
70    """Enables channel 4 for recognition within the channel OR mask"""
71    SPC_TMASK0_CH5 = SPC_TMASK0_CH5
72    """Enables channel 5 for recognition within the channel OR mask"""
73    SPC_TMASK0_CH6 = SPC_TMASK0_CH6
74    """Enables channel 6 for recognition within the channel OR mask"""
75    SPC_TMASK0_CH7 = SPC_TMASK0_CH7
76    """Enables channel 7 for recognition within the channel OR mask"""
77    SPC_TMASK_NONE = SPC_TMASK_NONE
78    """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_TMASK0_CH0 = <TriggerSource.SPC_TMASK_SOFTWARE: 1>

Enables channel 0 for recognition within the channel OR mask

SPC_TMASK0_CH1 = <TriggerSource.SPC_TMASK_EXT0: 2>

Enables channel 1 for recognition within the channel OR mask

SPC_TMASK0_CH2 = <TriggerSource.SPC_TMASK_EXT1: 4>

Enables channel 2 for recognition within the channel OR mask

SPC_TMASK0_CH3 = <TriggerSource.SPC_TMASK_EXT2: 8>

Enables channel 3 for recognition within the channel OR mask

SPC_TMASK0_CH4 = <TriggerSource.SPC_TMASK_EXT3: 16>

Enables channel 4 for recognition within the channel OR mask

SPC_TMASK0_CH5 = <TriggerSource.SPC_TMASK0_CH5: 32>

Enables channel 5 for recognition within the channel OR mask

SPC_TMASK0_CH6 = <TriggerSource.SPC_TMASK0_CH6: 64>

Enables channel 6 for recognition within the channel OR mask

SPC_TMASK0_CH7 = <TriggerSource.SPC_TMASK0_CH7: 128>

Enables channel 7 for recognition within the channel OR mask

SPC_TMASK_NONE = <TriggerSource.SPC_TMASK_NONE: 0>

No trigger source selected.

Inherited Members
enum.Enum
name
value
class ExternalTriggerMode(enum.Enum):
 89class ExternalTriggerMode(Enum):
 90    """An Enum representing the supported trigger modes. See the Spectrum documentation more Information.
 91
 92    SPC_TM_NONE:
 93    SPC_TM_POS:
 94    SPC_TM_NEG:
 95    SPC_TM_BOTH:
 96    SPC_TM_HIGH:
 97    SPC_TM_LOW:
 98    SPC_TM_PW_GREATER:
 99    SPC_TM_PW_SMALLER:
100    """
101
102    SPC_TM_NONE = SPC_TM_NONE
103    """Channel is not used for trigger detection."""
104    SPC_TM_POS = SPC_TM_POS
105    """Trigger detection for positive edges (crossing level 0 from below to above)."""
106    SPC_TM_NEG = SPC_TM_NEG
107    """Trigger detection for negative edges (crossing level 0 from above to below)."""
108    SPC_TM_BOTH = SPC_TM_BOTH
109    """Trigger detection for positive and negative edges (any crossing of level 0)."""
110    SPC_TM_HIGH = SPC_TM_HIGH
111    """Trigger detection for HIGH levels (signal above level 0)."""
112    SPC_TM_LOW = SPC_TM_LOW
113    """Trigger detection for LOW levels (signal below level 0)."""
114    SPC_TM_PW_GREATER = SPC_TM_PW_GREATER
115    """Sets the trigger mode for external trigger to detect pulses that are longer than the pulse width
116    chosen using the devices set_external_trigger_pulse_width_in_samples() method. Can only be used in combination
117    with one of the above modes."""
118    SPC_TM_PW_SMALLER = SPC_TM_PW_SMALLER
119    """Sets the trigger mode for external trigger to detect pulses that are shorter than the pulse width
120    chosen using the devices set_external_trigger_pulse_width_in_samples() method. Can only be used in combination
121    with one of the above modes."""

An Enum representing the supported trigger modes. See the Spectrum documentation 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 = <ExternalTriggerMode.SPC_TM_NONE: 0>

Channel is not used for trigger detection.

SPC_TM_POS = <ExternalTriggerMode.SPC_TM_POS: 1>

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

SPC_TM_NEG = <ExternalTriggerMode.SPC_TM_NEG: 2>

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

SPC_TM_BOTH = <ExternalTriggerMode.SPC_TM_BOTH: 4>

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

SPC_TM_HIGH = <ExternalTriggerMode.SPC_TM_HIGH: 8>

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

SPC_TM_LOW = <ExternalTriggerMode.SPC_TM_LOW: 16>

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[StatusCode]
DEVICE_STATUS_TYPE = typing.List[typing.List[StatusCode]]
class StatusCode(enum.Enum):
31class StatusCode(Enum):
32    """An Enum representing the possible status codes that can be returned by a SpectrumDigitiserCard. See the Spectrum
33    documentation for a description of each status."""
34
35    M2STAT_NONE = M2STAT_NONE
36    M2STAT_CARD_PRETRIGGER = M2STAT_CARD_PRETRIGGER
37    M2STAT_CARD_TRIGGER = M2STAT_CARD_TRIGGER
38    M2STAT_CARD_READY = M2STAT_CARD_READY
39    M2STAT_CARD_SEGMENT_PRETRG = M2STAT_CARD_SEGMENT_PRETRG
40    M2STAT_DATA_BLOCKREADY = M2STAT_DATA_BLOCKREADY
41    M2STAT_DATA_END = M2STAT_DATA_END
42    M2STAT_DATA_OVERRUN = M2STAT_DATA_OVERRUN
43    M2STAT_DATA_ERROR = M2STAT_DATA_ERROR
44    M2STAT_EXTRA_BLOCKREADY = M2STAT_EXTRA_BLOCKREADY
45    M2STAT_EXTRA_END = M2STAT_EXTRA_END
46    M2STAT_EXTRA_OVERRUN = M2STAT_EXTRA_OVERRUN
47    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):
150class SpectrumRegisterLength(Enum):
151    """Enum defining the possible lengths of a spectrum register."""
152
153    THIRTY_TWO = 0
154    """32 bit register"""
155    SIXTY_FOUR = 1
156    """64 bit register"""
157
158    def __repr__(self) -> str:
159        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):
111class ModelNumber(Enum):
112    """An Enum representing the integer values returned by a device when its type identifier is queried by reading the
113    SPC_PCITYP register. Only the supported card types are listed (Digitisers: 22xx, 44xx and 59xx family devices; AWGs:
114     M2P 65xx devices)."""
115
116    TYP_M4I2210_X8 = TYP_M4I2210_X8
117    TYP_M4I2211_X8 = TYP_M4I2211_X8
118    TYP_M4I2212_X8 = TYP_M4I2212_X8
119    TYP_M4I2220_X8 = TYP_M4I2220_X8
120    TYP_M4I2221_X8 = TYP_M4I2221_X8
121    TYP_M4I2223_X8 = TYP_M4I2223_X8
122    TYP_M4I2230_X8 = TYP_M4I2230_X8
123    TYP_M4I2233_X8 = TYP_M4I2233_X8
124    TYP_M4I2234_X8 = TYP_M4I2234_X8
125    TYP_M4I2280_X8 = TYP_M4I2280_X8
126    TYP_M4I2281_X8 = TYP_M4I2281_X8
127    TYP_M4I2283_X8 = TYP_M4I2283_X8
128    TYP_M4I2290_X8 = TYP_M4I2290_X8
129    TYP_M4I2293_X8 = TYP_M4I2293_X8
130    TYP_M4I2294_X8 = TYP_M4I2294_X8
131    TYP_M4I4410_X8 = TYP_M4I4410_X8
132    TYP_M4I4411_X8 = TYP_M4I4411_X8
133    TYP_M4I4420_X8 = TYP_M4I4420_X8
134    TYP_M4I4421_X8 = TYP_M4I4421_X8
135    TYP_M4I4450_X8 = TYP_M4I4450_X8
136    TYP_M4I4451_X8 = TYP_M4I4451_X8
137    TYP_M4I4470_X8 = TYP_M4I4470_X8
138    TYP_M4I4471_X8 = TYP_M4I4471_X8
139    TYP_M4I4480_X8 = TYP_M4I4480_X8
140    TYP_M4I4481_X8 = TYP_M4I4481_X8
141    TYP_M4X44XX_X4 = TYP_M4X44XX_X4
142    TYP_M4X4410_X4 = TYP_M4X4410_X4
143    TYP_M4X4411_X4 = TYP_M4X4411_X4
144    TYP_M4X4420_X4 = TYP_M4X4420_X4
145    TYP_M4X4421_X4 = TYP_M4X4421_X4
146    TYP_M4X4450_X4 = TYP_M4X4450_X4
147    TYP_M4X4451_X4 = TYP_M4X4451_X4
148    TYP_M4X4470_X4 = TYP_M4X4470_X4
149    TYP_M4X4471_X4 = TYP_M4X4471_X4
150    TYP_M4X4480_X4 = TYP_M4X4480_X4
151    TYP_M4X4481_X4 = TYP_M4X4481_X4
152    TYP_M2P5911_X4 = TYP_M2P5911_X4
153    TYP_M2P5912_X4 = TYP_M2P5912_X4
154    TYP_M2P5913_X4 = TYP_M2P5913_X4
155    TYP_M2P5916_X4 = TYP_M2P5916_X4
156    TYP_M2P5920_X4 = TYP_M2P5920_X4
157    TYP_M2P5921_X4 = TYP_M2P5921_X4
158    TYP_M2P5922_X4 = TYP_M2P5922_X4
159    TYP_M2P5923_X4 = TYP_M2P5923_X4
160    TYP_M2P5926_X4 = TYP_M2P5926_X4
161    TYP_M2P5930_X4 = TYP_M2P5930_X4
162    TYP_M2P5931_X4 = TYP_M2P5931_X4
163    TYP_M2P5932_X4 = TYP_M2P5932_X4
164    TYP_M2P5933_X4 = TYP_M2P5933_X4
165    TYP_M2P5936_X4 = TYP_M2P5936_X4
166    TYP_M2P5940_X4 = TYP_M2P5940_X4
167    TYP_M2P5941_X4 = TYP_M2P5941_X4
168    TYP_M2P5942_X4 = TYP_M2P5942_X4
169    TYP_M2P5943_X4 = TYP_M2P5943_X4
170    TYP_M2P5946_X4 = TYP_M2P5946_X4
171    TYP_M2P5960_X4 = TYP_M2P5960_X4
172    TYP_M2P5961_X4 = TYP_M2P5961_X4
173    TYP_M2P5962_X4 = TYP_M2P5962_X4
174    TYP_M2P5966_X4 = TYP_M2P5966_X4
175    TYP_M2P5968_X4 = TYP_M2P5968_X4
176    TYP_M2P6530_X4 = TYP_M2P6530_X4
177    TYP_M2P6531_X4 = TYP_M2P6531_X4
178    TYP_M2P6532_X4 = TYP_M2P6532_X4
179    TYP_M2P6536_X4 = TYP_M2P6536_X4
180    TYP_M2P6533_X4 = TYP_M2P6533_X4
181    TYP_M2P6540_X4 = TYP_M2P6540_X4
182    TYP_M2P6541_X4 = TYP_M2P6541_X4
183    TYP_M2P6546_X4 = TYP_M2P6546_X4
184    TYP_M2P6560_X4 = TYP_M2P6560_X4
185    TYP_M2P6561_X4 = TYP_M2P6561_X4
186    TYP_M2P6562_X4 = TYP_M2P6562_X4
187    TYP_M2P6566_X4 = TYP_M2P6566_X4
188    TYP_M2P6568_X4 = TYP_M2P6568_X4
189    TYP_M2P6570_X4 = TYP_M2P6570_X4
190    TYP_M2P6571_X4 = TYP_M2P6571_X4
191    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:
123@dataclass
124class GenerationSettings:
125    """A dataclass collecting all settings required to configure signal generation. See Spectrum documentation."""
126
127    generation_mode: GenerationMode
128    """SPC_REP_STD_SINGLE , SPC_REP_STD_SINGLERESTART"""
129    waveform: NDArray[int16]
130    """The waveform to generate."""
131    sample_rate_in_hz: int
132    """Generation rate in samples per second."""
133    num_loops: int
134    """In SPC_REP_STD_SINGLE mode: the number of times to repeat the waveform after a trigger is received. In
135     SPC_REP_STD_SINGLERESTART: The number of times to wait for a trigger and generate waveform once."""
136    enabled_channels: list[int]
137    """List of analog channel indices to enable for signal generation"""
138    signal_amplitudes_in_mv: list[int]
139    """The amplitude of each enabled channel."""
140    dc_offsets_in_mv: list[int]
141    """The dc offset of each enabled channel."""
142    output_filters: list[OutputChannelFilter]
143    """The output filter setting for each enabled channel."""
144    stop_level_modes: list[OutputChannelStopLevelMode]
145    """The behavior of each enabled channel after the waveform ends."""
146    custom_stop_levels: Optional[list[Optional[int]]] = None
147    """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: 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[OutputChannelFilter], stop_level_modes: list[OutputChannelStopLevelMode], custom_stop_levels: Optional[list[Optional[int]]] = None)
generation_mode: GenerationMode

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.

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 OutputChannelFilter(enum.Enum):
209class OutputChannelFilter(Enum):
210    LOW_PASS_70_MHZ = 0
211    LOW_PASS_20_MHZ = 1
212    LOW_PASS_5_MHZ = 2
213    LOW_PASS_1_MHZ = 3

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details.

LOW_PASS_70_MHZ = <OutputChannelFilter.LOW_PASS_70_MHZ: 0>
LOW_PASS_20_MHZ = <OutputChannelFilter.LOW_PASS_20_MHZ: 1>
LOW_PASS_5_MHZ = <OutputChannelFilter.LOW_PASS_5_MHZ: 2>
LOW_PASS_1_MHZ = <OutputChannelFilter.LOW_PASS_1_MHZ: 3>
Inherited Members
enum.Enum
name
value
class OutputChannelStopLevelMode(enum.Enum):
239class OutputChannelStopLevelMode(Enum):
240    """Behavior of output channel when output is stopped or playback completes."""
241
242    SPCM_STOPLVL_ZERO = SPCM_STOPLVL_ZERO
243    """ Output level will go to zero."""
244    SPCM_STOPLVL_LOW = SPCM_STOPLVL_LOW
245    """ Output level will go to minimum possible negative value."""
246    SPCM_STOPLVL_HIGH = SPCM_STOPLVL_HIGH
247    """ Output level will go to maximum possible positive value."""
248    SPCM_STOPLVL_HOLDLAST = SPCM_STOPLVL_HOLDLAST
249    """ Output level will stay at the level of the last played sample."""
250    SPCM_STOPLVL_CUSTOM = SPCM_STOPLVL_CUSTOM
251    """ 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):
37class GenerationMode(Enum):
38    """Enum representing the AWG generation modes currently supported by spectrumdevice. See Spectrum documentation for
39    more information about each mode."""
40
41    SPC_REP_STD_SINGLE = SPC_REP_STD_SINGLE
42    """Data generation from on-board memory repeating the complete programmed memory either once, infinite or for a
43    defined number of times after one single trigger event."""
44    SPC_REP_STD_SINGLERESTART = SPC_REP_STD_SINGLERESTART
45    """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:
144@dataclass
145class PulseGeneratorTriggerSettings:
146    trigger_mode: PulseGeneratorTriggerMode
147    trigger_detection_mode: PulseGeneratorTriggerDetectionMode
148    multiplexer_1_source: PulseGeneratorMultiplexer1TriggerSource
149    multiplexer_1_output_inversion: bool
150    multiplexer_2_source: PulseGeneratorMultiplexer2TriggerSource
151    multiplexer_2_output_inversion: bool
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)
trigger_detection_mode: PulseGeneratorTriggerDetectionMode
multiplexer_1_output_inversion: bool
multiplexer_2_output_inversion: bool
class PulseGeneratorTriggerMode(enum.Enum):
71class PulseGeneratorTriggerMode(Enum):
72    SPCM_PULSEGEN_MODE_GATED = SPCM_PULSEGEN_MODE_GATED
73    """Pulse generator will start if the trigger condition or “gate” is met and will stop, if either the gate becomes
74    inactive or the defined number of LOOPS have been generated. Will reset its loop counter, when the gate becomes LOW.
75    """
76    SPCM_PULSEGEN_MODE_TRIGGERED = SPCM_PULSEGEN_MODE_TRIGGERED
77    """The pulse generator will start if the trigger condition is met and will replay the defined number of loops
78    before re-arm- ing itself and waiting for another trigger event. Changes in the trigger signal while replaying will
79    be ignored."""
80    SPCM_PULSEGEN_MODE_SINGLESHOT = SPCM_PULSEGEN_MODE_SINGLESHOT
81    """The pulse generator will start if the trigger condition is met and will replay the defined number of loops once.
82    """

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details.

SPCM_PULSEGEN_MODE_GATED = <PulseGeneratorTriggerMode.SPCM_PULSEGEN_MODE_GATED: 1>

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 = <PulseGeneratorTriggerMode.SPCM_PULSEGEN_MODE_TRIGGERED: 2>

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 = <PulseGeneratorTriggerMode.SPCM_PULSEGEN_MODE_SINGLESHOT: 3>

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):
139class PulseGeneratorTriggerDetectionMode(Enum):
140    RISING_EDGE = 0  # this value is not defined in reg as really its just "HIGH" mode on or off
141    SPCM_PULSEGEN_CONFIG_HIGH = SPCM_PULSEGEN_CONFIG_HIGH

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details.

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

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details.

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):
118class PulseGeneratorMultiplexer2TriggerSource(PulseGeneratorMultiplexerTriggerSource, Enum):
119    SPCM_PULSEGEN_MUX2_SRC_UNUSED = SPCM_PULSEGEN_MUX2_SRC_UNUSED
120    SPCM_PULSEGEN_MUX2_SRC_SOFTWARE = SPCM_PULSEGEN_MUX2_SRC_SOFTWARE
121    SPCM_PULSEGEN_MUX2_SRC_PULSEGEN0 = SPCM_PULSEGEN_MUX2_SRC_PULSEGEN0
122    SPCM_PULSEGEN_MUX2_SRC_PULSEGEN1 = SPCM_PULSEGEN_MUX2_SRC_PULSEGEN1
123    SPCM_PULSEGEN_MUX2_SRC_PULSEGEN2 = SPCM_PULSEGEN_MUX2_SRC_PULSEGEN2
124    SPCM_PULSEGEN_MUX2_SRC_PULSEGEN3 = SPCM_PULSEGEN_MUX2_SRC_PULSEGEN3
125    SPCM_PULSEGEN_MUX2_SRC_XIO0 = SPCM_PULSEGEN_MUX2_SRC_XIO0
126    SPCM_PULSEGEN_MUX2_SRC_XIO1 = SPCM_PULSEGEN_MUX2_SRC_XIO1
127    SPCM_PULSEGEN_MUX2_SRC_XIO2 = SPCM_PULSEGEN_MUX2_SRC_XIO2
128    SPCM_PULSEGEN_MUX2_SRC_XIO3 = SPCM_PULSEGEN_MUX2_SRC_XIO3

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

    >>> Color.RED
    <Color.RED: 1>
    
  • value lookup:

    >>> Color(1)
    <Color.RED: 1>
    
  • name lookup:

    >>> Color['RED']
    <Color.RED: 1>
    

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details.

Inherited Members
enum.Enum
name
value
@dataclass
class PulseGeneratorOutputSettings:
206@dataclass
207class PulseGeneratorOutputSettings:
208    period_in_seconds: float
209    duty_cycle: float
210    num_pulses: int
211    delay_in_seconds: float
212    output_inversion: bool
PulseGeneratorOutputSettings( period_in_seconds: float, duty_cycle: float, num_pulses: int, delay_in_seconds: float, output_inversion: bool)
period_in_seconds: float
duty_cycle: float
num_pulses: int
delay_in_seconds: float
output_inversion: bool