Measurement#

class Measurement(
channel_data: dict[str, list[float] | list[str]],
timestamps: list[int],
tags: dict[str, str] | None = None,
)[source]#

Bases: object

Data structure to hold measurement data. All channels have a common timebase.

Variables:
  • 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 float or str, 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 in channel_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.

channel_data: dict[str, list[float] | list[str]]#
timestamps: list[int]#
tags: dict[str, str] | None = None#
static create_timestamps_from_dt(
t0: int,
dt: int,
length: int,
backstamp: bool,
) → list[int][source]#

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).

property values: list[float] | list[str]#

Values for the only channel; raises ValueError if the Measurement holds multiple channels.

property latest: float | str#

Most recent value of the only channel; raises ValueError if the Measurement holds multiple.