Skip to content

Commit

Permalink
Merge 7270354 into 485f856
Browse files Browse the repository at this point in the history
  • Loading branch information
sbailey committed Feb 22, 2024
2 parents 485f856 + 7270354 commit 54f4e9b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion py/desispec/scripts/zcatalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,33 @@ def read_redrock(rrfile, group=None, recoadd_fibermap=False, minimal=False, pert
fibermap_orig = read_table(spectra_filename)
fibermap, expfibermap = coadd_fibermap(fibermap_orig, onetile=pertile)
else:
fibermap = fx['FIBERMAP'].read()
fibermap = Table(fx['FIBERMAP'].read())
expfibermap = fx['EXP_FIBERMAP'].read()

tsnr2 = fx['TSNR2'].read()
assert np.all(redshifts['TARGETID'] == fibermap['TARGETID'])
assert np.all(redshifts['TARGETID'] == tsnr2['TARGETID'])

if minimal:
# basic set of target information
fmcols = ['TARGET_RA', 'TARGET_DEC', 'FLUX_G', 'FLUX_R', 'FLUX_Z']

# add targeting columns
for colname in fibermap.dtype.names:
if colname.endswith('_TARGET') and colname != 'FA_TARGET':
fmcols.append(colname)

# add columns needed for uniqueness that differ for healpix vs. tiles
extracols = ['TILEID', 'LASTNIGHT', 'HEALPIX', 'SURVEY', 'PROGRAM']
for colname in extracols:
if colname in fibermap.dtype.names:
fmcols.append(colname)

# NIGHT header -> fibermap LASTNIGHT
if ('LASTNIGHT' not in fmcols) and ('NIGHT' in hdr):
fibermap['LASTNIGHT'] = np.int32(hdr['NIGHT'])
fmcols.append('LASTNIGHT')

data = hstack( [Table(redshifts), Table(fibermap[fmcols])] )

else:
Expand Down

0 comments on commit 54f4e9b

Please sign in to comment.