Skip to content

Commit

Permalink
fix mask check
Browse files Browse the repository at this point in the history
  • Loading branch information
rcooke-ast committed Jul 12, 2023
1 parent 8323072 commit d8f6d05
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pypeit/find_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1184,10 +1184,12 @@ def joint_skysub(self, skymask=None, update_crmask=True, trim_edg=(0,0),
counts = global_sky
_scale = None if self.sciImg.img_scale is None else self.sciImg.img_scale[thismask]
# NOTE: darkcurr must be a float for the call below to work.
var = procimg.variance_model(self.sciImg.base_var[thismask], counts=counts[thismask],
count_scale=_scale, noise_floor=adderr)
model_ivar[thismask] = utils.inverse(var)

if not self.bkg_redux:
var = procimg.variance_model(self.sciImg.base_var[thismask], counts=counts[thismask],
count_scale=_scale, noise_floor=adderr)
model_ivar[thismask] = utils.inverse(var)
else:
model_ivar[thismask] = self.sciImg.ivar[thismask]
# RJC :: Recalculating the global sky and flexure is probably overkill... but please keep this code in for now
# Recalculate the sky on each individual slit and redetermine the spectral flexure
# global_sky_sep = super().global_skysub(skymask=skymask, update_crmask=update_crmask,
Expand Down Expand Up @@ -1227,7 +1229,8 @@ def global_skysub(self, skymask=None, update_crmask=True, trim_edg=(0,0),
global_sky_sep = super().global_skysub(skymask=skymask, update_crmask=update_crmask,
trim_edg=trim_edg, show_fit=show_fit, show=show,
show_objs=show_objs)
if np.any(global_sky_sep[skymask] == 0):
# Check if any slits failed
if np.any(global_sky_sep[self.slitmask>=0] == 0) and not self.bkg_redux:
# Cannot continue without a sky model for all slits
msgs.error("Global sky subtraction has failed for at least one slit.")

Expand Down

0 comments on commit d8f6d05

Please sign in to comment.