Skip to content

Commit

Permalink
change order in which DESINAME is computed
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed May 7, 2024
1 parent bd38532 commit 5aeb60b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions py/desispec/io/fibermap.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,10 +729,6 @@ def assemble_fibermap(night, expid, badamps=None, badfibers_filename=None,
log.debug("Adding PLATE_DEC column.")
fa['PLATE_DEC'] = fa['TARGET_DEC']

if 'DESINAME' not in fa.colnames:
log.debug("Adding DESINAME column.")
fa['DESINAME'] = radec_to_desiname(fa['TARGET_RA'], fa['TARGET_DEC'])

#- also read extra keywords from HDU 0
fa_hdr0 = fits.getheader(fafile, 0)
if 'OUTDIR' in fa_hdr0:
Expand Down Expand Up @@ -1006,6 +1002,13 @@ def assemble_fibermap(night, expid, badamps=None, badfibers_filename=None,
fibermap[fmcol][ii] = fibermap[pmcol][ii]
log.info(f"Switching {np.sum(ii)} NaNs from {fmcol}->{pmcol} value")

#
# Compute this after NaN have been replaced in TARGET_RA, TARGET_DEC.
#
if 'DESINAME' not in fibermap.colnames:
log.debug("Adding DESINAME column.")
fibermap['DESINAME'] = radec_to_desiname(fibermap['TARGET_RA'], fibermap['TARGET_DEC'])

#- Update SKY and STD target bits to be in both CMX_TARGET and DESI_TARGET
#- i.e. if they are set in one, also set in the other. Ditto for SV*
for targetcol in ['CMX_TARGET', 'SV0_TARGET', 'SV1_TARGET', 'SV2_TARGET']:
Expand Down

0 comments on commit 5aeb60b

Please sign in to comment.