Skip to main content

(Atomic Physics) Calculate the weak-probe electric susceptibility for alkali-metal vapours

Project description

A program to calculate the electric susceptibility of an atomic ensemble. The program is designed to model weak probe laser spectra on the D-lines of thermal alkali metal vapour cells. The program also includes fitting routines which allow experimental parameters to be extracted from experimental spectroscopic data.

New in version 2.0.0

  • Significantly improved user-friendliness in the form of a GUI to aid in calculating theory spectra and fitting experimental data.

    Works on Windows and Linux, tested on Windows 7, 8.1, 10 and Ubuntu 14.04. Currently not tested on Mac.

  • Rewritten fitting routines, and to support keyword arguments, passed to scipy.curve_fit / leastsq methods

  • Added new support modules: - - libs/ contains two simplified methods for either calculating spectra or fitting data, and should be easier to interface with external code for, e.g., batch processing / fitting of data or generating 2D plots. contains methods for binning (reducing the number of data points by local averaging) and moving-average smoothing data traces

    both of these new modules are used by the GUI program

  • Renamed the old module for added clarity –>

    This is the old method of calling elecsus with <runcard>.py files as system arguments. This way is now obsolete, being replaced by either the GUI or the methods contained in For backwards compatibility, the module allows the runcards to be used in the same way as before.

    The example runcards and example data have been moved to sub-directories, /runcard and /sample_data, respectively.

  • Added a new module,

    This module allows calcualtion of spectra with the output of electric field vectors, rather than spectroscopic quantities. This should allow calculation of spectra in cells with non-uniform magnetic fields, by splitting the cell into sufficiently small parts that the field variation across any one part is negligible. Spectroscopic quantities can be calculated from the electric field vector by using Jones matrices.

    << add example for magnetic field calculation? >>


Must have the python programming language installed with the following packages:

  • Scipy version 0.12.0 or later
  • Numpy
  • Matplotlib
  • wxPython 2.8 (for GUI)


Unzip the file << to update with pip install info >>


  1. For GUI operation:
  • After package installation, from the python interpreter type:

    from elecsus import elecsus_gui


  • In windows, double-click on the run_gui.bat file in the elecsus directory

  • Alternately, open a terminal or command-line window and navigate to the ElecSus directory. Type:


  1. For Runcard operation:
  • Open a terminal window and move to the directory where the files have been extracted to.

  • To run the program taking parameters from type:


  • To run using parameters from a particular runcard type

    python <run card file name>

  • So to run a the first D1 example, type


  • To run the second example, type


  1. For integration into external code:
  • The module contains two methods, calculate() and fit_data(), which allow for easy integration into external codes. See the source for more details


For GUI documentation, see docs/ElecSus_GUI_UserGuide.pdf

For the ElecSus paper, go to and download the paper. It is published open-access and therefore freely available.


All the files distributed with this program are provided subject to the Apache License, Version 2.0. A Copy of the license is provided.

Project details

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page