DustExtinction.jl

DustExtinction.jl

Installation

From the REPL, press ] to enter Pkg mode

(v 1.1) pkg> add DustExtinction
[...]

julia> using DustExtinction

Usage

julia> using DustExtinction

Color laws

julia> ccm89(4000., 3.1)
1.4645557029425842

These laws can be applied across higher dimension arrays using the . operator

julia> ccm89.([4000., 5000.], 3.1)
2-element Array{Float64,1}:
 1.4645557029425842
 1.122246878899302

If you want to apply total extinction $A_V$ it's as simple as multiplcation

julia> a_v=0.3
0.3

julia> a_v * ccm89(4000., 3.1)
0.43936671088277524

Dust maps

julia> ENV["SFD98_DIR"] = "/home/user/data/dust"

# download maps (once)
julia> download_sfd98()

julia> dustmap = SFD98Map()
SFD98Map("/home/user/data/dust")

julia> ebv_galactic(dustmap, 0.1, 0.1)
0.793093095733043

julia> ebv_galactic(dustmap, [0.1, 0.2], [0.1, 0.2])
2-element Array{Float64,1}:
 0.793093
 0.539507

Reference/API

Extinction Laws

DustExtinction.ccm89Function.
ccm89(wave::Real, r_v::Real=3.1)

Clayton, Cardelli and Mathis (1989) dust law.

Returns the extinction in magnitudes at the given wavelength(s) wave (in Angstroms), relative to the extinction at 5494.5 Angstroms. The parameter r_v changes the shape of the function. A typical value for the Milky Way is 3.1. An error is raised for wavelength values outside the range of support, 1000. to 33333.33 Angstroms.

References

[1] Cardelli, Clayton and Mathis (1989)

source
DustExtinction.od94Function.
od94(wave::Real, r_v::Real=3.1)

O'Donnell (1994) dust law.

This is identical to the Clayton, Cardelli and Mathis (1989) dust law, except that different coefficients are used in the optical (3030.3 to 9090.9 Angstroms). Returns the extinction in magnitudes at the given wavelength(s) wave (in Angstroms), relative to the extinction at 5494.5 Angstroms. The parameter r_v changes the shape of the function. A typical value for the Milky Way is 3.1. An error is raised for wavelength values outside the range of support, 1000. to 33333.33 Angstroms.

References

[1] O'Donnell (1994)

source
DustExtinction.cal00Function.
cal00(wave::Real, r_v::Real=3.1)

Calzetti et al. (2000) Dust law.

Calculate the magnitudes for given wavelengths wave in Angstrom. Wavelength support is 0.12 to 2.2 microns (error will be thrown if out of this range). Accepts selective extinction r_v parameter with default set to Milky Way average of 3.1.

References

[1] Calzetti et al. (2000)

source

Dust Maps

download_sfd98([destdir])

Download the Schlegel, Finkbeiner and Davis (1998) dust maps to the given directory. If the directory is ommitted, the SFD98_DIR environment variable is used as the destination directory.

source
SFD98Map([mapdir])

Schlegel, Finkbeiner and Davis (1998) dust map. mapdir should be a directory containing the two FITS files defining the map, SFD_dust_4096_[ngp,sgp].fits. If mapdir is omitted, the SFD98_DIR environment variable is used. Internally, this type keeps the FITS files defining the map open, speeding up repeated queries for E(B-V) values.

source
ebv_galactic(dustmap::SFD98Map, l::Real, b::Real)
ebv_galactic(dustmap::SFD98Map, l::Vector{<:Real}, b::Vector{<:Real})

Get E(B-V) value from a SFD98Map instance at galactic coordinates (l, b), given in radians. l and b may be Vectors. Uses bilinear interpolation between pixel values.

source