Skip to content

Commit

Permalink
rely on exptime (#487)
Browse files Browse the repository at this point in the history
  • Loading branch information
danjampro authored Jun 22, 2021
1 parent 25afc1a commit 72b7e02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 34 deletions.
20 changes: 8 additions & 12 deletions src/huntsman/pocs/observatory.py
Original file line number Diff line number Diff line change
Expand Up @@ -677,18 +677,14 @@ def _take_autoflats(self, cameras, observation, target_scaling=0.17, scaling_tol
self.logger.info(f"Flat field status for {cam_name}: {status}")

# Check if we need to terminate the sequence early
if self.past_midnight: # Sky getting brighter
if all([s.is_too_bright and s.min_exptime_reached for s in sequences.values()]):
self.logger.info("Terminating flat field sequence for the "
f"{observation.filter_name} filter because all exposures are"
" too bright at the minimum exposure time.")
return
else: # Sky getting fainter
if all([s.is_too_faint and s.max_exptime_reached for s in sequences.values()]):
self.logger.info("Terminating flat field sequence for the "
f"{observation.filter_name} filter because all exposures are"
" too faint at the maximum exposure time.")
return
if self.past_midnight and all([s.min_exptime_reached for s in sequences.values()]):
self.logger.info(f"Terminating flat field sequence for {observation.filter_name}"
f" filter because min exposure time reached.")
return
elif all([s.max_exptime_reached for s in sequences.values()]):
self.logger.info(f"Terminating flat field sequence for {observation.filter_name}"
f" filter because max exposure time reached.")
return

def _autoflat_target_counts(self, cam_name, target_scaling, scaling_tolerance):
""" Get the target counts and tolerance for each camera.
Expand Down
22 changes: 0 additions & 22 deletions src/huntsman/pocs/utils/flats.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,28 +153,6 @@ def max_exptime_reached(self):
except IndexError:
return False

@property
def is_too_faint(self):
""" Check if the last exposure was too faint.
Returns:
bool: True if the last exposure was too faint, else False.
"""
try:
return self._average_counts[-1] + self._counts_tolerance < self._target_counts
except IndexError:
return False

@property
def is_too_bright(self):
""" Check if the last exposure was too bright.
Returns:
bool: True if the last exposure was too bright, else False.
"""
try:
return self._average_counts[-1] - self._counts_tolerance > self._target_counts
except IndexError:
return False

def update(self, filename, exptime, time_start):
""" Update the sequence data with the previous iteration.
Args:
Expand Down

0 comments on commit 72b7e02

Please sign in to comment.