Skip to content

Commit

Permalink
remove obsconditions (see #253)
Browse files Browse the repository at this point in the history
  • Loading branch information
moustakas committed Jan 23, 2018
1 parent 8649036 commit 4a58e54
Showing 1 changed file with 71 additions and 71 deletions.
142 changes: 71 additions & 71 deletions py/desitarget/mock/mockmaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def empty_targets_table(nobj=1):
targets.add_column(Column(name='HPXPIXEL', length=nobj, dtype='i8'))
# PHOTSYS
# Do we need obsconditions or not?!?
targets.add_column(Column(name='OBSCONDITIONS', length=nobj, dtype='i8'))
#targets.add_column(Column(name='OBSCONDITIONS', length=nobj, dtype='i8'))

return targets

Expand Down Expand Up @@ -1446,10 +1446,10 @@ def select_targets(self, targets, truth, **kwargs):

targets['DESI_TARGET'] |= (qso != 0) * self.desi_mask.QSO
targets['DESI_TARGET'] |= (qso != 0) * self.desi_mask.QSO_SOUTH
targets['OBSCONDITIONS'] |= (qso != 0) * self.obsconditions.mask(
self.desi_mask.QSO.obsconditions)
targets['OBSCONDITIONS'] |= (qso != 0) * self.obsconditions.mask(
self.desi_mask.QSO_SOUTH.obsconditions)
#targets['OBSCONDITIONS'] |= (qso != 0) * self.obsconditions.mask(
# self.desi_mask.QSO.obsconditions)
#targets['OBSCONDITIONS'] |= (qso != 0) * self.obsconditions.mask(
# self.desi_mask.QSO_SOUTH.obsconditions)

class LYAMaker(SelectTargets):
"""Read LYA mocks, generate spectra, and select targets.
Expand Down Expand Up @@ -1658,10 +1658,10 @@ def select_targets(self, targets, truth, **kwargs):

targets['DESI_TARGET'] |= (qso != 0) * self.desi_mask.QSO
targets['DESI_TARGET'] |= (qso != 0) * self.desi_mask.QSO_SOUTH
targets['OBSCONDITIONS'] |= (qso != 0) * self.obsconditions.mask(
self.desi_mask.QSO.obsconditions)
targets['OBSCONDITIONS'] |= (qso != 0) * self.obsconditions.mask(
self.desi_mask.QSO_SOUTH.obsconditions)
#targets['OBSCONDITIONS'] |= (qso != 0) * self.obsconditions.mask(
# self.desi_mask.QSO.obsconditions)
#targets['OBSCONDITIONS'] |= (qso != 0) * self.obsconditions.mask(
# self.desi_mask.QSO_SOUTH.obsconditions)

class LRGMaker(SelectTargets):
"""Read LRG mocks, generate spectra, and select targets.
Expand Down Expand Up @@ -1854,10 +1854,10 @@ def select_targets(self, targets, truth, **kwargs):

targets['DESI_TARGET'] |= (lrg != 0) * self.desi_mask.LRG
targets['DESI_TARGET'] |= (lrg != 0) * self.desi_mask.LRG_SOUTH
targets['OBSCONDITIONS'] |= (lrg != 0) * self.obsconditions.mask(
self.desi_mask.LRG.obsconditions)
targets['OBSCONDITIONS'] |= (lrg != 0) * self.obsconditions.mask(
self.desi_mask.LRG_SOUTH.obsconditions)
#targets['OBSCONDITIONS'] |= (lrg != 0) * self.obsconditions.mask(
# self.desi_mask.LRG.obsconditions)
#targets['OBSCONDITIONS'] |= (lrg != 0) * self.obsconditions.mask(
# self.desi_mask.LRG_SOUTH.obsconditions)

class ELGMaker(SelectTargets):
"""Read ELG mocks, generate spectra, and select targets.
Expand Down Expand Up @@ -2055,10 +2055,10 @@ def select_targets(self, targets, truth, **kwargs):

targets['DESI_TARGET'] |= (elg != 0) * self.desi_mask.ELG
targets['DESI_TARGET'] |= (elg != 0) * self.desi_mask.ELG_SOUTH
targets['OBSCONDITIONS'] |= (elg != 0) * self.obsconditions.mask(
self.desi_mask.ELG.obsconditions)
targets['OBSCONDITIONS'] |= (elg != 0) * self.obsconditions.mask(
self.desi_mask.ELG_SOUTH.obsconditions)
#targets['OBSCONDITIONS'] |= (elg != 0) * self.obsconditions.mask(
# self.desi_mask.ELG.obsconditions)
#targets['OBSCONDITIONS'] |= (elg != 0) * self.obsconditions.mask(
# self.desi_mask.ELG_SOUTH.obsconditions)

class BGSMaker(SelectTargets):
"""Read BGS mocks, generate spectra, and select targets.
Expand Down Expand Up @@ -2255,25 +2255,25 @@ def select_targets(self, targets, truth, **kwargs):
targets['BGS_TARGET'] |= (bgs_bright != 0) * self.bgs_mask.BGS_BRIGHT_SOUTH
targets['DESI_TARGET'] |= (bgs_bright != 0) * self.desi_mask.BGS_ANY

targets['OBSCONDITIONS'] |= (bgs_bright != 0) * self.obsconditions.mask(
self.bgs_mask.BGS_BRIGHT.obsconditions)
targets['OBSCONDITIONS'] |= (bgs_bright != 0) * self.obsconditions.mask(
self.bgs_mask.BGS_BRIGHT_SOUTH.obsconditions)
targets['OBSCONDITIONS'] |= (bgs_bright != 0) * self.obsconditions.mask(
self.desi_mask.BGS_ANY.obsconditions)
#targets['OBSCONDITIONS'] |= (bgs_bright != 0) * self.obsconditions.mask(
# self.bgs_mask.BGS_BRIGHT.obsconditions)
#targets['OBSCONDITIONS'] |= (bgs_bright != 0) * self.obsconditions.mask(
# self.bgs_mask.BGS_BRIGHT_SOUTH.obsconditions)
#targets['OBSCONDITIONS'] |= (bgs_bright != 0) * self.obsconditions.mask(
# self.desi_mask.BGS_ANY.obsconditions)

# Select BGS_FAINT targets.
bgs_faint = isBGS_faint(rflux=rflux)
targets['BGS_TARGET'] |= (bgs_faint != 0) * self.bgs_mask.BGS_FAINT
targets['BGS_TARGET'] |= (bgs_faint != 0) * self.bgs_mask.BGS_FAINT_SOUTH
targets['DESI_TARGET'] |= (bgs_faint != 0) * self.desi_mask.BGS_ANY

targets['OBSCONDITIONS'] |= (bgs_faint != 0) * self.obsconditions.mask(
self.bgs_mask.BGS_FAINT.obsconditions)
targets['OBSCONDITIONS'] |= (bgs_faint != 0) * self.obsconditions.mask(
self.bgs_mask.BGS_FAINT_SOUTH.obsconditions)
targets['OBSCONDITIONS'] |= (bgs_faint != 0) * self.obsconditions.mask(
self.desi_mask.BGS_ANY.obsconditions)
#targets['OBSCONDITIONS'] |= (bgs_faint != 0) * self.obsconditions.mask(
# self.bgs_mask.BGS_FAINT.obsconditions)
#targets['OBSCONDITIONS'] |= (bgs_faint != 0) * self.obsconditions.mask(
# self.bgs_mask.BGS_FAINT_SOUTH.obsconditions)
#targets['OBSCONDITIONS'] |= (bgs_faint != 0) * self.obsconditions.mask(
# self.desi_mask.BGS_ANY.obsconditions)

class STARMaker(SelectTargets):
"""Lower-level Class for preparing for stellar spectra to be generated,
Expand Down Expand Up @@ -2380,8 +2380,8 @@ def select_standards(self, targets, truth, boss_std=None):
obs_rflux=obs_rflux)

targets['DESI_TARGET'] |= (fstd != 0) * self.desi_mask.STD_FSTAR
targets['OBSCONDITIONS'] |= (fstd != 0) * self.obsconditions.mask(
self.desi_mask.STD_FSTAR.obsconditions)
#targets['OBSCONDITIONS'] |= (fstd != 0) * self.obsconditions.mask(
# self.desi_mask.STD_FSTAR.obsconditions)

# Select bright-time FSTD targets. Temporary hack to use the BOSS
# standard-star selection algorith.
Expand All @@ -2396,8 +2396,8 @@ def select_standards(self, targets, truth, boss_std=None):
obs_rflux=obs_rflux, bright=True)

targets['DESI_TARGET'] |= (fstd_bright != 0) * self.desi_mask.STD_BRIGHT
targets['OBSCONDITIONS'] |= (fstd_bright != 0) * self.obsconditions.mask(
self.desi_mask.STD_BRIGHT.obsconditions)
#targets['OBSCONDITIONS'] |= (fstd_bright != 0) * self.obsconditions.mask(
# self.desi_mask.STD_BRIGHT.obsconditions)

def select_contaminants(self, targets, truth):
"""Select stellar (faint and bright) contaminants for the extragalactic targets.
Expand All @@ -2422,12 +2422,12 @@ def select_contaminants(self, targets, truth):
targets['BGS_TARGET'] |= (bgs_faint != 0) * self.bgs_mask.BGS_FAINT_SOUTH
targets['DESI_TARGET'] |= (bgs_faint != 0) * self.desi_mask.BGS_ANY

targets['OBSCONDITIONS'] |= (bgs_faint != 0) * self.obsconditions.mask(
self.bgs_mask.BGS_FAINT.obsconditions)
targets['OBSCONDITIONS'] |= (bgs_faint != 0) * self.obsconditions.mask(
self.bgs_mask.BGS_FAINT_SOUTH.obsconditions)
targets['OBSCONDITIONS'] |= (bgs_faint != 0) * self.obsconditions.mask(
self.desi_mask.BGS_ANY.obsconditions)
#targets['OBSCONDITIONS'] |= (bgs_faint != 0) * self.obsconditions.mask(
# self.bgs_mask.BGS_FAINT.obsconditions)
#targets['OBSCONDITIONS'] |= (bgs_faint != 0) * self.obsconditions.mask(
# self.bgs_mask.BGS_FAINT_SOUTH.obsconditions)
#targets['OBSCONDITIONS'] |= (bgs_faint != 0) * self.obsconditions.mask(
# self.desi_mask.BGS_ANY.obsconditions)

truth['CONTAM_TARGET'] |= (bgs_faint != 0) * self.contam_mask.BGS_IS_STAR
truth['CONTAM_TARGET'] |= (bgs_faint != 0) * self.contam_mask.BGS_CONTAM
Expand All @@ -2437,10 +2437,10 @@ def select_contaminants(self, targets, truth):
targets['DESI_TARGET'] |= (elg != 0) * self.desi_mask.ELG
targets['DESI_TARGET'] |= (elg != 0) * self.desi_mask.ELG_SOUTH

targets['OBSCONDITIONS'] |= (elg != 0) * self.obsconditions.mask(
self.desi_mask.ELG.obsconditions)
targets['OBSCONDITIONS'] |= (elg != 0) * self.obsconditions.mask(
self.desi_mask.ELG_SOUTH.obsconditions)
#targets['OBSCONDITIONS'] |= (elg != 0) * self.obsconditions.mask(
# self.desi_mask.ELG.obsconditions)
#targets['OBSCONDITIONS'] |= (elg != 0) * self.obsconditions.mask(
# self.desi_mask.ELG_SOUTH.obsconditions)

truth['CONTAM_TARGET'] |= (elg != 0) * self.contam_mask.ELG_IS_STAR
truth['CONTAM_TARGET'] |= (elg != 0) * self.contam_mask.ELG_CONTAM
Expand All @@ -2451,10 +2451,10 @@ def select_contaminants(self, targets, truth):
targets['DESI_TARGET'] |= (lrg != 0) * self.desi_mask.LRG
targets['DESI_TARGET'] |= (lrg != 0) * self.desi_mask.LRG_SOUTH

targets['OBSCONDITIONS'] |= (lrg != 0) * self.obsconditions.mask(
self.desi_mask.LRG.obsconditions)
targets['OBSCONDITIONS'] |= (lrg != 0) * self.obsconditions.mask(
self.desi_mask.LRG_SOUTH.obsconditions)
#targets['OBSCONDITIONS'] |= (lrg != 0) * self.obsconditions.mask(
# self.desi_mask.LRG.obsconditions)
#targets['OBSCONDITIONS'] |= (lrg != 0) * self.obsconditions.mask(
# self.desi_mask.LRG_SOUTH.obsconditions)

truth['CONTAM_TARGET'] |= (lrg != 0) * self.contam_mask.LRG_IS_STAR
truth['CONTAM_TARGET'] |= (lrg != 0) * self.contam_mask.LRG_CONTAM
Expand All @@ -2465,10 +2465,10 @@ def select_contaminants(self, targets, truth):
targets['DESI_TARGET'] |= (qso != 0) * self.desi_mask.QSO
targets['DESI_TARGET'] |= (qso != 0) * self.desi_mask.QSO_SOUTH

targets['OBSCONDITIONS'] |= (qso != 0) * self.obsconditions.mask(
self.desi_mask.QSO.obsconditions)
targets['OBSCONDITIONS'] |= (qso != 0) * self.obsconditions.mask(
self.desi_mask.QSO_SOUTH.obsconditions)
#targets['OBSCONDITIONS'] |= (qso != 0) * self.obsconditions.mask(
# self.desi_mask.QSO.obsconditions)
#targets['OBSCONDITIONS'] |= (qso != 0) * self.obsconditions.mask(
# self.desi_mask.QSO_SOUTH.obsconditions)

truth['CONTAM_TARGET'] |= (qso != 0) * self.contam_mask.QSO_IS_STAR
truth['CONTAM_TARGET'] |= (qso != 0) * self.contam_mask.QSO_CONTAM
Expand Down Expand Up @@ -2632,18 +2632,18 @@ def _isMWS_MAIN_VERY_FAINT(rflux):

targets['MWS_TARGET'] |= (mws_main != 0) * self.mws_mask.mask('MWS_MAIN')
targets['DESI_TARGET'] |= (mws_main != 0) * self.desi_mask.MWS_ANY
targets['OBSCONDITIONS'] |= (mws_main != 0) * self.obsconditions.mask(
self.mws_mask.MWS_MAIN.obsconditions)
targets['OBSCONDITIONS'] |= (mws_main != 0) * self.obsconditions.mask(
self.desi_mask.MWS_ANY.obsconditions)
#targets['OBSCONDITIONS'] |= (mws_main != 0) * self.obsconditions.mask(
# self.mws_mask.MWS_MAIN.obsconditions)
#targets['OBSCONDITIONS'] |= (mws_main != 0) * self.obsconditions.mask(
# self.desi_mask.MWS_ANY.obsconditions)

mws_main_very_faint = _isMWS_MAIN_VERY_FAINT(rflux=rflux)
targets['MWS_TARGET'] |= (mws_main_very_faint != 0) * self.mws_mask.mask('MWS_MAIN_VERY_FAINT')
targets['DESI_TARGET'] |= (mws_main_very_faint != 0) * self.desi_mask.MWS_ANY
targets['OBSCONDITIONS'] |= (mws_main_very_faint != 0) * self.obsconditions.mask(
self.mws_mask.MWS_MAIN_VERY_FAINT.obsconditions)
targets['OBSCONDITIONS'] |= (mws_main_very_faint != 0) * self.obsconditions.mask(
self.desi_mask.MWS_ANY.obsconditions)
#targets['OBSCONDITIONS'] |= (mws_main_very_faint != 0) * self.obsconditions.mask(
# self.mws_mask.MWS_MAIN_VERY_FAINT.obsconditions)
#targets['OBSCONDITIONS'] |= (mws_main_very_faint != 0) * self.obsconditions.mask(
# self.desi_mask.MWS_ANY.obsconditions)

# Select standard stars.
self.select_standards(targets, truth, boss_std=boss_std)
Expand Down Expand Up @@ -2965,10 +2965,10 @@ def select_targets(self, targets, truth, **kwargs):

targets['MWS_TARGET'] |= (mws_nearby != 0) * self.mws_mask.mask('MWS_NEARBY')
targets['DESI_TARGET'] |= (mws_nearby != 0) * self.desi_mask.MWS_ANY
targets['OBSCONDITIONS'] |= (mws_nearby != 0) * self.obsconditions.mask(
self.mws_mask.MWS_NEARBY.obsconditions)
targets['OBSCONDITIONS'] |= (mws_nearby != 0) * self.obsconditions.mask(
self.desi_mask.MWS_ANY.obsconditions)
#targets['OBSCONDITIONS'] |= (mws_nearby != 0) * self.obsconditions.mask(
# self.mws_mask.MWS_NEARBY.obsconditions)
#targets['OBSCONDITIONS'] |= (mws_nearby != 0) * self.obsconditions.mask(
# self.desi_mask.MWS_ANY.obsconditions)

class WDMaker(SelectTargets):
"""Read WD mocks, generate spectra, and select targets.
Expand Down Expand Up @@ -3156,16 +3156,16 @@ def select_targets(self, targets, truth, **kwargs):

targets['MWS_TARGET'] |= (mws_wd != 0) * self.mws_mask.mask('MWS_WD')
targets['DESI_TARGET'] |= (mws_wd != 0) * self.desi_mask.MWS_ANY
targets['OBSCONDITIONS'] |= (mws_wd != 0) * self.obsconditions.mask(
self.mws_mask.MWS_WD.obsconditions)
targets['OBSCONDITIONS'] |= (mws_wd != 0) * self.obsconditions.mask(
self.desi_mask.MWS_ANY.obsconditions)
#targets['OBSCONDITIONS'] |= (mws_wd != 0) * self.obsconditions.mask(
# self.mws_mask.MWS_WD.obsconditions)
#targets['OBSCONDITIONS'] |= (mws_wd != 0) * self.obsconditions.mask(
# self.desi_mask.MWS_ANY.obsconditions)

# Select STD_WD; cut just on g-band magnitude (not TEMPLATESUBTYPE!)
std_wd = (truth['MAG'] <= 19.0) * 1 # SDSS g-band!
targets['DESI_TARGET'] |= (std_wd !=0) * self.desi_mask.mask('STD_WD')
targets['OBSCONDITIONS'] |= (std_wd != 0) * self.obsconditions.mask(
self.desi_mask.STD_WD.obsconditions)
#targets['OBSCONDITIONS'] |= (std_wd != 0) * self.obsconditions.mask(
# self.desi_mask.STD_WD.obsconditions)

class SKYMaker(SelectTargets):
"""Read SKY mocks, generate spectra, and select targets.
Expand Down Expand Up @@ -3301,5 +3301,5 @@ def select_targets(self, targets, truth, **kwargs):
"""
targets['DESI_TARGET'] |= self.desi_mask.mask('SKY')
targets['OBSCONDITIONS'] |= self.obsconditions.mask(
self.desi_mask.SKY.obsconditions)
#targets['OBSCONDITIONS'] |= self.obsconditions.mask(
# self.desi_mask.SKY.obsconditions)

0 comments on commit 4a58e54

Please sign in to comment.