Skip to content

Commit

Permalink
option to disable broadcast for acquisiton images
Browse files Browse the repository at this point in the history
  • Loading branch information
thusser committed Dec 25, 2023
1 parent b0179d6 commit bb6b823
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pyobs/modules/pointing/acquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)

Expand All @@ -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
Expand Down Expand Up @@ -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):
Expand All @@ -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...")
Expand Down

0 comments on commit bb6b823

Please sign in to comment.