Skip to content

Commit

Permalink
special-case the cmx targeting bits
Browse files Browse the repository at this point in the history
  • Loading branch information
moustakas committed Jan 23, 2023
1 parent 8dbd425 commit 71d4688
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions py/fastspecfit/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,21 @@ def select(self, redrockfiles, zmin=0.001, zmax=None, zwarnmax=None,
# QSO for RR.
zb['Z_RR'] = zb['Z'] # add it at the end
if use_qn:
[desi_target, bgs_target, mws_target], [desi_mask, bgs_mask, mws_mask], surv = main_cmx_or_sv(meta)
IQSO = np.where(meta[desi_target] & desi_mask['QSO'] != 0)[0]
surv_target, surv_mask, surv = main_cmx_or_sv(meta)
if surv == 'cmx':
desi_target = surv_target[0]
desi_mask = surv_mask[0]
# need to check multiple QSO masks
IQSO = []
for bitname in desi_mask.names():
if 'QSO' in bitname:
IQSO.append(np.where(meta[desi_target] & desi_mask[bitname] != 0)[0])
if len(IQSO) > 0:
IQSO = np.sort(np.unique(np.hstack(IQSO)))
else:
desi_target, bgs_target, mws_target = surv_target
desi_mask, bgs_mask, mws_mask = surv_mask
IQSO = np.where(meta[desi_target] & desi_mask['QSO'] != 0)[0]
if len(IQSO) > 0:
qn = Table(fitsio.read(qnfile, 'QN_RR', rows=fitindx[IQSO], columns=QNCOLS))
assert(np.all(qn['TARGETID'] == meta['TARGETID'][IQSO]))
Expand Down

0 comments on commit 71d4688

Please sign in to comment.