Lbl4IR – Line-by-line for InfraRed

Optimized implementations of Rational Approximations for the Voigt and Complex Error Function

(Journal of Quantitative Spectroscopy and Radiative Transfer, Vol. 112, pp. 1010-1025, 2011)


Rational functions are frequently used as efficient yet accurate numerical approximations for real and complex valued functions. For the complex error function w(x+iy), whose real part is the Voigt function K(x,y), code optimizations of rational approximations are investigated. An assessment of requirements for atmospheric radiative transfer modeling indicates a y range over many orders of magnitude and accuracy better than 10-4. Following a brief survey of complex error function algorithms in general and rational function approximations in particular the problems associated with subdivisions of the x, y plane (i.e., conditional branches in the code) are discussed and practical aspects of Fortran and Python implementations are considered. Benchmark tests of a variety of algorithms demonstrate that programming language, compiler choice, and implementation details influence computational speed and there is no unique ranking of algorithms. A new implementation, based on subdivision of the upper half-plane in only two regions, combining Weideman's rational approximation for small |x|+y < 15 and Humlicek's rational approximation otherwise is shown to be efficient and accurate for all x, y.

(See the module for Python implementations of various Humlicek-Weideman combinations.)

Computational aspects of speed-dependent Voigt profiles

(Journal of Quantitative Spectroscopy and Radiative Transfer, Vol. 187, pp. 44-53, 2017)


The increasing quality of atmospheric spectroscopy observations has indicated the limitations of the Voigt profile routinely used for line-by-line modeling, and physical processes beyond pressure and Doppler broadening have to be considered. The speed-dependent Voigt (SDV) profile can be readily computed as the difference of the real part of two complex error functions (i.e. Voigt functions). Using a highly accurate code as a reference, various implementations of the SDV function based on Humlicek's rational approximations are examined for typical speed dependences of pressure broadening and the range of wavenumber distances and Lorentz to Doppler width ratios encountered in infrared applications. Neither of these implementations appears to be optimal, and a new algorithm based on a combination of the Humlicek (1982) and Weideman (1994) rational approximations is suggested.

Supplement Material (called mmc1.txt in the JQSRT supplement)
A (I)Python interactive session demonstrating the use of the humlicek, weideman, and sdv modules and how to generate the contour plots. (called mmc4.txt in the JQSRT supplement)
The 'main functions' of this module, sdvProfile and voigtProfile, evaluate the corresponding profiles (normalized to one) for given pressure & temperature, and line position & widths.
Further functions defined here provide implementations of the SDV function based on various codes (and combinations therof) for the complex error function. (called mmc2.txt in the JQSRT supplement)
Various implementations of Humlicek's cpf12 and w4 rational approximations (called mmc5.txt in the JQSRT supplement)
The rational approximations with N=24 and N=32 terms and the Humlicek-Weideman combinations. (called mmc3.txt in the JQSRT supplement)
Mathematical and physical constants

Comments on the Voigt function implementation in the Astropy and packages

Journal of Quantitative Spectroscopy and Radiative Transfer, 213, 13-16, 2018;
Preprint available at arXiv:1806.10338


The Voigt profile is important for spectroscopy, astrophysics, and many other fields of physics, but is notoriously difficult to compute. McLean et al. [J. Electron Spectrosc. & Relat. Phenom., 1994] have proposed an approximation using a sum of Lorentzians. Our assessment indicates that this algorithm has significant errors for small arguments. After a brief survey of the requirements for spectroscopy we give a short list of both efficient and accurate codes and recommend implementations based on rational approximations.

Supplement Material and Further Links
The Python script defining the Voigt function approximations and generating the figures.
The Astropy Collaboration, T.P. Robitaille, E.J. Tollerud, et al.
Astropy: A community Python package for astronomy
Astronomy & Astrophysics, Vol. 558, Article A33, October 2013
C.S. Goldenstein, V.A. Miller, R.M. Spearrin, C.L. Strand: Integrated spectroscopic modeling of atomic and molecular gases
J. Quant. Spectrosc. & Radiat. Transfer, 200, pp. 249-257, 2017

The Voigt and complex error function: Humlicek's rational approximation generalized

(Monthly Notices of the Royal Astronomical Society, 479(3), 3068-3075, 2018;
Preprint available at arXiv:1806.11560


Accurate yet efficient computation of the Voigt and complex error function is a challenge since decades in astrophysics and other areas of physics. Rational approximations have attracted considerable attention and are used in many codes, often in combination with other techniques. The 12-term code "cpf12" of Humlicek (1979) achieves an accuracy of five to six significant digits throughout the entire complex plane. Here we generalize this algorithm to a larger (even) number of terms. The n = 16 approximation has a relative accuracy better than 10-5 for almost the entire complex plane except for very small imaginary values of the argument even without the correction term required for the cpf12 algorithm. With 20 terms the accuracy is better than 10-6. In addition to the accuracy assessment we discuss methods for optimization and propose a combination of the 16-term approximation with the asymptotic approximation of Humlicek (1982) for high efficiency.

Supplement Material --- Various implementations of the Humlicek (1979) algorithm:
Execution of this script inside the IPython interpreter should produce the Figures 1, 2, and 4 of the manuscript. (originally provided as supplementary material of the JQSRT 2017 paper)
Weideman's rational approximations with N=24 and N=32 terms and the Humlicek-Weideman combinations.

Py4CAtS – Python for Computational ATmospheric Spectroscopy


Py4CAtS is a Python re-implementation of the Fortran infrared radiative transfer code GARLIC, where compute-intensive code sections utilize the Numeric/Scientific Python modules (Numpy/Scipy) for highly optimized array-processing. The individual steps of an infrared or microwave radiative transfer computation are implemented in separate scripts to extract lines of relevant molecules in the spectral range of interest, to compute line-by-line cross sections for given pressure(s) and temperature(s), to combine cross sections to absorption coefficients and optical depths, and to integrate along the line-of-sight to transmission and radiance/intensity.


What's new?

October 2016
Initial page setup
April 2018
JQSRT 2018 paper added
June 2018
MNRAS 2018 paper added
August 2019
"Assessment of some closed-form expressions ..." paper series added

© fgs   (+49-8153-28-1234)
Wed August 2, 2019; 12:34
Privacy Policy
Terms of Use