Types¤
Shared types: runtime dataclasses (Measurement/Command) and cross-protocol Pydantic configs.
Measurement
dataclass
¤
Measurement(
channel_data: dict[str, list[float] | list[str]],
timestamps: list[int],
tags: dict[str, str] | None = None,
)
Data structure to hold measurement data. All channels have a common timebase.
Attributes:
-
channel_data(dict[str, list[float] | list[str]]) –Maps channel names (or numbers, as strings) to that channel's samples. Every value in a channel's list is the same type, either
floatorstr, never mixed; a categorical read such as a mode name or state is a string-valued list. -
timestamps(list[int]) –Timestamps in integer nanoseconds since the Unix epoch, one per sample and aligned with the values in
channel_data. Its length matches the length of every list inchannel_data. -
tags(dict[str, str] | None) –Optional metadata for the acquisition, such as a test ID, operator name, or environmental qualifier. Used for search, provenance, and analysis.
See Command for the write counterpart, which carries one datapoint per channel.
values
property
¤
Values for the only channel; raises ValueError if the Measurement holds multiple channels.
latest
property
¤
Most recent value of the only channel; raises ValueError if the Measurement holds multiple.
create_timestamps_from_dt
staticmethod
¤
Build a length-long timestamp list at dt ns spacing starting at t0 (ns since epoch).
With backstamp=True, shift t0 back by dt * (length - 1) so the
last sample lands at the original t0 (useful when t0 is the
completion time of a finite acquisition).
Command
dataclass
¤
DeviceInfo
¤
Bases: BaseModel
Device metadata. name is the channel-name prefix on publish (e.g. my_device.temperature).
LinearScale
¤
Bases: BaseModel
Linear scaling: physical = offset + (gain * raw).
Applied automatically on reads (raw -> physical) and reversed on writes (physical -> raw). Not all protocols or data point types support scaling -- check the protocol-specific documentation.