Skip to content

Commit

Permalink
Put in safety checks for morning flats
Browse files Browse the repository at this point in the history
  • Loading branch information
elanaku committed Oct 16, 2024
1 parent 79d1f95 commit 77fe9a6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions python/lsst/ts/externalscripts/base_take_twilight_flats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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"
)

Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 77fe9a6

Please sign in to comment.