From 95fcfa56aa4fc0a400e881141db962292f0e163c Mon Sep 17 00:00:00 2001 From: Julien Guy Date: Mon, 9 Oct 2023 10:06:30 -0700 Subject: [PATCH] add option to remove the flatfield correction when averaging the flux calibration --- bin/desi_average_flux_calibration | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/bin/desi_average_flux_calibration b/bin/desi_average_flux_calibration index 37e4fb14f..9b170f9cf 100755 --- a/bin/desi_average_flux_calibration +++ b/bin/desi_average_flux_calibration @@ -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() @@ -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__': @@ -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() @@ -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