From 77fe9a667dcbc5dd6dd91eb5eb68349de04993c6 Mon Sep 17 00:00:00 2001 From: elanaku Date: Wed, 16 Oct 2024 01:49:47 +0000 Subject: [PATCH] Put in safety checks for morning flats --- .../ts/externalscripts/base_take_twilight_flats.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/python/lsst/ts/externalscripts/base_take_twilight_flats.py b/python/lsst/ts/externalscripts/base_take_twilight_flats.py index 0a9f6551c..c3c849459 100644 --- a/python/lsst/ts/externalscripts/base_take_twilight_flats.py +++ b/python/lsst/ts/externalscripts/base_take_twilight_flats.py @@ -59,6 +59,8 @@ def __init__(self, index, descr="Base script for taking twilight flats.") -> Non self.vizier = None + self.where_sun = None + @property @abc.abstractmethod def tcs(self): @@ -339,7 +341,7 @@ def get_new_exptime(self, sky_counts, exp_time): # won't be exceeded return self.config.min_exp_time * 1.01 - return new_exp_time + return round(new_exp_time, 2) def get_target_radec(self): """ @@ -440,9 +442,9 @@ async def get_twilight_flat_sky_coords(self, target, radius=5): def assert_sun_location(self): """Confirm sun's elevation is safe for taking twilight flats.""" sun_coordinates = self.tcs.get_sun_azel() - where_sun = "setting" if (sun_coordinates[0] > 180) else "rising" + self.where_sun = "setting" if (sun_coordinates[0] > 180) else "rising" self.log.debug( - f" The azimuth of the {where_sun} Sun is {sun_coordinates[0]:.2f} deg \n" + f" The azimuth of the {self.where_sun} Sun is {sun_coordinates[0]:.2f} deg \n" f" The elevation of the Sun is {sun_coordinates[1]:.2f} deg" ) @@ -485,6 +487,7 @@ async def take_twilight_flats(self): program=self.program, reason=self.reason, ) + self.log.debug("First image taken") self.latest_exposure_id = int(flat_image[0]) @@ -546,7 +549,7 @@ async def take_twilight_flats(self): exp_repeat_time = 2 - if exp_time < exp_repeat_time: + if (exp_time < exp_repeat_time) and (self.where_sun != "rising"): # take fast repeated images if the exposure time is short nrepeats = 4