Skip to content

Commit

Permalink
add option to remove the flatfield correction when averaging the flux…
Browse files Browse the repository at this point in the history
… calibration
  • Loading branch information
julienguy committed Oct 9, 2023
1 parent 28fe73a commit 95fcfa5
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions bin/desi_average_flux_calibration
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def get_ffracflux_wave(seeing, ffracflux, wave, fac_wave_power):
Returns:
Fiber acceptance for seeing, normalized to ffracflux at 6500A
Comment:
GFA now provide ffrac for fiber_diameter=1.52", so no need to correct for different diameters
we do the normalization using fac_wave, and then to be interpolated to wave
we do the normalization using fac_wave, and then to be interpolated to wave
"""
#
desi = desimodel.io.load_desiparams()
Expand All @@ -61,7 +61,7 @@ def get_ffracflux_wave(seeing, ffracflux, wave, fac_wave_power):
ffracflux_wave /= ffracflux_wave[np.abs(fac_wave-6500).argmin()] # AR normalizing to 1 at 6500A
ffracflux_wave *= ffracflux # AR normalising to ffracflux[i] at 6500A
return np.interp(wave, fac_wave, ffracflux_wave) # AR interpolating on wave



if __name__ == '__main__':
Expand All @@ -78,6 +78,7 @@ if __name__ == '__main__':
parser.add_argument('--seeing_key', type = str, default = 'RADPROF_FWHM_ASEC', choices = ['FWHM_ASEC', 'RADPROF_FWHM_ASEC'], help = 'key in GFA catalog for seeing (default=RADPROF_FWHM_ASEC)')
parser.add_argument('--fac_wave_power', type = float, default = -0.25, help = 'wavelength dependence of fiber acceptance (default=-0.25)')
parser.add_argument('--first_night', type = int, default = None, help = 'first night for which this calibration is usable (default=None)')
parser.add_argument('--unflat', action='store_true', help="undo flatfield correction to get the variation of thru from spectro to spectro")

args = parser.parse_args()
log=get_logger()
Expand Down Expand Up @@ -152,6 +153,15 @@ if __name__ == '__main__':
log.error("calib has nan")
continue

if args.unflat :
ffilename=filename.replace("fluxcalib","fiberflatexp")
print("read",ffilename)
flat=fitsio.read(ffilename)
cal.calib *= flat




mcalib = np.median(cal.calib,axis=0)

# undo the heliocentric/barycentric correction
Expand Down

0 comments on commit 95fcfa5

Please sign in to comment.