---
title: 'ElecSus: Modeling Alkali Vapor Susceptibility'
url: https://www.emergentmind.com/topics/elecsus
type: topic
---

# ElecSus: Modeling Alkali Vapor Susceptibility

Searching arXiv for ElecSus papers and related applications.
ElecSus is an open-source Python package and underlying model for calculating the complex electric susceptibility $\chi(\omega)$ of an alkali-metal vapour in the weak-probe approximation. It uses a matrix representation of the atomic Hamiltonian in the completely uncoupled basis to calculate transition frequencies and strengths, and from these predicts absorption, dispersion, polarization rotation, refractive indices, Stokes parameters, and related spectra for optical fields propagating through thermal vapours in magnetic fields. In its original formulation it targeted axial-field spectroscopy and device design for Faraday rotators, Faraday filters, optical isolators, and circular polarisation filters, while also providing fitting routines for optical metrology [1409.1873].

## 1. Origins, scope, and development

The original ElecSus release presented a computer program to calculate the electric susceptibility of a gas, with a specific focus on alkali-metal vapours. Its central domain was weak-probe spectroscopy in thermal vapours of Na, K, Rb, and Cs, with line selection on the D$_1$ and D$_2$ transitions and an applied axial magnetic field. The program calculated various spectra for a weak-probe laser beam in an atomic medium and exposed both forward modelling and fitting routines for experiment comparison [1409.1873].

A major subsequent update extended ElecSus to arbitrary geometry magneto-optics. The most important change was support for non-axial magnetic fields, which required a more general treatment of light propagation in anisotropic media. That release also introduced a graphical user interface front-end and improved several aspects of the program structure [1708.05305].

Later work documented further extension of the code base rather than a fixed static model. One line of development incorporated buffer-gas broadening and pressure shifts into potassium D$_1$ modelling, including dual-temperature handling for cell body and stem temperatures [2504.07888]. Another added a lithium-specific subpackage so that both D-lines in both stable isotopes, $^6$Li and $^7$Li, could be treated simultaneously in hot-vapour Faraday-filter calculations [2510.11859]. This progression suggests a transition from an axial weak-probe spectroscopy code to a broader magneto-optic toolkit spanning arbitrary geometry, buffer-gas environments, and additional atomic species.

## 2. Microscopic model of susceptibility

In ElecSus, the optical response is expressed through the complex refractive index $\hat n(\omega)=n(\omega)+i\beta(\omega)$ and the complex susceptibility $\chi(\omega)$, with
$$
\hat n(\omega)=\sqrt{1+\chi(\omega)}\approx 1+\chi(\omega)/2
$$
for $|\chi|\ll1$. The real part $\chi'(\omega)$ gives dispersive phase shifts, while the imaginary part $\chi''(\omega)$ gives absorption; in a dilute atomic vapour the intensity decays as
$$
I(z)=I_0\,\exp[-2\,k\,\chi''(\omega)\,z],
$$
where $k=\omega/c$ [1409.1873].

The atomic structure calculation is based on a Hamiltonian assembled in the completely uncoupled basis. In the axial-field formulation this is written as
$$
H=H_0+H_{\rm fine}+H_{\rm hf}+H_{\rm Zeeman},
$$
while the arbitrary-geometry treatment uses
$$
H = H_{\rm fs} + H_{\rm hfs} + H_{\rm Z}.
$$
The fine, hyperfine, and Zeeman interactions are assembled term by term and the resulting matrix is diagonalized numerically. Transition frequencies follow from the eigenenergies of the ground and excited manifolds, and line strengths are obtained from the corresponding eigenvectors using reduced dipole matrix elements and angular-momentum algebra [1409.1873].

For a collection of independent resonances labelled by $j$, the susceptibility can be written as
$$
\chi(\omega)=\sum_j \frac{N|d_j|^2}{\varepsilon_0\hbar}\,\frac{1}{\omega_j-\omega-i\Gamma/2}.
$$
Thermal motion broadens each transition through convolution with the one-dimensional Maxwell–Boltzmann distribution, producing a Voigt profile. In ElecSus this is evaluated through the Faddeeva function $w(z)$, so that the Doppler-broadened line shape is generated efficiently and reused across transitions shifted by their respective resonance frequencies and weighted by their line strengths [1409.1873].

In the presence of an axial magnetic field, the $\sigma^+$ and $\sigma^-$ components acquire different susceptibilities, $\chi_+(\omega)$ and $\chi_-(\omega)$. The relative phase then gives Faraday rotation,
$$
\theta(\omega) = (kL/2)\,\mathrm{Re}[\chi_+ - \chi_-],
$$
where $L$ is the cell length. From the same susceptibility, ElecSus derives transmission, refractive index, group index, analyzer spectra, and Stokes parameters for arbitrary incident polarization states [1409.1873].

## 3. Magneto-optic propagation and geometry handling

The arbitrary-geometry extension reformulated ElecSus as an anisotropic propagation problem. In that treatment one defines the partial susceptibilities $\chi_+$, $\chi_-$, and $\chi_0$ associated with $\sigma^+$, $\sigma^-$, and $\pi$ transitions. In a laboratory basis with light propagating along $z$ and the magnetic field in the $x$–$z$ plane, the dielectric tensor is expressed through
$$
\epsilon_x   = 1 + \frac{\chi_+ + \chi_-}{2}, \qquad
\epsilon_{xy}= \frac{i}{2}(\chi_- - \chi_+), \qquad
\epsilon_z   = 1 + \chi_0,
$$
with off-diagonal magneto-optic terms $\chi_{xy}=-\chi_{yx}$ [1708.05305].

Light propagation is then obtained by solving Maxwell’s wave equation in the medium,
$$
\mathbf{k}\times(\mathbf{k}\times\mathbf{E})
+\frac{\omega^2}{c^2}\,\boldsymbol{\epsilon}\cdot\mathbf{E}
=\mathbf{0},
$$
which yields the refractive indices $n_{1,2}(\omega)$ and the associated normal-mode polarizations. ElecSus packages this in a generalized Jones matrix,
$$
\mathbf{E}_{\rm out}(L)
=R_z(-\phi_B)\,M^{-1}\,P(L)\,M\,R_z(\phi_B)\,\mathbf{E}_{\rm in}
\equiv J_\chi\,\mathbf{E}_{\rm in},
$$
so that absorption, phase shifts, and polarization rotation are handled within a single propagation formalism [1708.05305].

This framework recovers the standard special cases. In Faraday geometry, with $\theta_B=0$, the normal modes are left- and right-circular and the familiar circular birefringence picture is recovered. In Voigt geometry, with $\theta_B=\pi/2$, one mode is linearly polarized along the magnetic field and drives only $\pi$ transitions, while the orthogonal mode is an equal superposition of $\sigma^+$ and $\sigma^-$ and gives linear dichroism and the Voigt effect [1708.05305].

The Voigt-geometry spectroscopy studies give the operational form of this decomposition. With $\mathbf{k}\parallel z$ and $\mathbf{B}_{\rm ext}\parallel x$, a linearly polarised probe with polarization angle $\phi_B$ decomposes into an $E_\parallel$ component that couples only to $\pi$ transitions and an $E_\perp$ component that couples only to $\sigma^\pm$ transitions. The transmitted intensity becomes
$$
T(\omega,\phi_B)
= \cos^2\phi_B\,e^{-2k\,\mathrm{Im}[n_\parallel]L}
+ \sin^2\phi_B\,e^{-2k\,\mathrm{Im}[n_\perp]L},
$$
which makes explicit how the polarization angle tunes between $\pi$- and $\sigma$-dominated absorption [1810.01135].

## 4. Software organization, interfaces, and fitting routines

In the original release, ElecSus was described as a Python 2.x program organized around a small set of core modules. The main driver `elecsus.py` reads the run-card, calls the spectrum routines, and handles fitting and I/O; `spectrum.py` builds and diagonalizes Hamiltonians and computes $\chi(\omega)$ and derived spectra; `eigensystem.py` provides the low-level eigenproblem interface; and `fitting/*.py` contains Marquardt–Levenberg, Random-Restart, and Simulated-Annealing routines. The numerical stack relies on NumPy, SciPy, and matplotlib [1409.1873].

User input in that version is managed through a run-card specifying the atomic species, D-line, vapour-pressure temperature, Doppler-broadening temperature, cell length, axial magnetic field, detuning range, incident polarization, spectra to compute, and optional fit parameters. Command-line execution is performed with `python elecsus.py myruncard.py`, while output includes theory spectra, residual files, and best-fit parameters when fitting is enabled [1409.1873].

Published workflows also show other interfaces. In a Faraday-filter modelling example, ElecSus is configured through a plain-text file containing species, isotope abundances, line selection, cell length, temperature, magnetic field, input polarization, and scan range, and can then be invoked either from the shell or directly from Python via `calculate` [1502.07187]. The arbitrary-geometry release added a graphical user interface front-end, and later examples used object-based APIs for susceptibility and filter classes in specialized extensions such as lithium modelling [1708.05305].

Fitting is a central feature rather than an auxiliary one. The original package included Marquardt–Levenberg as a fast local least-squares method, Random-Restart as repeated local fitting from random initial guesses, and Simulated-Annealing as a global minimization strategy [1409.1873]. In later arbitrary-geometry work, nonlinear least-squares fitting used `lmfit`, and the implementation emphasized vectorized operations, precomputation and caching of eigensystems, and multi-core fitting support [1708.05305].

## 5. Filter design, optimization, and metrological use

A prominent ElecSus application is the design of atomic Faraday filters. For a cesium D$_1$-line Faraday filter, ElecSus was used to find optimal experimental parameters and identified a configuration with a magnetic field of 45.3 gauss and a temperature of 68.0$\,^\circ$C in a 75 mm cell. In that operating point the filter simultaneously achieved a peak transmission of 77%, a passband of 310 MHz, and an equivalent noise bandwidth of 0.96 GHz, and experiment and theory showed excellent agreement [1502.07187].

The relevant performance metrics are expressed explicitly in the ElecSus-based filter literature. One workflow defines
$$
\mathrm{ENBW}=\frac{\int T(\omega)\,d\omega}{T(\omega_0)},
$$
with $\omega_0=\arg\max T(\omega)$ in practice, and then uses $FOM=T_{\rm peak}/ENBW$ as the optimization target [1502.07187]. A related Faraday-filter study defines
$$
\mathrm{ENBW}=\frac{\int T_{\rm filter}(\nu)\,d\nu}{T_{\rm filter}(\nu_{\max})},
\qquad
FOM=\frac{T_{\rm filter}(\nu_{\max})^2}{\int T_{\rm filter}(\nu)\,d\nu},
$$
and uses a global-minimization meta-algorithm consisting of random-restart hill-climbing combined with Nelder–Mead downhill simplex to optimize magnetic field and temperature for a chosen cell length [1504.03651].

That same study established an important limitation of simplified filter models: homogeneous line broadening drastically affects performance, self-broadening is particularly important for short vapour cells and for wing-type filters, and additional homogeneous broadening from background buffer gas may be required for accurate fits. In a 1 mm$^3$, 99% $^{87}$Rb micro-fabricated cell with a small 1% $^{85}$Rb impurity and a trace of unknown buffer gas, omitting the extra $\Gamma_{\rm buf}$ produced a simulated wing-type filter peak of approximately 0.8, whereas the experiment showed approximately 0.55. Adding $\Gamma_{\rm buf}/2\pi=42$ MHz brought theory into excellent agreement, with RMS residual $\lesssim 0.6\%$; removing self-broadening again overestimated the transmission [1504.03651]. The same work explicitly advises against simply rescaling $N\ell=\mathrm{const}$, because both Doppler and self-broadening shift the optimum profile.

Beyond filter design, ElecSus has been used as an optical metrology tool. On the potassium D lines, weak-probe transmission spectra measured across a wide temperature range agreed with ElecSus with rms errors of approximately $10^{-3}$ to $10^{-2}$, providing the first experimental test of ElecSus on an atom whose ground-state hyperfine splitting is smaller than the Doppler width [1506.06651]. In that study, fitting the 4S$\rightarrow$4P D-line transmission returned the cell temperature with a precision of $\lesssim0.2\,^\circ$C, and a proposed two-beam method for 4S$\rightarrow$5P spectroscopy was predicted to measure transition decay rates with precision $\sim 3$ kHz [1506.06651].

## 6. Experimental validation and later extensions

ElecSus has been validated quantitatively in non-axial geometries. In a detailed study of thermal $^{87}$Rb vapour in the Voigt geometry for DC magnetic fields up to 0.4 T, fits to transmission spectra yielded RMS errors of $\sim0.3\%$ and extracted the magnetic field strength and the angle between the light polarization and the magnetic field to within $\sim1\%$ of a commercial Hall probe and to $\pm0.02$ rad, respectively [1810.01135]. At still higher field, a 1.5 T Voigt-geometry study fitted all Stokes parameters with RMS errors of $\sim1.2\%$ on $S_0$ and $\sim1.5\%$ on $S_{1,2,3}$, extracted $B=1.52\pm0.07$ T, and showed that including birefringent entrance and exit cell windows significantly reduced residuals, especially in $S_3$ [2006.16052].

Buffer-gas modelling has become an explicit extension of the ElecSus formalism. For potassium D$_1$ spectroscopy in neon-filled sealed cells, the susceptibility denominator was modified from $\Delta-kv+i(\Gamma_0/2)$ to $\Delta+P\Delta_p-kv+i[(\Gamma_0+P\Gamma_p)/2]$, so that pressure shifts and pressure broadening enter directly into the Voigt profile [2504.07888]. In that work, dual-temperature control was built into ElecSus by assigning the Doppler width to the cell-body temperature $T_c$ and the number density to the stem temperature $T_s$. At 100 Torr of neon, fits returned $\Gamma_{\rm fit}=(765\pm2)$ MHz and $S_{\rm fit}=(-158\pm1)$ MHz; across pressures the best-fit slopes were $7.64\pm0.04$ MHz/Torr for broadening and $-1.59\pm0.03$ MHz/Torr for shift, with weighted-residual rms error below 0.5% across a 16 GHz scan [2504.07888].

A related Stokes-polarimetry study on potassium D$_1$ with 60 Torr neon used ElecSus in the Faraday geometry for magnetic fields up to 1.2 kG. Measurements at five stem temperatures and three magnetic fields showed excellent agreement for $S_0$ and $S_3$ absorptive features and accurate reproduction of the rapid dispersive oscillations in $S_1$ and $S_2$, with RMS residuals below 1% in one set of measurements and below 1.5% in another [2507.18353]. That work identified pressure broadening, pressure shift, and damping of $S_1$ and $S_2$ zero-crossings as buffer-gas signatures that are reproduced only when collisional broadening is included.

The lithium extension further broadened the atomic scope of ElecSus. Because the $^6$Li D$_2$ line overlaps the $^7$Li D$_1$ line by only approximately 10 GHz, the extended model sums over both D-lines in both stable isotopes and introduces a dedicated `elecsus.lithium` subpackage with routines for the Hamiltonian, transition strengths, Voigt profiles, susceptibility calculation, and Faraday-filter transmission [2510.11859]. A three-dimensional grid scan over temperature, magnetic field, and path length found an optimum near $T=264\,^\circ$C, $B=269$ G, and $L=150$ mm, where ElecSus forecast peak transmission $\simeq82\%$, $\mathrm{ENBW}\simeq5.32$ GHz, and $FOM\simeq0.154$ GHz$^{-1}$; experiment measured a peak of 82%, ENBW $\simeq5.3$ GHz, residuals below $\pm4\%$, and identical wing structure over $\pm30$ GHz detuning [2510.11859].

Taken together, these studies document ElecSus as a first-principles spectroscopy and magneto-optics framework built around Hamiltonian diagonalization, Voigt-profile susceptibility synthesis, and Jones-matrix propagation, with demonstrated use in filter optimization, thermometry, decay-rate inference, vector magnetometry, buffer-gas spectroscopy, and multi-isotope extensions across several alkali species.

Source: https://www.emergentmind.com/topics/elecsus