# firefly dust¶

This class handles dust corrections in the FIREFLY fitting process.

firefly_dust.curve_smoother(x, y, smoothing_length)[source]

Smoothes a curve y = f(x) with a running median over a given smoothing length.

Returns the smoothed array.

Used internally in function determine_attenuation

Parameters: x – x y – y smoothing_length – smoothing length in the same unit than x.
firefly_dust.determine_attenuation(wave, data_flux, error_flux, model_flux, SPM, age, metal)[source]
Determines the dust attenuation to be applied to the models based on the data.
1. high pass filters the data and the models : makes hpf_model and hpf_data
1. normalises the hpf_models to the median hpf_data
1. fits the hpf models to data : chi2 maps
Parameters: wave – wavelength data_flux – data flux error_flux – error flux model_flux – model flux SPM – SPM StellarPopulationModel object age – age metal – metallicity
firefly_dust.eq2gal(ra, dec)[source]

Convert Equatorial coordinates to Galactic Coordinates in the epch J2000.

Keywords arguments: ra – Right Ascension (in radians) dec – Declination (in radians)

Return a tuple (l, b): l – Galactic longitude (in radians) b – Galactic latitude (in radians)

firefly_dust.get_SFD_dust(long, lat, dustmap='ebv', interpolate=True)[source]

Gets map values from Schlegel, Finkbeiner, and Davis 1998 extinction maps.

dustmap can either be a filename (if ‘%s’ appears in the string, it will be replaced with ‘ngp’ or ‘sgp’), or one of:

• ‘i100’
100-micron map in MJy/Sr
• ‘x’
X-map, temperature-correction factor
• ‘t’
Temperature map in degrees Kelvin for n=2 emissivity
• ‘ebv’
E(B-V) in magnitudes

For these forms, the files are assumed to lie in the current directory.

Input coordinates are in degrees of galactic latiude and logitude - they can be scalars or arrays.

if interpolate is an integer, it can be used to specify the order of the interpolating polynomial

firefly_dust.get_dust_radec(ra, dec, dustmap, interpolate=True)[source]

Gets the value of dust from MW at ra and dec.

firefly_dust.hpf(flux, windowsize=0, w_start=0)[source]

What does this one do ? High pass filtering ?

firefly_dust.reddening_ccm(wave, ebv=None, a_v=None, r_v=3.1, model='ccm89')[source]
Not used in FIREFLY Determines a CCM reddening curve.
wave: ~numpy.ndarray
wavelength in Angstroms

flux: ~numpy.ndarray ebv: float

E(B-V) differential extinction; specify either this or a_v.
a_v: float
A(V) extinction; specify either this or ebv.
r_v: float, optional
defaults to standard Milky Way average of 3.1
model: {‘ccm89’, ‘gcc09’}, optional
• ‘ccm89’ is the default Cardelli, Clayton, & Mathis (1989) [1]_, but does include the O’Donnell (1994) parameters to match IDL astrolib.
• ‘gcc09’ is Gordon, Cartledge, & Clayton (2009) [2]_. This paper has incorrect parameters for the 2175A bump; not yet corrected here.
reddening_curve: ~numpy.ndarray
Multiply to deredden flux, divide to redden.

Cardelli, Clayton, & Mathis (1989) [1]_ parameterization is used for all models. The default parameter values are from CCM except in the optical range, where the updated parameters of O’Donnell (1994) [3]_ are used (matching the Goddard IDL astrolib routine CCM_UNRED).

The function is works between 910 A and 3.3 microns, although note the default ccm89 model is scientifically valid only at >1250 A.

Model gcc09 uses the updated UV coefficients of Gordon, Cartledge, & Clayton (2009) [2]_, and is valid from 910 A to 3030 A. This function will use CCM89 at longer wavelengths if GCC09 is selected, but note that the two do not connect perfectly smoothly. There is a small discontinuity at 3030 A. Note that GCC09 equations 14 and 15 apply to all x>5.9 (the GCC09 paper mistakenly states they do not apply at x>8; K. Gordon, priv. comm.).

[1] Cardelli, J. A., Clayton, G. C., & Mathis, J. S. 1989, ApJ, 345, 245 [2] Gordon, K. D., Cartledge, S., & Clayton, G. C. 2009, ApJ, 705, 1320 [3] O’Donnell, J. E. 1994, ApJ, 422, 158O

firefly_dust.reddening_fm(wave, ebv=None, a_v=None, r_v=3.1, model='f99')[source]

Determines a Fitzpatrick & Massa reddening curve.

wave: ~numpy.ndarray
wavelength in Angstroms
ebv: float
E(B-V) differential extinction; specify either this or a_v.
a_v: float
A(V) extinction; specify either this or ebv.
r_v: float, optional
defaults to standard Milky Way average of 3.1
model: {‘f99’, ‘fm07’}, optional
• ‘f99’ is the default Fitzpatrick (1999) [1]_
• ‘fm07’ is Fitzpatrick & Massa (2007) [2]_. Currently not R dependent.
reddening_curve: ~numpy.ndarray
Multiply to deredden flux, divide to redden.

Uses Fitzpatrick (1999) [1]_ by default, which relies on the UV parametrization of Fitzpatrick & Massa (1990) [2]_ and spline fitting in the optical and IR. This function is defined from 910 A to 6 microns, but note the claimed validity goes down only to 1150 A. The optical spline points are not taken from F99 Table 4, but rather updated versions from E. Fitzpatrick (this matches the Goddard IDL astrolib routine FM_UNRED).

The fm07 model uses the Fitzpatrick & Massa (2007) [3]_ parametrization, which has a slightly different functional form. That paper claims it preferable, although it is unclear if signficantly (Gordon et al. 2009) [4]_. It is not the literature standard, so not default here.

[1] Fitzpatrick, E. L. 1999, PASP, 111, 63 [2] Fitpatrick, E. L. & Massa, D. 1990, ApJS, 72, 163 [3] Fitpatrick, E. L. & Massa, D. 2007, ApJ, 663, 320 [4] Gordon, K. D., Cartledge, S., & Clayton, G. C. 2009, ApJ, 705, 1320

firefly_dust.unred(wave, ebv, R_V=3.1, LMC2=False, AVGLMC=False)[source]

Deredden a flux vector using the Fitzpatrick (1999) parameterization

wave
: array
Wavelength in Angstrom
flux
: array
Calibrated flux vector, same number of elements as wave.
ebv
: float, optional
Color excess E(B-V). If a negative ebv is supplied, then fluxes will be reddened rather than dereddened. The default is 3.1.
AVGLMC
: boolean
If True, then the default fit parameters c1,c2,c3,c4,gamma,x0 are set to the average values determined for reddening in the general Large Magellanic Cloud (LMC) field by Misselt et al. (1999, ApJ, 515, 128). The default is False.
LMC2
: boolean
If True, the fit parameters are set to the values determined for the LMC2 field (including 30 Dor) by Misselt et al. Note that neither AVGLMC nor LMC2 will alter the default value of R_V, which is poorly known for the LMC.
new_flux
: array
Dereddened flux vector, same units and number of elements as input flux.

Note

This function was ported from the IDL Astronomy User’s Library.

IDL - Documentation:

PURPOSE:

Deredden a flux vector using the Fitzpatrick (1999) parameterization

EXPLANATION:

The R-dependent Galactic extinction curve is that of 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.

CALLING SEQUENCE:
FM_UNRED, wave, flux, ebv, [ funred, R_V = , /LMC2, /AVGLMC, ExtCurve=

gamma =, x0=, c1=, c2=, c3=, c4= ]

INPUT:

WAVE - wavelength vector (Angstroms) FLUX - calibrated flux vector, same number of elements as WAVE

If only 3 parameters are supplied, then this vector will updated on output to contain the dereddened flux.

EBV - color excess E(B-V), scalar. If a negative EBV is supplied,

then fluxes will be reddened rather than dereddened.

OUTPUT:
FUNRED - unreddened flux vector, same units and number of elements

as FLUX

OPTIONAL INPUT KEYWORDS
R_V - scalar specifying the ratio of total to selective extinction

R(V) = A(V) / E(B - V). If not specified, then R = 3.1 Extreme values of R(V) range from 2.3 to 5.3

/AVGLMC - if set, then the default fit parameters c1,c2,c3,c4,gamma,x0

are set to the average values determined for reddening in the general Large Magellanic Cloud (LMC) field by Misselt et al. (1999, ApJ, 515, 128)

/LMC2 - if set, then the fit parameters are set to the values determined

for the LMC2 field (including 30 Dor) by Misselt et al. Note that neither /AVGLMC or /LMC2 will alter the default value of R_V which is poorly known for the LMC.

The following five input keyword parameters allow the user to customize the adopted extinction curve. For example, see Clayton et al. (2003, ApJ, 588, 871) for examples of these parameters in different interstellar environments.

x0 - Centroid of 2200 A bump in microns (default = 4.596) gamma - Width of 2200 A bump in microns (default =0.99) c3 - Strength of the 2200 A bump (default = 3.23) c4 - FUV curvature (default = 0.41) c2 - Slope of the linear UV extinction component

(default = -0.824 + 4.717/R)

c1 - Intercept of the linear UV extinction component

(default = 2.030 - 3.007*c2