devctrl.devices.oscilloscope.impl.gage_compuscope.Acquisition#

class Acquisition(Mode: str | int | None = None, SampleRate: int | None = None, Depth: int = 4096, SegmentSize: int | None = None, TriggerDelay: int = 0, SegmentCount: int = 1, TriggerTimeOut: int = -1, TriggerHoldOff: int = 0, ExtClk: int = 0, TimeStampMode: str | None = None, TimeStampClock: str | None = None)[source]#

Bases: SettingsClass

Methods

as_dict

Convenience wrapper for dataclasses.asdict(self)

copy

Convenience method for copy.deepcopy(self)

fields

Return a tuple describing the fields of this dataclass.

from_dict

Recursively construct a SettingsClass from a dictionary.

get_dict

Return the settings as a dictionary.

load_yaml

save_yaml

Attributes

Depth: int = 4096#
ExtClk: int = 0#
Mode: str | int | None = None#
SampleRate: int | None = None#
SegmentCount: int = 1#
SegmentSize: int | None = None#
TimeStampClock: str | None = None#
TimeStampMode: str | None = None#
TriggerDelay: int = 0#
TriggerHoldOff: int = 0#
TriggerTimeOut: int = -1#
__annotations__ = {'Depth': <class 'int'>, 'ExtClk': <class 'int'>, 'Mode': str | int | None, 'SampleRate': int | None, 'SegmentCount': <class 'int'>, 'SegmentSize': int | None, 'TimeStampClock': str | None, 'TimeStampMode': str | None, 'TriggerDelay': <class 'int'>, 'TriggerHoldOff': <class 'int'>, 'TriggerTimeOut': <class 'int'>}#
__dataclass_fields__ = {'Depth': Field(name='Depth',type=<class 'int'>,default=4096,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Post-trigger depth in samples.'}),kw_only=False,_field_type=_FIELD), 'ExtClk': Field(name='ExtClk',type=<class 'int'>,default=0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'External clocking: 1 = enabled, 0 = disabled (if hardware supports it).', 'valid': [0, 1]}),kw_only=False,_field_type=_FIELD), 'Mode': Field(name='Mode',type=str | int | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Channel mode. Numeric mode values may be ORed with special options, e.g. 0x400 enables reference clock input (0x402 = Dual + ref clock). Default is model-dependent.', 'valid': ['Single', 'Dual', 'Quad', 'Octal']}),kw_only=False,_field_type=_FIELD), 'SampleRate': Field(name='SampleRate',type=int | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Sample rate in Hz. Must equal the external clock frequency when ExtClk=1. Default is model-dependent; see hardware manual for valid rates.'}),kw_only=False,_field_type=_FIELD), 'SegmentCount': Field(name='SegmentCount',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Number of segments (records) in a Multiple Record acquisition. Must be 1 for single-record acquisitions.', 'valid': (1, None)}),kw_only=False,_field_type=_FIELD), 'SegmentSize': Field(name='SegmentSize',type=int | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Segment size in samples (pre-trigger + post-trigger samples).'}),kw_only=False,_field_type=_FIELD), 'TimeStampClock': Field(name='TimeStampClock',type=str | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Fixed = fixed on-board oscillator; Sample = sample clock divided by an integer.', 'valid': ['Fixed', 'Sample']}),kw_only=False,_field_type=_FIELD), 'TimeStampMode': Field(name='TimeStampMode',type=str | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Free = counter not reset at each acquisition start; Reset = counter reset at each acquisition start.', 'valid': ['Free', 'Reset']}),kw_only=False,_field_type=_FIELD), 'TriggerDelay': Field(name='TriggerDelay',type=<class 'int'>,default=0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Samples between the trigger event and logging of the trigger. Not supported on all models.'}),kw_only=False,_field_type=_FIELD), 'TriggerHoldOff': Field(name='TriggerHoldOff',type=<class 'int'>,default=0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Samples after capture start during which triggers are ignored; guarantees this many pre-trigger samples.'}),kw_only=False,_field_type=_FIELD), 'TriggerTimeOut': Field(name='TriggerTimeOut',type=<class 'int'>,default=-1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Time to wait before forcing a trigger, in 100 ns units (10000000 = 1 s). -1 waits indefinitely.'}),kw_only=False,_field_type=_FIELD)}#
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False,match_args=True,kw_only=False,slots=False,weakref_slot=False)#
__dict__ = mappingproxy({'__module__': 'devctrl.devices.oscilloscope.impl.gage_compuscope', '__firstlineno__': 52, '__annotations__': {'Mode': str | int | None, 'SampleRate': int | None, 'Depth': <class 'int'>, 'SegmentSize': int | None, 'TriggerDelay': <class 'int'>, 'SegmentCount': <class 'int'>, 'TriggerTimeOut': <class 'int'>, 'TriggerHoldOff': <class 'int'>, 'ExtClk': <class 'int'>, 'TimeStampMode': str | None, 'TimeStampClock': str | None}, 'Mode': None, 'SampleRate': None, 'Depth': 4096, 'SegmentSize': None, 'TriggerDelay': 0, 'SegmentCount': 1, 'TriggerTimeOut': -1, 'TriggerHoldOff': 0, 'ExtClk': 0, 'TimeStampMode': None, 'TimeStampClock': None, '__static_attributes__': (), '__doc__': 'Acquisition(Mode: str | int | None = None, SampleRate: int | None = None, Depth: int = 4096, SegmentSize: int | None = None, TriggerDelay: int = 0, SegmentCount: int = 1, TriggerTimeOut: int = -1, TriggerHoldOff: int = 0, ExtClk: int = 0, TimeStampMode: str | None = None, TimeStampClock: str | None = None)', '__dataclass_params__': _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False,match_args=True,kw_only=False,slots=False,weakref_slot=False), '__dataclass_fields__': {'Mode': Field(name='Mode',type=str | int | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Channel mode. Numeric mode values may be ORed with special options, e.g. 0x400 enables reference clock input (0x402 = Dual + ref clock). Default is model-dependent.', 'valid': ['Single', 'Dual', 'Quad', 'Octal']}),kw_only=False,_field_type=_FIELD), 'SampleRate': Field(name='SampleRate',type=int | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Sample rate in Hz. Must equal the external clock frequency when ExtClk=1. Default is model-dependent; see hardware manual for valid rates.'}),kw_only=False,_field_type=_FIELD), 'Depth': Field(name='Depth',type=<class 'int'>,default=4096,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Post-trigger depth in samples.'}),kw_only=False,_field_type=_FIELD), 'SegmentSize': Field(name='SegmentSize',type=int | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Segment size in samples (pre-trigger + post-trigger samples).'}),kw_only=False,_field_type=_FIELD), 'TriggerDelay': Field(name='TriggerDelay',type=<class 'int'>,default=0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Samples between the trigger event and logging of the trigger. Not supported on all models.'}),kw_only=False,_field_type=_FIELD), 'SegmentCount': Field(name='SegmentCount',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Number of segments (records) in a Multiple Record acquisition. Must be 1 for single-record acquisitions.', 'valid': (1, None)}),kw_only=False,_field_type=_FIELD), 'TriggerTimeOut': Field(name='TriggerTimeOut',type=<class 'int'>,default=-1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Time to wait before forcing a trigger, in 100 ns units (10000000 = 1 s). -1 waits indefinitely.'}),kw_only=False,_field_type=_FIELD), 'TriggerHoldOff': Field(name='TriggerHoldOff',type=<class 'int'>,default=0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Samples after capture start during which triggers are ignored; guarantees this many pre-trigger samples.'}),kw_only=False,_field_type=_FIELD), 'ExtClk': Field(name='ExtClk',type=<class 'int'>,default=0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'External clocking: 1 = enabled, 0 = disabled (if hardware supports it).', 'valid': [0, 1]}),kw_only=False,_field_type=_FIELD), 'TimeStampMode': Field(name='TimeStampMode',type=str | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Free = counter not reset at each acquisition start; Reset = counter reset at each acquisition start.', 'valid': ['Free', 'Reset']}),kw_only=False,_field_type=_FIELD), 'TimeStampClock': Field(name='TimeStampClock',type=str | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Fixed = fixed on-board oscillator; Sample = sample clock divided by an integer.', 'valid': ['Fixed', 'Sample']}),kw_only=False,_field_type=_FIELD)}, '__replace__': <function _replace>, '__hash__': None, '__init__': <function Acquisition.__init__>, '__repr__': <function Acquisition.__repr__>, '__eq__': <function Acquisition.__eq__>, '__match_args__': ('Mode', 'SampleRate', 'Depth', 'SegmentSize', 'TriggerDelay', 'SegmentCount', 'TriggerTimeOut', 'TriggerHoldOff', 'ExtClk', 'TimeStampMode', 'TimeStampClock')})#
__eq__(other)#

Return self==value.

__firstlineno__ = 52#
__hash__ = None#
__init__(Mode: str | int | None = None, SampleRate: int | None = None, Depth: int = 4096, SegmentSize: int | None = None, TriggerDelay: int = 0, SegmentCount: int = 1, TriggerTimeOut: int = -1, TriggerHoldOff: int = 0, ExtClk: int = 0, TimeStampMode: str | None = None, TimeStampClock: str | None = None) → None#
__match_args__ = ('Mode', 'SampleRate', 'Depth', 'SegmentSize', 'TriggerDelay', 'SegmentCount', 'TriggerTimeOut', 'TriggerHoldOff', 'ExtClk', 'TimeStampMode', 'TimeStampClock')#
__module__ = 'devctrl.devices.oscilloscope.impl.gage_compuscope'#
__or__(other)#

Merge with another settings class or a dictionary. Unknown keys in a dictionary are ignored.

__replace__(**changes)#
__repr__()#

Return repr(self).

__static_attributes__ = ()#
__weakref__#

list of weak references to the object

_get_dict(remove_empty_containers: bool = False, remove_None: bool = False, remove_if_None: list[str] | None = None) → dict#

Return the settings as a dictionary, optionally cleaning up the output.

Base implementation for get_dict(). Subclasses may call it with different arguments to configure the output.

Parameters:
  • remove_empty_containers – If True, remove empty dict, list, tuple or set values.

  • remove_None – If True, remove all keys with a None value.

  • remove_if_None – If given, remove these keys only if their value is None (absent keys are ignored).

Returns:

Instance converted to dictionary, see as_dict().

as_dict() → dict#

Convenience wrapper for dataclasses.asdict(self)

Returns all fields of the settings class. For a dictionary where certain fields may be skipped, see get_dict().

copy() → Self#

Convenience method for copy.deepcopy(self)

fields()#

Return a tuple describing the fields of this dataclass.

Adapted version of dataclass.fields that applies additional sorting of the fields according to the field’s metadata[“order”] parameter.

Accepts a dataclass or an instance of one. Tuple elements are of type Field.

classmethod from_dict(data: dict, strict: bool = False) → Self#

Recursively construct a SettingsClass from a dictionary.

If the value of a field is another SettingsClass, from_dict() will be called for that field as well. Handled are:

  • SettingsClass

  • list[SettingsClass]

  • dict[<any>, SettingsClass]

  • all of the above as Optional (Union with None)

  • a Union with any handled types

Parameters:

strict – If True, raise a KeyError on keys in data that are not field names of cls. Unknown keys are ignored otherwise.

Raises:
  • ValueError – If data contains a value that has the wrong type for the field of cls (ONLY if the type is a subclass of SettingsClass! Other types are not enforced)

  • KeyError – If strict is True and data contains a key that is not a field name of cls

get_dict() → dict#

Return the settings as a dictionary.

as_dict() returns the settings class with all fields, while get_dict() may be configured by subclasses to skip certain fields in the output. The default implementation returns all fields, like as_dict(). :return: Instance converted to dictionary.

classmethod load_yaml(yaml_path: str, loader=<class 'yaml.loader.Loader'>)#
save_yaml(yaml_path: str)#