Skip to content

Commit

Permalink
fix usage of FIBERSTATUS VARIABLETHRU
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Bailey authored and Stephen Bailey committed Aug 22, 2024
1 parent 592e2e8 commit 5dac0a1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions py/desispec/fiberbitmasking.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def get_skysub_fiberbitmask_val(band):
Return mask of bad FIBERSTATUS bits for selecting sky fibers,
i.e. fibers with these bits set should not be used for the sky model
"""
return get_all_fiberbitmask_with_amp(band) | fmsk.VARIABLETHRU
return get_all_fiberbitmask_with_amp(band)

def get_flat_fiberbitmask_val(band):
"""
Expand All @@ -169,7 +169,7 @@ def get_stdstars_fiberbitmask_val(band):
Return mask of bad FIBERSTATUS bits for selecting standard stars,
i.e. fibers with these bits set should not be used as standard stars
"""
return get_all_fiberbitmask_with_amp(band) | fmsk.POORPOSITION | fmsk.VARIABLETHRU
return get_all_fiberbitmask_with_amp(band) | fmsk.POORPOSITION

def get_all_nonamp_fiberbitmask_val():
"""Return a mask for all fatally bad FIBERSTATUS bits except BADAMPB/R/Z
Expand Down
3 changes: 3 additions & 0 deletions py/desispec/fluxcalibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ def isStdStar(fibermap, bright=None):
log.warning('Using FA_TYPE to find standard stars instead')
yes = (fibermap['FA_TYPE'] & FA_STDSTAR_MASK) != 0

#- Remove fibers with known variable throughput
yes &= ((fibermap['FIBERSTATUS'] & fibermask.VARIABLETHRU) == 0)

return yes

def applySmoothingFilter(flux,width=200) :
Expand Down
8 changes: 6 additions & 2 deletions py/desispec/sky.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import sys
from desispec.fiberbitmasking import get_fiberbitmasked_frame_arrays, get_fiberbitmasked_frame
import scipy.ndimage
from desispec.maskbits import specmask
from desispec.maskbits import specmask, fibermask
from desispec.preproc import get_amp_ids,parse_sec_keyword
from desispec.io import findfile,read_xytraceset
from desispec.calibfinder import CalibFinder
Expand Down Expand Up @@ -198,6 +198,8 @@ def get_sky_fibers(fibermap, override_sky_targetids=None, exclude_sky_targetids=
some targetids by providing a list of them through exclude_sky_targetids
or by just providing all the sky targetids directly (in that case
the OBJTYPE information is ignored)
Fibers with FIBERSTATUS bit VARIABLETHRU are also excluded
"""
log = get_logger()
# Grab sky fibers on this frame
Expand All @@ -206,7 +208,9 @@ def get_sky_fibers(fibermap, override_sky_targetids=None, exclude_sky_targetids=
skyfibers = np.where(np.in1d(fibermap['TARGETID'], override_sky_targetids))[0]
# we ignore OBJTYPEs
else:
skyfibers = np.where(fibermap['OBJTYPE'] == 'SKY')[0]
oksky = (fibermap['OBJTYPE'] == 'SKY')
oksky &= ((fibermap['FIBERSTATUS'] & fibermask.VARIABLETHRU) == 0)
skyfibers = np.where(oksky)[0]
if exclude_sky_targetids is not None:
log.info('Excluding default sky fibers using exclude_sky_targetids')
bads = np.in1d(fibermap['TARGETID'][skyfibers], exclude_sky_targetids)
Expand Down

0 comments on commit 5dac0a1

Please sign in to comment.