OttoStruve / muler

A Python package for working with pipeline-produced spectra from IGRINS, HPF, and Keck NIRSPEC
https://muler.readthedocs.io
MIT License
15 stars 9 forks source link

Subtle Error propagation considerations #11

Closed gully closed 3 years ago

gully commented 3 years ago

Sky subtraction with the HPF sky fiber is a little subtle for two reasons:

  1. The target and sky fibers have slightly different wavelength solutions. For non-PRV applications those differences may be negligible.
  2. Subtracting a noise-free array from a Spectrum1D object does not propagate uncertainty, whereas subtracting a Spectrum1D from another Spectrum1D does propagate the uncertainty.
target_spectrum = HPFSpectrum(file=file, order=15)
sky_spectrum = HPFSpectrum(file=file, order=15, sky=True)

sky_free_spectrum = target_spectrum.sky_subtract(sky_spectrum.flux)

sky_free_spectrum_alt = target_spectrum - sky_spectrum

I think the bottom line accounts for both effects, but I'm not sure about how it does the wavelength interpolation.

gully commented 3 years ago

The new .sky_subtract() method introduced today solves this Issue, at least for that one method. We will continue to look for places where error propagation falls short.