Skip to content

Commit

Permalink
cleaned up after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
evalott100 committed Jan 9, 2025
1 parent 4f40113 commit e0b0872
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 132 deletions.
20 changes: 9 additions & 11 deletions src/event_model/basemodels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .event import * # noqa: F403
from .event_descriptor import * # noqa: F403
from .event_page import * # noqa: F403
from .partial_resource import * # noqa: F403
from .resource import * # noqa: F403
from .run_start import * # noqa: F403
from .run_stop import * # noqa: F403
Expand All @@ -18,32 +17,31 @@

BasemodelType = Union[
Type[BulkDatum], # noqa: F405,
Type[BulkEvents], # noqa: F405,
Type[Datum], # noqa: F405,
Type[DatumPage], # noqa: F405,
Type[Event], # noqa: F405,
Type[EventDescriptor], # noqa: F405,
Type[EventPage], # noqa: F405,
Type[PartialResource], # noqa: F405,
Type[RunStart], # noqa: F405,
Type[RunStop], # noqa: F405,
Type[StreamDatum], # noqa: F405,
Type[StreamResource], # noqa: F405,
Type[BulkEvents], # noqa: F405,
Type[Event], # noqa: F405,
Type[EventPage], # noqa: F405,
Type[Resource], # noqa: F405,
Type[RunStart], # noqa: F405,
]

ALL_BASEMODELS: Tuple[BasemodelType, ...] = (
BulkDatum, # noqa: F405
BulkEvents, # noqa: F405
Datum, # noqa: F405
DatumPage, # noqa: F405
Event, # noqa: F405
EventDescriptor, # noqa: F405
EventPage, # noqa: F405
PartialResource, # noqa: F405
RunStart, # noqa: F405
RunStop, # noqa: F405
StreamDatum, # noqa: F405
StreamResource, # noqa: F405
BulkEvents, # noqa: F405
Event, # noqa: F405
EventPage, # noqa: F405
Resource, # noqa: F405
RunStart, # noqa: F405
)

33 changes: 0 additions & 33 deletions src/event_model/basemodels/partial_resource.py

This file was deleted.

20 changes: 9 additions & 11 deletions src/event_model/documents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .event import * # noqa: F403
from .event_descriptor import * # noqa: F403
from .event_page import * # noqa: F403
from .partial_resource import * # noqa: F403
from .resource import * # noqa: F403
from .run_start import * # noqa: F403
from .run_stop import * # noqa: F403
Expand All @@ -20,30 +19,29 @@
Type[BulkDatum], # noqa: F405,
Type[Datum], # noqa: F405,
Type[DatumPage], # noqa: F405,
Type[EventDescriptor], # noqa: F405,
Type[RunStop], # noqa: F405,
Type[StreamDatum], # noqa: F405,
Type[StreamResource], # noqa: F405,
Type[EventPage], # noqa: F405,
Type[Event], # noqa: F405,
Type[EventDescriptor], # noqa: F405,
Type[BulkEvents], # noqa: F405,
Type[RunStart], # noqa: F405,
Type[PartialResource], # noqa: F405,
Type[Event], # noqa: F405,
Type[EventPage], # noqa: F405,
Type[Resource], # noqa: F405,
Type[RunStart], # noqa: F405,
]

ALL_DOCUMENTS: Tuple[DocumentType, ...] = (
BulkDatum, # noqa: F405
Datum, # noqa: F405
DatumPage, # noqa: F405
EventDescriptor, # noqa: F405
RunStop, # noqa: F405
StreamDatum, # noqa: F405
StreamResource, # noqa: F405
EventPage, # noqa: F405
Event, # noqa: F405
EventDescriptor, # noqa: F405
BulkEvents, # noqa: F405
RunStart, # noqa: F405
PartialResource, # noqa: F405
Event, # noqa: F405
EventPage, # noqa: F405
Resource, # noqa: F405
RunStart, # noqa: F405
)

70 changes: 24 additions & 46 deletions src/event_model/documents/event_descriptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,6 @@
DtypeNumpyItem = List


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: Annotated[
float,
Field(
description=(
"ms since last update to fail after if set point and "
"read point are not within `value_difference` of each other."
)
),
]
value_difference: NotRequired[
Annotated[
float,
Field(
description=(
"Allowed difference in value between set point and read point "
"after `time_difference`."
)
),
]
]


class LimitsRange(TypedDict):
high: Optional[float]
low: Optional[float]
Expand Down Expand Up @@ -93,23 +64,30 @@ class Limits(TypedDict):
https://tango-controls.readthedocs.io/en/latest/development/device-api/attribute-alarms.html
"""

control: NotRequired[Annotated[LimitsRange, Field(description="Control limits.")]]
display: NotRequired[Annotated[LimitsRange, Field(description="Display limits.")]]
warning: NotRequired[Annotated[LimitsRange, Field(description="Warning limits.")]]
alarm: NotRequired[Annotated[LimitsRange, Field(description="Alarm limits.")]]
hysteresis: NotRequired[Annotated[float, Field(description="Hysteresis.")]]
rds: NotRequired[Annotated[RdsRange, Field(description="RDS parameters.")]]


_ConstrainedDtype = Annotated[
str,
Field(
description="A numpy dtype e.g `<U9`, `<f16`",
pattern="[|<>][tbiufcmMOSUV][0-9]+",
),
]

_ConstrainedDtypeNpStructure = List[Tuple[str, _ConstrainedDtype]]
alarm: NotRequired[LimitsRange]
"""
Alarm limits.
"""
control: NotRequired[LimitsRange]
"""
Control limits.
"""
display: NotRequired[LimitsRange]
"""
Display limits.
"""
hysteresis: NotRequired[float]
"""
Hysteresis.
"""
rds: NotRequired[RdsRange]
"""
RDS parameters.
"""
warning: NotRequired[LimitsRange]
"""
Warning limits.
"""


class DataKey(TypedDict):
Expand Down
31 changes: 0 additions & 31 deletions src/event_model/documents/partial_resource.py

This file was deleted.

0 comments on commit e0b0872

Please sign in to comment.