mangadap.util.extinction module
Provides a set of utility functions to deal with dust extinction.
Copyright © 2019, SDSS-IV/MaNGA Pipeline Group
- class mangadap.util.extinction.AvgLMCExtinctionCoefficients[source]
Bases:
FMExtinctionCoefficients
- class mangadap.util.extinction.FMExtinctionCoefficients(k0, gamma, c1, c2, c3, c4)[source]
Bases:
object
- class mangadap.util.extinction.GalacticExtinction(form='ODonnell', wave=None, ebv=None, rv=None, coeffs=None)[source]
Bases:
object
Class that uses the above functions to compute and apply the Galactic reddening curve according to the desired form.
- Parameters:
form (str) – (Optional) The form of the reddening curve to adopt. The default is ‘ODonnell’
wave (numpy.ndarray) – (Optional) The wavelengths for the computation of the reddening vector to compute. Default is to leave the vector undefined.
ebv (float) – (Optional) E(B-V) reddening used to normalize the curve. Default is to leave the vector undefined.
rv (float) –
(Optional) Ratio of V-band extinction to the B-V reddening:
\[R_V = \frac{A_V}{E(B-V)}\]Default value depends on the requested form. For ‘FM’, ‘CCM’, and ‘ODonnell’, the default is 3.1 (typical for the diffuse ISM of the Milky Way); for ‘Calzetti’, it is 4.05.
coeffs (
FMExtinctionCoefficients
) – (Optional) Object with the coefficients to use for the extinction curve if the form is ‘FM’. If the form is not ‘FM’, these coefficients are ignored (and should be provided as None). If the form is ‘FM’ and coeffs=None, the default is to use the \(R_V\) dependent coefficients defined using theFMExtinctionCoefficients.from_Rv()
class method.
- Raises:
ValueError – Raised if form is not a known form.
- apply(flux, ivar=None, err=None, deredden=True)[source]
Redden or deredden the provided flux array using the existing reddening correction vector.
If flux has a dimensionality larger than 1, it is assumed that the spectra are organized along the last axis and the reddening correction is applied to all spectra in the array.
If ivar is provided, the error is propagated.
- Parameters:
flux (numpy.ndarray) – The flux array to correct.
ivar (numpy.ndarray) – (Optional) The flux inverse variance to use for the error propagation. If provided, inverse variance in the flux array will be returned. If provided, cannot provide 1-sigma errors.
err (numpy.ndarray) – (Optional) The 1-siga errors in the flux to use for the error propagation. If provided, errors in the flux array will be returned. If provided, cannot provide inverse variance.
deredden (bool) – (Optional) Flag to deredden the spectrum; if set to false, the function will instead redden the provided fluxes.
- Returns:
Returns the reddened flux array, and the inverse variance if ivar is provided.
- Return type:
numpy.ndarray
- Raises:
ValueError – Raised if the internal reddening correction vector is not defined, if the entered flux and ivar arrays do not have the same shape, or if the number of wavelength channels in flux does not match the expected number based on the length of
redcorr
.
- compute(wave, ebv, rv=None, coeffs=None)[source]
Compute the reddening curve of the desired form.
- Parameters:
wave (numpy.ndarray) – The wavelengths for the computation of the reddening correction to compute.
ebv (float) – E(B-V) reddening used to normalize the curve.
rv (float) –
(Optional) Ratio of V-band extinction to the B-V reddening:
\[R_V = \frac{A_V}{E(B-V)}\]Default value depends on the requested form. For ‘FM’, ‘CCM’, and ‘ODonnell’, the default is 3.1 (typical for the diffuse ISM of the Milky Way); for ‘Calzetti’, it is 4.05.
coeffs (
FMExtinctionCoefficients
) – (Optional) Object with the coefficients to use for the extinction curve if the form is ‘FM’. If the form is not ‘FM’, these coefficients are ignored (and should be provided as None). If the form is ‘FM’ and coeffs=None, the default is to use the \(R_V\) dependent coefficients defined using theFMExtinctionCoefficients.from_Rv()
class method.
- Returns:
Vector with the extinction at every provided wavelength.
- Return type:
numpy.ndarray
- static valid_forms()[source]
Returns a list keyword for the allowed reddening curves forms implemented within the
GalacticExtinction
class.
- class mangadap.util.extinction.LMC2ExtinctionCoefficients[source]
Bases:
FMExtinctionCoefficients
- mangadap.util.extinction.reddening_vector_calzetti(wave, ebv, rv=None)[source]
Return the Calzetti et al. (2000) reddening vector.
- Parameters:
wave (array-like) – Wavelengths at which to calculate the reddening vector curve in angstroms.
ebv (float) – E(B-V) reddening used to normalize the curve.
rv (float) –
(Optional) Ratio of V-band extinction to the B-V reddening:
\[R_V = \frac{A_V}{E(B-V)}\]Default is 4.05. Typical value for the diffuse ISM of the Milky Way is 3.1.
- Returns:
One-dimensional masked array with the reddening vector that can be used deredden a spectrum by calculating:
\[F(\lambda) = a(\lambda) f(\lambda)\]where \(a\) is the vector returned by this function, \(f\) is the observed flux, and \(F\) is the dereddened flux.
- Return type:
numpy.ma.MaskedArray
- mangadap.util.extinction.reddening_vector_ccm(wave, ebv, rv=None, original=False)[source]
Return the reddening vector based on Cardelli, Clayton, and Mathis (1989 ApJ. 345, 245), including the update for the near-UV given by O’Donnell (1994, ApJ, 422, 158). Parameterization is valid from the IR to the far-UV (3.5 microns to 0.1 microns).
- Parameters:
wave (array-like) – Wavelengths at which to calculate the reddening vector in angstroms.
ebv (float) – E(B-V) reddening used to normalize the curve.
rv (float) –
(Optional) Ratio of V-band extinction to the B-V reddening:
\[R_V = \frac{A_V}{E(B-V)}\]Default is the typical value for the diffuse ISM of the Milky Way, \(R_V = 3.1\).
original (bool) – (Optional) Use the original coefficients from CCM89 instead of the updated coefficients from O’Donnell (1994). Default is to use the updated coefficients.
- Returns:
One-dimensional masked array with the reddening vector that can be used deredden a spectrum by calculating:
\[F(\lambda) = a(\lambda) f(\lambda)\]where \(a\) is the vector returned by this function, \(f\) is the observed flux, and \(F\) is the dereddened flux.
- Return type:
numpy.ma.MaskedArray
- mangadap.util.extinction.reddening_vector_fm(wave, ebv, rv=None, coeffs=None)[source]
Return the reddening vector based on Fitzpatrick & Massa (Fitzpatrick, 1999, PASP, 111, 63; astro-ph/9809387 ). Parameterization is valid from the IR to the far-UV (3.5 microns to 0.1 microns). UV extinction curve is extrapolated down to 912 Angstroms.
- Parameters:
wave (array-like) – Wavelengths at which to calculate the reddening vector in angstroms.
ebv (float) – E(B-V) reddening used to normalize the curve.
rv (float) –
(Optional) Ratio of V-band extinction to the B-V reddening:
\[R_V = \frac{A_V}{E(B-V)}\]Default is the typical value for the diffuse ISM of the Milky Way, \(R_V = 3.1\).
coeffs (
FMExtinctionCoefficients
) – (Optional) Object with the coefficients to use for the extinction curve. Default is to use the \(R_V\) dependent coefficients defined using theFMExtinctionCoefficients.from_Rv()
class method.
- Returns:
One-dimensional masked array with the reddening vector that can be used deredden a spectrum by calculating:
\[F(\lambda) = a(\lambda) f(\lambda)\]where \(a\) is the vector returned by this function, \(f\) is the observed flux, and \(F\) is the dereddened flux.
- Return type:
numpy.ma.MaskedArray