Sky spectrum needs proper units
Opened this issue · 0 comments
astronomyk commented
The following code lines need fixing
If ATMO_BG_MAGNITUDE is given, the units of the EmissionCurve are ph/s/m2, and if ATMO_BG_MAGNITUDE is not given, the units are the original ones from the skycalc output, ph/s/um/m2/arcsec2. This means we get ridiculously high background fluxes.
Is it worth adding the test to the scale_spectrum_sb function?
sky_mag = self.cmds["ATMO_BG_MAGNITUDE"]
if sky_mag is not None and isinstance(sky_mag, (float, int)):
lam, val = scale_spectrum_sb(lam=lam, spec=val,
filter_name=self.cmds["INST_FILTER_TC"],
mag_per_arcsec=sky_mag,
pix_res=self.cmds.pix_res,
return_ec=False)
self.ec_atmo = sc.EmissionCurve(lam=lam, val=val,
pix_res=self.cmds.pix_res,
area=self.cmds.area,
units="ph/(s m2)",
airmass=self.cmds["ATMO_AIRMASS"])