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
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.
Standard Single mode, Multi FIF mode or an averaging mode.
Acquisition rate in samples per second.
The length of the recording in samples per channel.
The number of samples of the recording that will have been acquired before the trigger event.
How long to wait for a trigger event before timing out.
The channel indices to enable for the acquisition.
The voltage range to apply to each enabled channel in mW.
The DC offset to apply to each enabled channel as percentages of their vertical ranges.
The input impedance settings to apply to each channel
If True, Measurements will include the time at which the acquisition was triggered. Increases latency by ~10 ms.
The number of acquisitions to transfer to the PC before the resulting waveforms are returned by SpectrumDigitiserCard.get_waveforms().
If an averaging AcquisitionMode is selected, this defines the number of averages.
The coupling (AC or DC) to apply to each channel. Only available on some hardware, so default is None.
The input path (HF or Buffered) to apply to each channel. Only available on some hardware, so default is None.
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.
The trigger sources to enable
The external trigger mode (if an external trigger is enabled).
The level an external signal must reach to cause a trigger event (if an external trigger is enabled).
The required width of an external trigger pulse (if an external trigger is enabled).
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.
Data acquisition to on-board memory for one single trigger event.
Continuous data acquisition for multiple trigger events.
Data acquisition to on-board memory for the average of multiple trigger events.
Continuous data acquisition for multiple trigger events, with on-board averaging.
Inherited Members
- enum.Enum
- name
- value
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.
Enables internal PLL with 20 MHz internal reference for sample clock generation.
Enables external clock input for direct sample clock generation.
Enables internal PLL with external reference for sample clock generation.
Inherited Members
- enum.Enum
- name
- value
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.
Inherited Members
- enum.Enum
- name
- value
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.
Inherited Members
- enum.Enum
- name
- value
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.
Inherited Members
- enum.Enum
- name
- value
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.
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.
Sets the offset for transfer in board memory. Typically 0. See Spectrum documentation for more information.
1D numpy array into which samples will be written during transfer.
The number of transferred pages (4096 bytes) after which a notification of transfer is sent from the device.
View Source
@abstractmethod def read_chunk(self, chunk_position_in_bytes: int, chunk_size_in_bytes: int) -> ndarray: raise NotImplementedError()
View Source
@abstractmethod def copy_contents(self) -> ndarray: raise NotImplementedError()
A pointer to the data array.
The length of the array into which sample will be written, in bytes.
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.
Enables the software trigger for the OR mask. The card will trigger immediately after start.
Enables the external (analog) trigger 0 for the OR mask.
Enables the X1 (logic) trigger for the OR mask.
Enables the X2 (logic) trigger for the OR mask.
Enables the X3 (logic) trigger for the OR mask.
No trigger source selected.
Inherited Members
- enum.Enum
- name
- value
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).
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.
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
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.
Inherited Members
- enum.Enum
- name
- value
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.
32 bit register
64 bit register
Inherited Members
- enum.Enum
- name
- value
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).
Inherited Members
- enum.Enum
- name
- value
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.
SPC_REP_STD_SINGLE , SPC_REP_STD_SINGLERESTART
The waveform to generate.
Generation rate in samples per second.
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.
List of analog channel indices to enable for signal generation
The amplitude of each enabled channel.
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.
The stop level each channel will use it stop level mode is set to custom.
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
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
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.
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.
Data generation from on-board memory. The programmed memory is repeated once after each single trigger event.
Inherited Members
- enum.Enum
- name
- value
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
PulseGeneratorTriggerSettings(trigger_mode: spectrumdevice.settings.pulse_generator.PulseGeneratorTriggerMode, trigger_detection_mode: spectrumdevice.settings.pulse_generator.PulseGeneratorTriggerDetectionMode, multiplexer_1_source: spectrumdevice.settings.pulse_generator.PulseGeneratorMultiplexer1TriggerSource, multiplexer_1_output_inversion: bool, multiplexer_2_source: spectrumdevice.settings.pulse_generator.PulseGeneratorMultiplexer2TriggerSource, multiplexer_2_output_inversion: bool)
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
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
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
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
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)