Skip to content

Types¤

Shared types and dataclasses used across Nominal instrumentation.

Primary entry point: BackgroundDaemonConfig.

BackgroundDaemonConfig dataclass ¤

BackgroundDaemonConfig(interval: float = 1.0, enabled: bool = True)

interval class-attribute instance-attribute ¤

interval: float = 1.0

enabled class-attribute instance-attribute ¤

enabled: bool = True

Measurement dataclass ¤

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

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

channel_data instance-attribute ¤

channel_data: dict[str, list[float]]

timestamps instance-attribute ¤

timestamps: list[int]

tags class-attribute instance-attribute ¤

tags: dict[str, str] | None = None

values property ¤

values: list[float] | list[str]

When measurement is of a single channel, returns the data for that channel.

Returns:

Raises:

  • ValueError

    Multiple channels present. Use channel_data directly and index for the desired channel.

latest property ¤

latest: float | str

When measurement is of a single channel, returns the latest data for that channel.

Returns:

  • float | str

    float | str: latest value for channel.

Raises:

  • ValueError

    Multiple channels present. Use channel_data directly and index for the desired channel.

create_timestamps_from_dt staticmethod ¤

create_timestamps_from_dt(
    t0: int, dt: int, length: int, backstamp: bool
) -> list[int]

Create a list of timestamps based on a start time, interval, and length.

Optionally adjust t0 to be backstamped by the total duration of the measurement.

Parameters:

  • t0 ¤
    (int) –

    ns timestamp since epoch (e.g., time.time_ns())

  • dt ¤
    (int) –

    ns interval between samples

  • length ¤
    (int) –

    length of the sample set to timestamp

  • backstamp ¤
    (bool) –

    Adjust t0 to be backstamped by the total duration of the measurement

Returns:

  • list[int]

    list[int]: a list of timestamps, each an ns timestamp since epoch

Command dataclass ¤

Command(
    channel_data: dict[str, float | str],
    timestamp: int,
    tags: dict[str, str] | None = None,
)

Data structure to hold command data.

channel_data instance-attribute ¤

channel_data: dict[str, float | str]

timestamp instance-attribute ¤

timestamp: int

tags class-attribute instance-attribute ¤

tags: dict[str, str] | None = None