pypeit.core.atmextinction module

Atmospheric extinction class

class pypeit.core.atmextinction.AtmosphericExtinction(wave, mag_ext, assume_sorted=True, file=None)[source]

Bases: object

Class 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 sorted

  • file (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 wave and mag_ext is 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.

Parameters:
  • longitude (float) – Geocentric longitude in degrees.

  • latitude (float) – Geocentric latitude in degrees.

  • toler (float, optional) – Tolerance for matching detector to site in degrees

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; see correction_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 ivar is 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:

numpy.ndarray

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.

Parameters:
  • longitude (float) – Geocentric longitude in degrees.

  • latitude (float) – Geocentric latitude in degrees.

  • toler (float, optional) – Tolerance for matching detector to site in degrees

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.