Source code for ctao_datamodel.models.common
"""Implementations of the CTAO Common Data Model Specification."""
from enum import StrEnum, nonmember
from typing import ClassVar
import astropy.units as u
from astropydantic import AstroPydanticUnit
from .._core import AstroField, ModelBase, Quantity, enum_doc
__all__ = ["SiteID", "TimeRefPos", "TimeSystem", "TimeReference"]
_NAMESPACE = "CTAO.Common"
[docs]
class SiteID(StrEnum):
"""CTAO sites."""
_namespace = nonmember(_NAMESPACE)
SDMC_SUSS = "SDMC-SUSS" #: Data created by SUSS at the SDMC
CTAO_NORTH = "CTAO-North" #: Data created at CTAO North
CTAO_SOUTH = "CTAO-South" #: Data created at CTAO South
SDMC_DPPS = "SDMC-DPPS" #: Data created by DPPS at the SDMC
HQ = "HQ" #: Data created at CTAO Headquarters
EXTERNAL = "EXTERNAL" #: Data external to CTAO
[docs]
class TimeRefPos(StrEnum):
"""
Spatial location at which the observation time is valid.
From FITS standard v4
"""
_namespace = nonmember(_NAMESPACE)
TOPOCENTER = "TOPOCENTER"
RELOCATABLE = "RELOCATABLE"
[docs]
class TimeSystem(StrEnum):
"""The time scale of the time-related keywords.
For simulated data, use LOCAL.
"""
_namespace = nonmember(_NAMESPACE)
TT = "TT" #: Terrestrial Time
UTC = "UTC" #: Coordinated Universal Time
UT1 = "UT1" #: Universal Time
TAI = "TAI" #: International Atomic Time
GPS = "GPS" #: Global Positioning System time
LOCAL = "LOCAL" #: Local Time
[docs]
class TimeReference(ModelBase):
"""
Reference time for floating point time representations.
For timestamps represented as ISO time strings, this is not relevant.
"""
_namespace: ClassVar[str] = _NAMESPACE
position: TimeRefPos = AstroField(enum_doc(TimeRefPos), fits_keyword="TREFPOS")
time_mjd: Quantity[u.day] = AstroField(
"Reference time in MJD", fits_keyword="MJDREF"
)
unit: AstroPydanticUnit = AstroField(default="s", fits_keyword="TIMEUNIT")
system: TimeSystem = AstroField(
enum_doc(TimeSystem), default=TimeSystem.TAI, fits_keyword="TIMESYS"
)
resolution: float | None = AstroField(
"time resolution in the time unit.",
default=None,
fits_keyword="TIMEDELT",
ivoa_keyword="t_resolution",
)