Skip to content

Commit cd0bfad

Browse files
authored
Merge pull request #2454 from desihub/rongpu-fluxcalib
Fix fiber aperture correction: normalization and sky fibers
2 parents 0d7d1f2 + a4c3bac commit cd0bfad

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

py/desispec/fiberfluxcorr.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,16 @@ def flat_to_psf_flux_correction(fibermap,exposure_seeing_fwhm=1.1) :
7070
# fiber flat correction is larger
7171
# have to divide by isotropic_platescale^2
7272
ok = (fiber_frac>0.01)
73+
skyfibers = fibermap["OBJTYPE"]=="SKY"
74+
ok &= (~skyfibers) # also exclude sky fibers from the point_source_correction calculation
7375
point_source_correction = np.zeros(x_mm.shape)
7476
point_source_correction[ok] = 1./fiber_frac[ok]/isotropic_platescale[ok]**2
7577

76-
# normalize to one because this is a relative correction here
77-
point_source_correction[ok] /= np.mean(point_source_correction[ok])
78+
# normalize to one because this is a relative correction here; use median to be robust against outliers
79+
point_source_correction[ok] /= np.median(point_source_correction[ok])
80+
81+
# set the correction factor to 1 for sky fibers; other low-fiber_frac fibers have value 0.
82+
point_source_correction[skyfibers] = 1.
7883

7984
return point_source_correction
8085

0 commit comments

Comments
 (0)