From 68b412bb038bf7a3a308f330fc93cf1aa893be5a Mon Sep 17 00:00:00 2001 From: GermanHydrogen Date: Tue, 30 Jan 2024 10:52:55 +0100 Subject: [PATCH] Fixed guiding config --- pyobs/modules/pointing/_baseguiding.py | 5 +++-- pyobs/modules/pointing/guidingstatistics/__init__.py | 2 +- .../modules/pointing/guidingstatistics/guidingstatistics.py | 6 ++++-- pyobs/modules/pointing/guidingstatistics/skyoffsets.py | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pyobs/modules/pointing/_baseguiding.py b/pyobs/modules/pointing/_baseguiding.py index 67660660..86d7e0e7 100644 --- a/pyobs/modules/pointing/_baseguiding.py +++ b/pyobs/modules/pointing/_baseguiding.py @@ -12,6 +12,7 @@ from .guidingstatistics import GuidingStatisticsUptime, GuidingStatisticsPixelOffset from .guidingstatistics.guidingstatistics import GuidingStatistics from ...interfaces import ITelescope +from ...object import get_object log = logging.getLogger(__name__) @@ -30,7 +31,7 @@ def __init__( pid: bool = False, reset_at_focus: bool = True, reset_at_filter: bool = True, - guiding_statistic: Optional[GuidingStatistics] = None, + guiding_statistic: Optional[Union[Dict[str, Any], GuidingStatistics]] = None, **kwargs: Any, ): """Initializes a new science frame auto guiding system. @@ -65,7 +66,7 @@ def __init__( if guiding_statistic is None: guiding_statistic = GuidingStatisticsPixelOffset() - self._statistics = guiding_statistic + self._statistics = get_object(guiding_statistic, GuidingStatistics) self._uptime = GuidingStatisticsUptime() async def start(self, **kwargs: Any) -> None: diff --git a/pyobs/modules/pointing/guidingstatistics/__init__.py b/pyobs/modules/pointing/guidingstatistics/__init__.py index 91946b5b..233c391b 100644 --- a/pyobs/modules/pointing/guidingstatistics/__init__.py +++ b/pyobs/modules/pointing/guidingstatistics/__init__.py @@ -1,3 +1,3 @@ from .uptime import GuidingStatisticsUptime from .pixeloffset import GuidingStatisticsPixelOffset -from .skyoffsets import GuidingStatisticsSkyOffset \ No newline at end of file +from .skyoffsets import GuidingStatisticsSkyOffset diff --git a/pyobs/modules/pointing/guidingstatistics/guidingstatistics.py b/pyobs/modules/pointing/guidingstatistics/guidingstatistics.py index 7dc851fc..7320a0e7 100644 --- a/pyobs/modules/pointing/guidingstatistics/guidingstatistics.py +++ b/pyobs/modules/pointing/guidingstatistics/guidingstatistics.py @@ -2,6 +2,8 @@ from collections import defaultdict from typing import List, Dict, Tuple, Any +from pyobs.images import Image + class GuidingStatistics(object, metaclass=ABCMeta): """Calculates statistics for guiding.""" @@ -42,10 +44,10 @@ def add_to_header(self, client: str, header: Dict[str, Tuple[Any, str]]) -> Dict return header | session_header @abstractmethod - def _get_session_data(self, input_data: Any) -> Any: + def _get_session_data(self, input_data: Image) -> Any: raise NotImplementedError - def add_data(self, input_data: Any) -> None: + def add_data(self, input_data: Image) -> None: """ Adds data to all client measurement sessions. Args: diff --git a/pyobs/modules/pointing/guidingstatistics/skyoffsets.py b/pyobs/modules/pointing/guidingstatistics/skyoffsets.py index 1817119e..b4d5fde5 100644 --- a/pyobs/modules/pointing/guidingstatistics/skyoffsets.py +++ b/pyobs/modules/pointing/guidingstatistics/skyoffsets.py @@ -34,7 +34,7 @@ def _build_header(self, data: List[float]) -> Dict[str, Tuple[Any, str]]: rms = self._calc_rms(data) if rms is not None: - header["GUIDING OS RMS"] = (float(rms), "RMS for guiding on sky") + header["GUIDING RMS"] = (float(rms), "RMS for guiding on sky") return header