devctrl.devices.oscilloscope.impl.gage_compuscope.Application#

class Application(StartPosition: int = 0, TransferLength: int = 4096, SegmentStart: int = 1, SegmentCount: int = 5, PageSize: int | None = None, SaveFileName: str | None = None, SaveFileFormat: str = 'TYPE_DEC')[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

PageSize: int | None = None#
SaveFileFormat: str = 'TYPE_DEC'#
SaveFileName: str | None = None#
SegmentCount: int = 5#
SegmentStart: int = 1#
StartPosition: int = 0#
TransferLength: int = 4096#
__annotations__ = {'PageSize': int | None, 'SaveFileFormat': <class 'str'>, 'SaveFileName': str | None, 'SegmentCount': <class 'int'>, 'SegmentStart': <class 'int'>, 'StartPosition': <class 'int'>, 'TransferLength': <class 'int'>}#
__dataclass_fields__ = {'PageSize': Field(name='PageSize',type=int | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Chunk size in samples for very large transfers (used only by some samples, e.g. GageDeepAcquisition).'}),kw_only=False,_field_type=_FIELD), 'SaveFileFormat': Field(name='SaveFileFormat',type=<class 'str'>,default='TYPE_DEC',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Single-column ASCII output: TYPE_FLOAT = voltages, TYPE_DEC = raw ADC decimal, TYPE_HEX = raw ADC hex (0x1234).', 'valid': ['TYPE_FLOAT', 'TYPE_DEC', 'TYPE_HEX']}),kw_only=False,_field_type=_FIELD), 'SaveFileName': Field(name='SaveFileName',type=str | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Base output file name. Channel number (and record number in Multiple Record mode) is appended, e.g. GAGE_FILE_1.DAT.'}),kw_only=False,_field_type=_FIELD), 'SegmentCount': Field(name='SegmentCount',type=<class 'int'>,default=5,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Number of segments (records) to transfer. Must not exceed the number acquired.', 'valid': (1, None)}),kw_only=False,_field_type=_FIELD), 'SegmentStart': Field(name='SegmentStart',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'First segment (record) to transfer after a Multiple Record acquisition (1-based). Ignored for single record.', 'valid': (1, None)}),kw_only=False,_field_type=_FIELD), 'StartPosition': Field(name='StartPosition',type=<class 'int'>,default=0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Transfer start address relative to the trigger (0 = trigger, negative = pre-trigger data). Caller must keep it within valid data.'}),kw_only=False,_field_type=_FIELD), 'TransferLength': Field(name='TransferLength',type=<class 'int'>,default=4096,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Number of samples to transfer from StartPosition. Caller must keep it within valid data.'}),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__': 89, '__annotations__': {'StartPosition': <class 'int'>, 'TransferLength': <class 'int'>, 'SegmentStart': <class 'int'>, 'SegmentCount': <class 'int'>, 'PageSize': int | None, 'SaveFileName': str | None, 'SaveFileFormat': <class 'str'>}, 'StartPosition': 0, 'TransferLength': 4096, 'SegmentStart': 1, 'SegmentCount': 5, 'PageSize': None, 'SaveFileName': None, 'SaveFileFormat': 'TYPE_DEC', '__static_attributes__': (), '__doc__': "Application(StartPosition: int = 0, TransferLength: int = 4096, SegmentStart: int = 1, SegmentCount: int = 5, PageSize: int | None = None, SaveFileName: str | None = None, SaveFileFormat: str = 'TYPE_DEC')", '__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__': {'StartPosition': Field(name='StartPosition',type=<class 'int'>,default=0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Transfer start address relative to the trigger (0 = trigger, negative = pre-trigger data). Caller must keep it within valid data.'}),kw_only=False,_field_type=_FIELD), 'TransferLength': Field(name='TransferLength',type=<class 'int'>,default=4096,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Number of samples to transfer from StartPosition. Caller must keep it within valid data.'}),kw_only=False,_field_type=_FIELD), 'SegmentStart': Field(name='SegmentStart',type=<class 'int'>,default=1,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'First segment (record) to transfer after a Multiple Record acquisition (1-based). Ignored for single record.', 'valid': (1, None)}),kw_only=False,_field_type=_FIELD), 'SegmentCount': Field(name='SegmentCount',type=<class 'int'>,default=5,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Number of segments (records) to transfer. Must not exceed the number acquired.', 'valid': (1, None)}),kw_only=False,_field_type=_FIELD), 'PageSize': Field(name='PageSize',type=int | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Chunk size in samples for very large transfers (used only by some samples, e.g. GageDeepAcquisition).'}),kw_only=False,_field_type=_FIELD), 'SaveFileName': Field(name='SaveFileName',type=str | None,default=None,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Base output file name. Channel number (and record number in Multiple Record mode) is appended, e.g. GAGE_FILE_1.DAT.'}),kw_only=False,_field_type=_FIELD), 'SaveFileFormat': Field(name='SaveFileFormat',type=<class 'str'>,default='TYPE_DEC',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Single-column ASCII output: TYPE_FLOAT = voltages, TYPE_DEC = raw ADC decimal, TYPE_HEX = raw ADC hex (0x1234).', 'valid': ['TYPE_FLOAT', 'TYPE_DEC', 'TYPE_HEX']}),kw_only=False,_field_type=_FIELD)}, '__replace__': <function _replace>, '__hash__': None, '__init__': <function Application.__init__>, '__repr__': <function Application.__repr__>, '__eq__': <function Application.__eq__>, '__match_args__': ('StartPosition', 'TransferLength', 'SegmentStart', 'SegmentCount', 'PageSize', 'SaveFileName', 'SaveFileFormat')})#
__eq__(other)#

Return self==value.

__firstlineno__ = 89#
__hash__ = None#
__init__(StartPosition: int = 0, TransferLength: int = 4096, SegmentStart: int = 1, SegmentCount: int = 5, PageSize: int | None = None, SaveFileName: str | None = None, SaveFileFormat: str = 'TYPE_DEC') → None#
__match_args__ = ('StartPosition', 'TransferLength', 'SegmentStart', 'SegmentCount', 'PageSize', 'SaveFileName', 'SaveFileFormat')#
__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)#