@@ -298,15 +298,12 @@ const f99_gamma = 0.99
298298
299299"""
300300 F99(;Rv=3.1)
301-
302301Fitzpatrick (1999) dust law.
303-
304302Returns E(B-V) in magnitudes at the given wavelength relative to the
305303extinction. This model applies to the UV and optical to NIR spectral range.
306304The default support is [1000, 33333] Å. Outside of that range this will return
3073050. Rv is the selective extinction and is valid over [2, 6]. A typical value for
308306the Milky Way is 3.1.
309-
310307# References
311308[Fitzpatrick (1999)](https://ui.adsabs.harvard.edu/abs/1999PASP..111...63F/)
312309"""
@@ -324,7 +321,6 @@ bounds(::Type{F99}) = (1000.0, 33333.3)
324321
325322"""
326323 DustExtinction.f99_invum(x, Rv)
327-
328324The algorithm used for the [`F99`](@ref) extinction law, given inverse microns and Rv. For more information, seek the original paper.
329325"""
330326function f99_invum (x:: Real , Rv:: Real )
@@ -370,3 +366,89 @@ function f99_invum(x::Real, Rv::Real)
370366 optnir_axebv_y,
371367 )
372368end
369+
370+ # spline points
371+ const f04_opt_axav_x = aa_to_invum .((6000 , 5470 , 4670 , 4110 ))
372+ const f04_nir_axav_x = (0.50 , 0.75 , 1.0 )
373+
374+ # **Use NIR spline x values in FM07, clipped to K band for now
375+ const f04_optnir_axav_x = (f04_nir_axav_x... , f04_opt_axav_x... )
376+
377+ # c1-c2 correlation terms
378+ const f04_c3 = 2.991
379+ const f04_c4 = 0.319
380+ const f04_x0 = 4.592
381+ const f04_gamma = 0.922
382+
383+ """
384+ F04(;Rv=3.1)
385+ Fitzpatrick (2004) dust law.
386+ Returns E(B-V) in magnitudes at the given wavelength relative to the
387+ extinction. This model applies to the UV and optical to NIR spectral range.
388+ The default support is [1000, 33333] Å. Outside of that range this will return
389+ 0. Rv is the selective extinction and is valid over [2, 6]. A typical value for
390+ the Milky Way is 3.1.
391+ Equivalent to the F99 model with an updated NIR Rv dependence
392+ See also Fitzpatrick & Massa (2007, ApJ, 663, 320)
393+ # References
394+ [Fitzpatrick (2004)](https://ui.adsabs.harvard.edu/abs/2004ASPC..309...33F/)
395+ """
396+ @with_kw struct F04 <: ExtinctionLaw
397+ Rv:: Float64 = 3.1
398+ end
399+
400+ function (law:: F04 )(wave:: T ) where T
401+ checkbounds (law, wave) || return zero (float (T))
402+ x = aa_to_invum (wave)
403+ return f04_invum (x, law. Rv)
404+ end
405+
406+ bounds (:: Type{F04} ) = (1000.0 , 33333.3 )
407+
408+ """
409+ DustExtinction.f04_invum(x, Rv)
410+ The algorithm used for the [`F04`](@ref) extinction law, given inverse microns and Rv. For more information, seek the original paper.
411+ """
412+ function f04_invum (x:: Real , Rv:: Real )
413+ if ! (0.3 <= x <= 10.0 )
414+ error (" out of bounds of F04, support is over $(bounds (F04)) angstrom" )
415+ end
416+
417+ # original F99 Rv dependence
418+ c2 = @evalpoly (1. / Rv) - 0.824 4.717
419+ # updated F04 C1-C2 correlation
420+ c1 = @evalpoly c2 2.18 - 2.91
421+
422+ # **Keep optical spline points from F99:
423+ # Final optical spline point has a leading "-1.208" in Table 4
424+ # of F99, but that does not reproduce Table 3.
425+ # Additional indication that this is not correct is from
426+ # fm_unred.pro
427+ # which is based on FMRCURVE.pro distributed by Fitzpatrick.
428+ # --> confirmation needed?
429+ opt_axebv_y =
430+ (@evalpoly Rv - 0.426 1.0044 ),
431+ (@evalpoly Rv - 0.050 1.0016 ),
432+ (@evalpoly Rv 0.701 1.0016 ),
433+ (@evalpoly Rv 1.208 1.0032 - 0.00033 )
434+
435+ # updated NIR curve from F04, note R dependence
436+ # Julia v1.0 workaround: https://github.com/JuliaAstro/DustExtinction.jl/pull/31#commitcomment-40605778
437+ nir_axebv_y_coeff = (0.63 * Rv - 0.84 )
438+ nir_axebv_y = @. nir_axebv_y_coeff * f04_nir_axav_x^ 1.84
439+
440+ optnir_axebv_y = @. (nir_axebv_y... , opt_axebv_y... ) / Rv
441+
442+ return _curve_F99_method (
443+ x,
444+ Rv,
445+ c1,
446+ c2,
447+ f04_c3,
448+ f04_c4,
449+ f04_x0,
450+ f04_gamma,
451+ f04_optnir_axav_x,
452+ optnir_axebv_y,
453+ )
454+ end
0 commit comments