qsotools.voigt.voigt ¶
-
qsotools.voigt.
voigt
( a , u ) [source] ¶ -
Compute the Voigt function.
- a: float
-
The lorentzian FWHM divided by the gaussian FWHM of the line.
- u: array of floats
-
The frequency offsets from the frequency at the line centre, in units of the FWHM frequency of the doppler broadening.
Returns voigt function H(a,u).
Notes
This is a Taylor approximation to the Voigt function valid for 0 < a < 0.1. (Harris 1948, ApJ, 108, 112). Relative error with respect to voigt_de is < 10^-4.9 for a < 0.1, gets worse for larger a (since it’s an expansion in a).
Examples
>>> uvals = numpy.arange(-25, 25, 1./100) >>> a = 0.01 >>> y1 = voigt(a, uvals) >>> y2 = numpy.fromfile('data/idl_voigt.txt', sep=' ') >>> numpy.allclose(y1, y2, rtol=1e-8) True >>> uvals = numpy.linspace(-25, 25, 40) >>> a = 1e-5 >>> y1 = voigt(a, uvals) >>> y2 = [voigtslow(a,u) for u in uvals] >>> all(mp.almosteq(i, j, 1e-5) for i,j in zip(y1,y2)) True >>> a = 0.1 >>> y1 = voigt(a, uvals) >>> y2 = [voigtslow(a,u) for u in uvals] >>> all(mp.almosteq(i, j, 1e-5) for i,j, in zip(y1,y2)) True