|
| 1 | +using DustExtinction: _curve_F99_method |
| 2 | + |
| 3 | +const g03_obsdata_x = ( |
| 4 | + 0.455, 0.606, 0.800, 1.235, 1.538, 1.818, 2.273, 2.703, |
| 5 | + 3.375, 3.625, 3.875, 4.125, 4.375, 4.625, 4.875, 5.125, |
| 6 | + 5.375, 5.625, 5.875, 6.125, 6.375, 6.625, 6.875, 7.125, |
| 7 | + 7.375, 7.625, 7.875, 8.125, 8.375, 8.625 |
| 8 | +) |
| 9 | +const g03_obsdata_axav = ( |
| 10 | + 0.110, 0.169, 0.250, 0.567, 0.801, 1.000, 1.374, 1.672, |
| 11 | + 2.000, 2.220, 2.428, 2.661, 2.947, 3.161, 3.293, 3.489, |
| 12 | + 3.637, 3.866, 4.013, 4.243, 4.472, 4.776, 5.000, 5.272, |
| 13 | + 5.575, 5.795, 6.074, 6.297, 6.436, 6.992 |
| 14 | +) |
| 15 | + |
| 16 | +const g03_obsdata_tolerance = 6e-2 |
| 17 | + |
| 18 | +const g03_C1, g03_C2, g03_C3, g03_C4 = -4.959, 2.264, 0.389, 0.461 |
| 19 | +const g03_x0 = 4.6 |
| 20 | +const g03_gamma = 1.0 |
| 21 | + |
| 22 | +const g03_optnir_axav_x = 1.0 ./ ( |
| 23 | + 2.198, 1.65, 1.25, 0.81, 0.65, 0.55, 0.44, 0.37 |
| 24 | +) |
| 25 | +# values at 2.198 and 1.25 changed to provide smooth interpolation |
| 26 | +# as noted in Gordon et al. (2016, ApJ, 826, 104) |
| 27 | +const g03_optnir_axav_y = (0.11, 0.169, 0.25, 0.567, 0.801, 1.00, 1.374, 1.672) |
| 28 | + |
| 29 | +""" |
| 30 | + G03_SMCBar(;Rv=2.74) <Internal function> |
| 31 | +
|
| 32 | +Gordon et al. (2003) SMCBar Average Extinction Curve. |
| 33 | +
|
| 34 | +The observed A(lambda)/A(V) values at 2.198 and 1.25 microns were changed to |
| 35 | +provide smooth interpolation as noted in Gordon et al. (2016, ApJ, 826, 104) |
| 36 | +
|
| 37 | +# Reference |
| 38 | +[Gordon et al. (2003)](https://ui.adsabs.harvard.edu/abs/2003ApJ...594..279G/) |
| 39 | +""" |
| 40 | +@with_kw struct G03_SMCBar <: DustExtinction.ExtinctionLaw |
| 41 | + Rv::Float64 = 2.74 |
| 42 | + obsdata_x = g03_obsdata_x |
| 43 | + obsdata_axav = g03_obsdata_axav |
| 44 | + obsdata_tolerance::Float64 = g03_obsdata_tolerance |
| 45 | +end |
| 46 | + |
| 47 | +#G03_SMCBar(Rv) = G03_SMCBar(promote(Rv)...) |
| 48 | +#G03_SMCBar(Rv=2.74) = G03_SMCBar(Rv) |
| 49 | + |
| 50 | +bounds(::Type{<:G03_SMCBar}) = (1000.0, 33333.3) |
| 51 | + |
| 52 | +function (law::G03_SMCBar)(wave::T) where T |
| 53 | + checkbounds(law, wave) || return zero(float(T)) |
| 54 | + x = aa_to_invum(wave) |
| 55 | + return g03_invum(x, law.Rv) |
| 56 | +end |
| 57 | + |
| 58 | + |
| 59 | +function g03_invum(x::Real, Rv::Real) |
| 60 | + if !(0.3 <= x <= 10.0) |
| 61 | + error("out of bounds of G03_SMCBar, support is over $(bounds(G03_SMCBar)) angstrom") |
| 62 | + end |
| 63 | + |
| 64 | + # return A(x)/A(V) |
| 65 | + return _curve_F99_method( |
| 66 | + x, |
| 67 | + Rv, |
| 68 | + g03_C1, |
| 69 | + g03_C2, |
| 70 | + g03_C3, |
| 71 | + g03_C4, |
| 72 | + g03_x0, |
| 73 | + g03_gamma, |
| 74 | + g03_optnir_axav_x, |
| 75 | + g03_optnir_axav_y, |
| 76 | + ) |
| 77 | +end |
| 78 | + |
| 79 | +""" |
| 80 | + G16(;Rv=3.1, f_A=1.0) |
| 81 | +
|
| 82 | +Gordon et al. (2016) Milky Way, LMC, & SMC R(V) and f_A dependent model |
| 83 | +
|
| 84 | +Returns E(B-V) in magnitudes at the given wavelength relative to the |
| 85 | +extinction. This is mixture model between the F99 R(V) dependent model |
| 86 | +(component A) and the [`G03_SMCBar`](@ref) model (component B) The default support is |
| 87 | +[1000, 33333] Å. Outside of that range this will return 0. Rv is the selective |
| 88 | +extinction and is valid over [2, 6]. A typical value for the Milky Way is 3.1. |
| 89 | +
|
| 90 | +# References |
| 91 | +[Gordon et al. (2016)](https://ui.adsabs.harvard.edu/abs/2016ApJ...826..104G/) |
| 92 | +""" |
| 93 | +@with_kw struct G16{T<:Number} <: ExtinctionLaw @deftype T |
| 94 | + Rv::Float64 = 3.1 |
| 95 | + f_A = 1.0 |
| 96 | +end |
| 97 | + |
| 98 | +#G16(Rv, f_A) = G16(promote(Rv, f_A)...) |
| 99 | +#G16(Rv=3.1, f_A=3.1) = G16(Rv, f_A) |
| 100 | + |
| 101 | +bounds(::Type{<:G16}) = (1000.0, 33333.3) |
| 102 | + |
| 103 | +function (law::G16)(wave::T) where T |
| 104 | + checkbounds(law, wave) || return zero(float(T)) |
| 105 | + x = aa_to_invum(wave) |
| 106 | + return g16_invum(x, law.Rv, law.f_A) |
| 107 | +end |
| 108 | + |
| 109 | +""" |
| 110 | + DustExtinction.g16_invum(x, Rv) |
| 111 | +The algorithm used for the [`G16`](@ref) extinction law, given inverse microns |
| 112 | +and Rv. For more information, seek the original paper. |
| 113 | +""" |
| 114 | +function g16_invum(x::Real, Rv::Real, f_A::Number) |
| 115 | + if !(0.3 <= x <= 10.0) |
| 116 | + error("out of bounds of G16, support is over $(bounds(G16)) angstrom") |
| 117 | + end |
| 118 | + |
| 119 | + # get the A component extinction model |
| 120 | + alav_A = f99_invum(x, Rv) |
| 121 | + |
| 122 | + # get the B component extinction model |
| 123 | + alav_B = g03_invum(x, Rv) |
| 124 | + |
| 125 | + # create the mixture model |
| 126 | + alav = @. f_A * alav_A + (1.0 - f_A) * alav_B |
| 127 | + |
| 128 | + return alav |
| 129 | +end |
0 commit comments