Source code for event_model.documents.event_descriptor

# ruff: noqa
# generated by datamodel-codegen:
#   filename:  event_descriptor.json

from __future__ import annotations

from typing import Any, Dict, List, Literal, Optional, TypedDict, Union

from typing_extensions import NotRequired

DtypeNumpy = str


DtypeNumpyItem = List


DataType = Any


Dtype = Literal["string", "number", "array", "boolean", "integer"]


class LimitsRange(TypedDict):
    high: Optional[float]
    low: Optional[float]


[docs] class PerObjectHint(TypedDict): """ The 'interesting' data keys for this device. """ NX_class: NotRequired[str] """ The NeXus class definition for this device. """ fields: NotRequired[List[str]] """ The 'interesting' data keys for this device. """
class RdsRange(TypedDict): """ RDS (Read different than set) parameters range. https://tango-controls.readthedocs.io/en/latest/development/device-api/attribute-alarms.html#the-read-different-than-set-rds-alarm """ time_difference: float """ ms since last update to fail after if set point and read point are not within `value_difference` of each other. """ value_difference: float """ Allowed difference in value between set point and read point after `time_difference`. """
[docs] class Limits(TypedDict): """ Epics limits: see 3.4.1 https://epics.anl.gov/base/R3-14/12-docs/AppDevGuide/node4.html """ alarm: NotRequired[Optional[LimitsRange]] """ Alarm limits. """ control: NotRequired[Optional[LimitsRange]] """ Control limits. """ display: NotRequired[Optional[LimitsRange]] """ Display limits. """ hysteresis: NotRequired[Optional[float]] """ Hysteresis. """ rds: NotRequired[Optional[RdsRange]] """ RDS parameters. """ warning: NotRequired[Optional[LimitsRange]] """ Warning limits. """
[docs] class DataKey(TypedDict): """ Describes the objects in the data property of Event documents """ choices: NotRequired[List[str]] """ Choices of enum value. """ dims: NotRequired[List[str]] """ The names for dimensions of the data. Null or empty list if scalar data """ dtype: Dtype """ The type of the data in the event, given as a broad JSON schema type. """ dtype_numpy: NotRequired[Union[DtypeNumpy, List[DtypeNumpyItem]]] """ The type of the data in the event, given as a numpy dtype string (or, for structured dtypes, array). """ external: NotRequired[str] """ Where the data is stored if it is stored external to the events """ limits: NotRequired[Limits] """ Epics limits. """ object_name: NotRequired[str] """ The name of the object this key was pulled from. """ precision: NotRequired[Optional[int]] """ Number of digits after decimal place if a floating point number """ shape: List[int] """ The shape of the data. Empty list indicates scalar data. """ source: str """ The source (ex piece of hardware) of the data. """ units: NotRequired[str] """ Engineering units of the value """
class Configuration(TypedDict): data: NotRequired[Dict[str, Any]] """ The actual measurement data """ data_keys: NotRequired[Dict[str, DataKey]] """ This describes the data stored alongside it in this configuration object. """ timestamps: NotRequired[Dict[str, Any]] """ The timestamps of the individual measurement data """
[docs] class EventDescriptor(TypedDict): """ Document to describe the data captured in the associated event documents """ configuration: NotRequired[Dict[str, Configuration]] """ Readings of configurational fields necessary for interpreting data in the Events. """ data_keys: Dict[str, DataKey] """ This describes the data in the Event Documents. """ hints: NotRequired[PerObjectHint] name: NotRequired[str] """ A human-friendly name for this data stream, such as 'primary' or 'baseline'. """ object_keys: NotRequired[Dict[str, Any]] """ Maps a Device/Signal name to the names of the entries it produces in data_keys. """ run_start: str """ Globally unique ID of this run's 'start' document. """ time: float """ Creation time of the document as unix epoch time. """ uid: str """ Globally unique ID for this event descriptor. """