Source code for pyobs.modules.roof.basedome
from __future__ import annotations
import logging
from abc import ABCMeta
from typing import Any
from pyobs.interfaces import AltAzState, FitsHeaderEntry, IDome, IPointingAltAz
from pyobs.utils import exceptions as exc
from .baseroof import BaseRoof
log = logging.getLogger(__name__)
class BaseDome(IDome, BaseRoof, metaclass=ABCMeta):
"""Base class for domes."""
__module__ = "pyobs.modules.roof"
def __init__(self, **kwargs: Any):
"""Initialize a new base dome."""
BaseRoof.__init__(self, **kwargs)
exc.register_exception(exc.MotionError, 3, timespan=600, callback=self._default_remote_error_callback)
[docs]
async def get_fits_header_before(
self, namespaces: list[str] | None = None, **kwargs: Any
) -> dict[str, FitsHeaderEntry]:
"""Returns FITS header for the current status of this module.
Args:
namespaces: If given, only return FITS headers for the given namespaces.
Returns:
Dictionary containing FITS headers.
"""
hdr = await BaseRoof.get_fits_header_before(self, namespaces, **kwargs)
altaz: AltAzState | None = self.comm.get_own_state(IPointingAltAz)
az = altaz.az if altaz is not None else 0.0
hdr["ROOF-AZ"] = FitsHeaderEntry(az, "Azimuth of roof slit, deg E of N")
return hdr
__all__ = ["BaseDome"]