Library
Instrument
Instrument is the base class for all instrument types. Itβs responsibilities include.
- Handling background daemons for synchronous instrument communication.
- Holds the
publishers an instrument will use. - Creates and holds the communication interface for the instrument.
Instrument.
Measurements and Commands
Within aInstrument, data is packaged into Measurement and Command objects when data is read from or sent to an instrument, respectively.
The rationale for this is:
- Consistency regardless of instrument type or vendor.
- Interoperability of publishers across instrument types.
- Better integration with Nominal ecosystem by enforcing certain data is always be present, like timestamps.
instro.lib
Measurement
AMeasurement object should be created when reading data from an instrument.
Command
ACommand object should be created when telling an instrument to do something.
Parameters
-
channel_data: dict[str, list[float]]This dictionary maps names (or numbers, as strings) to lists of numeric measurements. For example, if your instrument has channels"my_thermocouple1"and"my_thermocouple2", and you collected 10 samples from each,channel_datamight look like: -
timestamps: list[int]A list of POSIX timestamps (in integer milliseconds) for each measurement sample, aligned with the values inchannel_data. The length oftimestampsshould match the length of each list inchannel_data. -
tags: dict[str, str] | NoneOptional metadata associated with this measurement acquisition. Common tags include test IDs, operator name, or environmental qualifiers. Useful for search, provenance, and analysis.
Backwards-compatible channel naming (legacy_naming)
Every category instrument accepts a legacy_naming: bool = False keyword at construction. When set to True, the instrument publishes channels under their pre-v1.0 names.
- Backwards compatibility. If your dashboards or recorded datasets were keyed on the pre-v1.0 channel names, flip the flag on each instrument as a single-line stopgap while you update downstream consumers.
- Categories with a v1.0 rename (PSU, ELoad, I2C, DAQ digital channels, Scope) honor the flag.
- Categories with no v1.0 rename (DMM, Modbus, DAQ analog/relay) ignore the flag (the published names are unchanged either way).
- All-or-nothing per instrument. There is no way to use new names for some channels and legacy for others on the same instance.
legacy_namingis scheduled for removal in v2.0. Plan to migrate downstream consumers within that window.