astrofrog / sedfitter

Python version of the SED fitter from Robitaille et al., 2007, ApJS 169 328
http://sedfitter.readthedocs.org
BSD 2-Clause "Simplified" License
20 stars 22 forks source link

Extinction is not self-consistent internally #74

Open keflavich opened 3 years ago

keflavich commented 3 years ago

The Extinction module wants chi defined in cm^2/g:

https://github.com/astrofrog/sedfitter/blob/master/sedfitter/extinction/extinction.py#L41-L43

but the function get_av treats chi as if it is a pure opacity: https://github.com/astrofrog/sedfitter/blob/master/sedfitter/extinction/extinction.py#L86-L87

I guess the idea is that chi is "tau per (cm^2 / g)", so just multiplying by -0.4 turns it to a magnitude?

In any case, I suggest the following approach for generating extinction objects, based on Karl Gordon's dust extinction:

from dust_extinction.parameter_averages import F19

# a_v to N(H) from https://arxiv.org/pdf/0903.2057.pdf
# m(particle) ~ 1.34 m(H) from memory...
guyver2009_avtocol = (2.21e21 * u.cm**-2 * (1.34*u.Da)).to(u.g/u.cm**2)
ext_wav = np.sort((np.geomspace(0.301, 8.699, 1000)/u.um).to(u.um, u.spectral()))
ext_vals = ext.evaluate(ext_wav, Rv=3.1)
extinction = Extinction()
extinction.wav = ext_wav
extinction.chi = ext_vals / guyver2009_avtocol

but I'd like to know if this looks halfway reasonable?