From bb6b82354ce9f3e5347b436958dcfba149bec5a7 Mon Sep 17 00:00:00 2001 From: Tim-Oliver Husser Date: Mon, 25 Dec 2023 13:00:54 +0100 Subject: [PATCH] option to disable broadcast for acquisiton images --- pyobs/modules/pointing/acquisition.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pyobs/modules/pointing/acquisition.py b/pyobs/modules/pointing/acquisition.py index c0c9bb85..1c02abf3 100644 --- a/pyobs/modules/pointing/acquisition.py +++ b/pyobs/modules/pointing/acquisition.py @@ -33,6 +33,7 @@ def __init__( tolerance: float = 1, max_offset: float = 120, log_file: Optional[str] = None, + broadcast: bool = False, **kwargs: Any, ): """Create a new acquisition. @@ -44,6 +45,7 @@ def __init__( tolerance: Tolerance in position to reach in arcsec. max_offset: Maximum offset to move in arcsec. log_file: Name of file to write log to. + broadcast: Whether to broadcast acquisition images. """ BasePointing.__init__(self, **kwargs) @@ -55,6 +57,7 @@ def __init__( self._tolerance = tolerance * u.arcsec self._max_offset = max_offset * u.arcsec self._abort_event = asyncio.Event() + self._broadcast = broadcast # init log file self._publisher = CsvPublisher(log_file) if log_file is not None else None @@ -111,6 +114,8 @@ async def _acquire(self, exposure_time: float) -> Dict[str, Any]: # do camera settings await self._do_camera_settings(camera) + if isinstance(camera, IImageType): + await camera.set_image_type(ImageType.ACQUISITION) # try given number of attempts for a in range(self._attempts): @@ -124,9 +129,10 @@ async def _acquire(self, exposure_time: float) -> Dict[str, Any]: await camera.set_exposure_time(exposure_time) else: log.info("Exposing image...") - if isinstance(camera, IImageType): - await camera.set_image_type(ImageType.ACQUISITION) - filename = await camera.grab_data() + if isinstance(camera, IData): + filename = await camera.grab_data(broadcast=self._broadcast) + else: + raise exc.GeneralError("Cannot grab data from camera.") # download image log.info("Downloading image...")