mangadap.util.extinction module¶
Provides a set of utility functions to deal with dust extinction.
Revision history¶
02 Jun 2016: Original implementation by K. Westfall (KBW). Drawn from dust.py in David Wilkinson’s FIREFLY code, and the dereddening functions in IDLUTILS.14 Jul 2016: (KBW) Addedapply_reddening()
02 Dec 2016: (KBW) AddedGalacticExtinction
15 Sep 2017: (KBW) Allow to pass error instead of inverse variance toGalacticExtinction.apply()
.
Copyright © 2019, SDSSIV/MaNGA Pipeline Group

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(BV) reddening used to normalize the curve. Default is to leave the vector undefined.
 rv (float) –
(Optional) Ratio of Vband extinction to the BV reddening:
\[R_V = \frac{A_V}{E(BV)}\]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 1sigma errors.
 err (numpy.ndarray) – (Optional) The 1siga 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 ofredcorr
.

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(BV) reddening used to normalize the curve.
 rv (float) –
(Optional) Ratio of Vband extinction to the BV reddening:
\[R_V = \frac{A_V}{E(BV)}\]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.

mangadap.util.extinction.
reddening_vector_calzetti
(wave, ebv, rv=None)[source]¶ Return the Calzetti et al. (2000) reddening vector.
Parameters:  wave (arraylike) – Wavelengths at which to calculate the reddening vector curve in angstroms.
 ebv (float) – E(BV) reddening used to normalize the curve.
 rv (float) –
(Optional) Ratio of Vband extinction to the BV reddening:
\[R_V = \frac{A_V}{E(BV)}\]Default is 4.05. Typical value for the diffuse ISM of the Milky Way is 3.1.
Returns: Onedimensional 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 nearUV given by O’Donnell (1994, ApJ, 422, 158). Parameterization is valid from the IR to the farUV (3.5 microns to 0.1 microns).
Parameters:  wave (arraylike) – Wavelengths at which to calculate the reddening vector in angstroms.
 ebv (float) – E(BV) reddening used to normalize the curve.
 rv (float) –
(Optional) Ratio of Vband extinction to the BV reddening:
\[R_V = \frac{A_V}{E(BV)}\]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: Onedimensional 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; astroph/9809387 ). Parameterization is valid from the IR to the farUV (3.5 microns to 0.1 microns). UV extinction curve is extrapolated down to 912 Angstroms.
Parameters:  wave (arraylike) – Wavelengths at which to calculate the reddening vector in angstroms.
 ebv (float) – E(BV) reddening used to normalize the curve.
 rv (float) –
(Optional) Ratio of Vband extinction to the BV reddening:
\[R_V = \frac{A_V}{E(BV)}\]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: Onedimensional 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