pypeit.core.atmextinction module
Atmospheric extinction class
- class pypeit.core.atmextinction.AtmosphericExtinction(wave, mag_ext, assume_sorted=True, file=None)[source]
Bases:
objectClass used to load, generate, and apply atmospheric extinction curves.
- Parameters:
wave (array-like) – Vacuum wavelengths in angstroms
mag_ext (array-like) – Magnitudes of extinction at 1 airmass. Must be the same length as
wave.assume_sorted (
bool, optional) – Assume the wavelength vector is sortedfile (str, optional) – Used for informational purposes only. If the data were read from a file, this provides the name of the source file.
- Raises:
PypeItError : – Raised if the length of
waveandmag_extis not identical, or if they are multidimensional.
- static closest_extinction_file(longitude, latitude, toler=5.0)[source]
Find the extinction reference file provided by PypeIt that is closest to the provided coordinates.
- static correct(flux, factor, ivar=None)[source]
Correct a spectrum for atmospheric extinction.
- Parameters:
flux (array-like) – Flux values.
factor (array-like) – The correction factor to apply: correct flux = flux * factor. Shape must match
flux; seecorrection_factor().ivar (array-like, optional) – Inverse variance in the flux. Shape must match
flux. If None, uncertainties are not returned.
- Returns:
corrected_flux (numpy.ndarray) – The corrected fluxes
corrected_ivar (numpy.ndarray) – Inverse variances of the corrected flux. If
ivaris None, this is not returned.
- correction_factor(wave, airmass=1.0)[source]
Return the multiplicative correction factor to apply to fluxes to remove atmospheric extinction.
Warning
Spectral regions outside of the bounds of the atmospheric extinction curve are set to the nearest value.
- Parameters:
wave (array-like) – Vacuum wavelengths of the observed spectrum.
airmass (float, optional) – Airmass of the observation
- Returns:
The correction factor at each wavelength. Shape matches
wave.- Return type:
- classmethod from_coordinates(longitude, latitude, toler=5.0)[source]
Instantiate the class using the most appropriate extinction curve given the available curves provided by PypeIt.
- classmethod from_file(extinct_file)[source]
Load an extinction curve from a file.
- Parameters:
extinct_file (
str) – Name of a local file or a file distributed by PypeIt.
- property size
Return the length of the extinction curve.