elecsus4 4.0.0b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. elecsus4-4.0.0b1/.zenodo.json +18 -0
  2. elecsus4-4.0.0b1/AUTHORS +27 -0
  3. elecsus4-4.0.0b1/CHANGELOG.md +230 -0
  4. elecsus4-4.0.0b1/CITATION.cff +53 -0
  5. elecsus4-4.0.0b1/LICENSE.txt +202 -0
  6. elecsus4-4.0.0b1/MANIFEST.in +5 -0
  7. elecsus4-4.0.0b1/PKG-INFO +705 -0
  8. elecsus4-4.0.0b1/README.md +658 -0
  9. elecsus4-4.0.0b1/elecsus/__init__.py +11 -0
  10. elecsus4-4.0.0b1/elecsus/assets/LICENSE-Bootswatch.txt +21 -0
  11. elecsus4-4.0.0b1/elecsus/assets/LICENSE-Inter-OFL.txt +93 -0
  12. elecsus4-4.0.0b1/elecsus/assets/README.md +10 -0
  13. elecsus4-4.0.0b1/elecsus/assets/bootstrap-flatly.min.css +12 -0
  14. elecsus4-4.0.0b1/elecsus/assets/elecsus.css +10 -0
  15. elecsus4-4.0.0b1/elecsus/assets/inter-latin-400-normal.woff2 +0 -0
  16. elecsus4-4.0.0b1/elecsus/assets/inter-latin-500-normal.woff2 +0 -0
  17. elecsus4-4.0.0b1/elecsus/assets/inter-latin-700-normal.woff2 +0 -0
  18. elecsus4-4.0.0b1/elecsus/assets/inter.css +8 -0
  19. elecsus4-4.0.0b1/elecsus/elecsus_dash_gui.py +2376 -0
  20. elecsus4-4.0.0b1/elecsus/elecsus_methods.py +849 -0
  21. elecsus4-4.0.0b1/elecsus/energy_levels.py +631 -0
  22. elecsus4-4.0.0b1/elecsus/libs/AtomConstants.py +285 -0
  23. elecsus4-4.0.0b1/elecsus/libs/BasisChanger.py +61 -0
  24. elecsus4-4.0.0b1/elecsus/libs/BufferGasData.py +282 -0
  25. elecsus4-4.0.0b1/elecsus/libs/EigenSystem.py +163 -0
  26. elecsus4-4.0.0b1/elecsus/libs/FundamentalConstants.py +35 -0
  27. elecsus4-4.0.0b1/elecsus/libs/JonesMatrices.py +48 -0
  28. elecsus4-4.0.0b1/elecsus/libs/MLFittingRoutine.py +238 -0
  29. elecsus4-4.0.0b1/elecsus/libs/RRFittingRoutine.py +246 -0
  30. elecsus4-4.0.0b1/elecsus/libs/RotationMatrices.py +119 -0
  31. elecsus4-4.0.0b1/elecsus/libs/__init__.py +0 -0
  32. elecsus4-4.0.0b1/elecsus/libs/ang_mom.py +46 -0
  33. elecsus4-4.0.0b1/elecsus/libs/ang_mom_p.py +41 -0
  34. elecsus4-4.0.0b1/elecsus/libs/data_proc.py +66 -0
  35. elecsus4-4.0.0b1/elecsus/libs/durhamcolours.py +91 -0
  36. elecsus4-4.0.0b1/elecsus/libs/fs_hfs.py +132 -0
  37. elecsus4-4.0.0b1/elecsus/libs/numberDensityEqs.py +87 -0
  38. elecsus4-4.0.0b1/elecsus/libs/param_validation.py +491 -0
  39. elecsus4-4.0.0b1/elecsus/libs/plot_style.py +116 -0
  40. elecsus4-4.0.0b1/elecsus/libs/solve_dielectric.py +262 -0
  41. elecsus4-4.0.0b1/elecsus/libs/spectra.py +1467 -0
  42. elecsus4-4.0.0b1/elecsus/libs/sz_lsi.py +76 -0
  43. elecsus4-4.0.0b1/elecsus/sample_data/README.md +33 -0
  44. elecsus4-4.0.0b1/elecsus/sample_data/rb_d2_doppler_40C.csv +3001 -0
  45. elecsus4-4.0.0b1/elecsus/tests/__init__.py +0 -0
  46. elecsus4-4.0.0b1/elecsus/tests/briscoe_2025_theory_repro.py +234 -0
  47. elecsus4-4.0.0b1/elecsus/tests/golden/es3_reference.npz +0 -0
  48. elecsus4-4.0.0b1/elecsus/tests/golden/generate_es3_reference.py +131 -0
  49. elecsus4-4.0.0b1/elecsus/tests/literature.py +174 -0
  50. elecsus4-4.0.0b1/elecsus/tests/test_api_loose_ends.py +54 -0
  51. elecsus4-4.0.0b1/elecsus/tests/test_buffer_gas.py +90 -0
  52. elecsus4-4.0.0b1/elecsus/tests/test_buffer_gas_data.py +129 -0
  53. elecsus4-4.0.0b1/elecsus/tests/test_buffer_gas_fits.py +171 -0
  54. elecsus4-4.0.0b1/elecsus/tests/test_cascade.py +477 -0
  55. elecsus4-4.0.0b1/elecsus/tests/test_default_propagation.py +98 -0
  56. elecsus4-4.0.0b1/elecsus/tests/test_deprecated_params.py +51 -0
  57. elecsus4-4.0.0b1/elecsus/tests/test_doppler_temperature.py +93 -0
  58. elecsus4-4.0.0b1/elecsus/tests/test_energy_levels.py +266 -0
  59. elecsus4-4.0.0b1/elecsus/tests/test_es3_golden.py +155 -0
  60. elecsus4-4.0.0b1/elecsus/tests/test_faraday_outputs.py +121 -0
  61. elecsus4-4.0.0b1/elecsus/tests/test_field_angles.py +66 -0
  62. elecsus4-4.0.0b1/elecsus/tests/test_fieldgradient.py +522 -0
  63. elecsus4-4.0.0b1/elecsus/tests/test_fit_api_edges.py +311 -0
  64. elecsus4-4.0.0b1/elecsus/tests/test_fit_arguments.py +235 -0
  65. elecsus4-4.0.0b1/elecsus/tests/test_fit_bounds.py +159 -0
  66. elecsus4-4.0.0b1/elecsus/tests/test_fit_keys.py +149 -0
  67. elecsus4-4.0.0b1/elecsus/tests/test_fit_limits.py +145 -0
  68. elecsus4-4.0.0b1/elecsus/tests/test_fit_propagation.py +95 -0
  69. elecsus4-4.0.0b1/elecsus/tests/test_fit_restarts.py +128 -0
  70. elecsus4-4.0.0b1/elecsus/tests/test_fit_result.py +64 -0
  71. elecsus4-4.0.0b1/elecsus/tests/test_fitting.py +159 -0
  72. elecsus4-4.0.0b1/elecsus/tests/test_fitting_buffer_gas.py +79 -0
  73. elecsus4-4.0.0b1/elecsus/tests/test_geometry_conventions.py +215 -0
  74. elecsus4-4.0.0b1/elecsus/tests/test_gui_angles.py +64 -0
  75. elecsus4-4.0.0b1/elecsus/tests/test_gui_callbacks.py +225 -0
  76. elecsus4-4.0.0b1/elecsus/tests/test_gui_cascade.py +203 -0
  77. elecsus4-4.0.0b1/elecsus/tests/test_gui_fixes.py +441 -0
  78. elecsus4-4.0.0b1/elecsus/tests/test_gui_inputs.py +200 -0
  79. elecsus4-4.0.0b1/elecsus/tests/test_gui_layout.py +105 -0
  80. elecsus4-4.0.0b1/elecsus/tests/test_gui_levels.py +202 -0
  81. elecsus4-4.0.0b1/elecsus/tests/test_gui_model_controls.py +423 -0
  82. elecsus4-4.0.0b1/elecsus/tests/test_gui_wavelength.py +152 -0
  83. elecsus4-4.0.0b1/elecsus/tests/test_gui_wiring.py +254 -0
  84. elecsus4-4.0.0b1/elecsus/tests/test_hyperfine_levels.py +148 -0
  85. elecsus4-4.0.0b1/elecsus/tests/test_kelvin_offset.py +21 -0
  86. elecsus4-4.0.0b1/elecsus/tests/test_kramers_kronig.py +82 -0
  87. elecsus4-4.0.0b1/elecsus/tests/test_line_frequencies.py +117 -0
  88. elecsus4-4.0.0b1/elecsus/tests/test_measured_data.py +144 -0
  89. elecsus4-4.0.0b1/elecsus/tests/test_measured_fits.py +257 -0
  90. elecsus4-4.0.0b1/elecsus/tests/test_non_orthogonal.py +165 -0
  91. elecsus4-4.0.0b1/elecsus/tests/test_param_validation.py +238 -0
  92. elecsus4-4.0.0b1/elecsus/tests/test_plot_style.py +43 -0
  93. elecsus4-4.0.0b1/elecsus/tests/test_poynting.py +68 -0
  94. elecsus4-4.0.0b1/elecsus/tests/test_psi_dolp.py +84 -0
  95. elecsus4-4.0.0b1/elecsus/tests/test_random_restart.py +195 -0
  96. elecsus4-4.0.0b1/elecsus/tests/test_release_metadata.py +159 -0
  97. elecsus4-4.0.0b1/elecsus/tests/test_reversed_pass.py +124 -0
  98. elecsus4-4.0.0b1/elecsus/tests/test_rotation_matrices.py +130 -0
  99. elecsus4-4.0.0b1/elecsus/tests/test_rotondaro.py +261 -0
  100. elecsus4-4.0.0b1/elecsus/tests/test_rr_final_fit.py +99 -0
  101. elecsus4-4.0.0b1/elecsus/tests/test_sample_data.py +40 -0
  102. elecsus4-4.0.0b1/elecsus/tests/test_solver_shortcuts.py +151 -0
  103. elecsus4-4.0.0b1/elecsus/tests/test_spectroscopy.py +258 -0
  104. elecsus4-4.0.0b1/elecsus/tests/test_sum_rule.py +214 -0
  105. elecsus4-4.0.0b1/elecsus/tests/test_symmetries.py +182 -0
  106. elecsus4-4.0.0b1/elecsus/tests/test_validate_command.py +54 -0
  107. elecsus4-4.0.0b1/elecsus/tests/test_window_fresnel.py +68 -0
  108. elecsus4-4.0.0b1/elecsus/validate.py +204 -0
  109. elecsus4-4.0.0b1/elecsus4.egg-info/PKG-INFO +705 -0
  110. elecsus4-4.0.0b1/elecsus4.egg-info/SOURCES.txt +113 -0
  111. elecsus4-4.0.0b1/elecsus4.egg-info/dependency_links.txt +1 -0
  112. elecsus4-4.0.0b1/elecsus4.egg-info/requires.txt +24 -0
  113. elecsus4-4.0.0b1/elecsus4.egg-info/top_level.txt +1 -0
  114. elecsus4-4.0.0b1/pyproject.toml +101 -0
  115. elecsus4-4.0.0b1/setup.cfg +4 -0
@@ -0,0 +1,18 @@
1
+ {
2
+ "title": "ElecSus",
3
+ "description": "A program to calculate the weak-probe electric susceptibility, refractive index and transmission spectra of thermal alkali-metal vapours, and to fit the model to experimental data.",
4
+ "version": "4.0.0b1",
5
+ "upload_type": "software",
6
+ "access_right": "open",
7
+ "license": "Apache-2.0",
8
+ "creators": [
9
+ {"name": "Wrathmall, S. A.", "affiliation": "Durham University"},
10
+ {"name": "Potvliege, R. M.", "affiliation": "Durham University"},
11
+ {"name": "Hughes, I. G.", "affiliation": "Durham University"},
12
+ {"name": "Zentile, M. A."},
13
+ {"name": "Keaveney, J."},
14
+ {"name": "Weller, L."},
15
+ {"name": "Whiting, D. J."},
16
+ {"name": "Adams, C. S."}
17
+ ]
18
+ }
@@ -0,0 +1,27 @@
1
+ ElecSus — Authors
2
+ =================
3
+
4
+ ElecSus is open-source software for calculating the electric susceptibility,
5
+ refractive index and transmission spectra of thermal alkali-metal vapours, and
6
+ for fitting the model to experimental data. Authorship by version:
7
+
8
+ Versions 1-3 (2014-2018)
9
+ M. A. Zentile
10
+ J. Keaveney
11
+ L. Weller
12
+ D. Whiting
13
+ C. S. Adams
14
+ I. G. Hughes
15
+
16
+ Version 4 (2026)
17
+ S. A. Wrathmall
18
+ R. M. Potvliege
19
+ I. G. Hughes
20
+
21
+ The per-file copyright headers record the authors of individual modules.
22
+ Copyright is held by the respective authors under the Apache License,
23
+ Version 2.0 (see LICENSE.txt).
24
+
25
+ If ElecSus contributes to a publication, please cite:
26
+ M. A. Zentile et al., Comput. Phys. Commun. 189, 162-174 (2015)
27
+ J. Keaveney et al., Comput. Phys. Commun. 224, 311-324 (2018)
@@ -0,0 +1,230 @@
1
+ # Changelog
2
+
3
+ ElecSus 4 is installed from PyPI as `elecsus4` and imported as `elecsus`.
4
+ Until 4.0.0 its versions are pre-releases: betas (4.0.0b1, 4.0.0b2, …), then
5
+ release candidates. **Breaking** marks a change that can make existing code
6
+ fail or give different results.
7
+
8
+ ## 4.0.0b1 — beta
9
+
10
+ The first beta of ElecSus 4, and its first release on PyPI. Since 4.0.0a1 the
11
+ physics, the fitting and the new GUI have been tested against first
12
+ principles, the literature and measured spectra (Briscoe et al. 2025, Rb D2 in
13
+ an oblique field; Alqarni et al. 2025, K D1 with neon), and the errors those
14
+ tests found have been fixed. Many of them are in ElecSus 3 too. The interface
15
+ is now frozen: until 4.0.0, a change that alters a result or removes a
16
+ parameter will be listed here, with its reason.
17
+
18
+ Coming from ElecSus 3? Read *Results that change* below, and *Backwards
19
+ compatibility* in the README.
20
+
21
+ ### Results that change
22
+
23
+ - **The geometry is the documented one.** **Breaking** wherever a sense
24
+ matters. ElecSus 3, and 4.0.0a1, computed the mirror image (y → −y) of the
25
+ geometry they document. **B** is now along (sin θ cos φ, sin θ sin φ,
26
+ cos θ), with `Btheta` = θ measured from +z, the direction of the light, and
27
+ `Bphi` = φ from x towards y. ElecSus 3's result for (`Btheta`, `Bphi`) is
28
+ ElecSus 4's for (π − `Btheta`, −`Bphi`).
29
+ - A Faraday rotation has the opposite sense, and in a transverse field
30
+ with `Bphi` ≠ 0, light polarised along the field's azimuth is now the π
31
+ mode.
32
+ - Transmission of linear light in a zero or longitudinal field is
33
+ unchanged.
34
+ - Briscoe et al.'s measured spectra are reproduced with the input
35
+ polarisation of the experiment, [cos θ_E, sin θ_E]; 4.0.0a1 needed
36
+ [cos θ_E, −sin θ_E]. (ElecSus 3, whose oblique propagation was also
37
+ wrong, is closer with [cos θ_E, sin θ_E], but misses the data either way.)
38
+ - **`Plus` and `Minus` name σ⁺ and σ⁻.** **Breaking.** `ChiPlus`, `nPlus`,
39
+ `phiPlus` and `TransLeft` are the σ⁺ quantities, as ElecSus 3's docstrings
40
+ said, and `…Minus` and `TransRight` the σ⁻ ones; ElecSus 3 returned each
41
+ under the other's name. `alphaPlus` and `alphaMinus` are unchanged. So
42
+ does `elecsus.libs.spectra.calc_chi`: it returns (σ⁺, σ⁻, π), where
43
+ ElecSus 3 returned the σ⁻ susceptibility first.
44
+ - **Fractional Stokes parameters.** **Breaking.** `S1`, `S2` and `S3` are
45
+ divided by `S0`, so they lie in [−1, 1]; ElecSus 3 returned intensity
46
+ differences. `S3` has ElecSus 3's sign, Born & Wolf's: `S3` > 0 for
47
+ right-circular light, so `[1, 1j]/√2` light has `S3` = −1. 4.0.0a1 had
48
+ reversed it.
49
+ - **Oblique fields: the non-orthogonal modes are the default.** **Breaking**
50
+ for `Btheta` other than 0, π/2 and π. `use_non_orthogonal` now defaults to
51
+ `True`. ElecSus 3 projected the light onto the vapour's two modes as if they
52
+ were orthogonal, which is exact only in Faraday and Voigt geometry. In an
53
+ oblique field its `S0` is wrong (Rb D2, 2 mm, 120 °C, 239 G) by up to
54
+ 0.03 at 30°, 0.07 at 45° and 0.48 at 80° for x-polarised light, and by up
55
+ to 0.07, 0.13 and 0.53 for the worst linear polarisation. Faraday and Voigt results are
56
+ unchanged, and `use_non_orthogonal=False` still gives ElecSus 3's method.
57
+ - **Exact line frequencies.** ElecSus 3 truncated every line's frequency to
58
+ whole MHz. Every spectrum changes slightly (`S0` by up to ~3×10⁻³, the
59
+ fractional `S1`–`S3` by up to ~2×10⁻²), and ML fits of `Bfield` no longer
60
+ stall near their starting value.
61
+ - **⁴¹K D1.** The 4²P₁/₂ hyperfine constant of ⁴¹K was the ground state's
62
+ (127.007 MHz, for a measured 15.245 MHz), so its D1 lines were up to
63
+ ~140 MHz out. Natural potassium D1 spectra change slightly near them.
64
+ - **The reversed pass absorbs.** Since ElecSus 3.0.0, `wavevector_dirn=-1`
65
+ made the vapour amplify light where it should absorb it (a transmission of
66
+ ~10⁶² on resonance; the Faraday rotation came out right). The reversed pass
67
+ is now a forward pass in the frame turned by π about x, and a round trip
68
+ equals one pass through twice the length. `wavevector_dirn` takes only 1
69
+ or −1.
70
+ - **B along −x** (`Btheta` = 3π/2 or −π/2) gave `S0` ~ 10¹⁰ in 4.0.0a1
71
+ (ElecSus 3 was not affected). Angles a whole turn apart now give the same
72
+ spectrum.
73
+ - **Buffer-gas data.** Each of the 58 entries was checked against its source,
74
+ now named in `elecsus/libs/BufferGasData.py`. Since 4.0.0a1, eleven
75
+ changed: broadenings by up to 15 % (Cs D1/He) and shifts by up to 24 %
76
+ (Rb D2/Kr).
77
+ - **Buffer-gas model.** **Breaking.** `shift` is now added to the model's
78
+ pressure shift, as an offset of the frequency axis; the model used to
79
+ replace it. With `Constrain=False` the model is evaluated at `DoppTemp`, the
80
+ temperature of the gas in the beam, not at `T` (2.8 % more broadening and
81
+ shift for an 80 °C stem and a 100 °C body).
82
+ - **Cascades.** With `polariser_angle` set, the instrument-total `S3` of
83
+ `calculate_cascade` had 4.0.0a1's sign; it now has `calculate`'s. Where an opaque first cell lets no
84
+ light through, the second cell's outputs are 0, not NaN. **Breaking:**
85
+ `reset_polarisation` needs `polariser_angle`. Without a polariser it made a
86
+ circular state of the same intensity, which no passive optic can do.
87
+ - **Smaller changes:**
88
+ - one Kelvin offset, 273.15 (the Boltzmann populations used 273.16), which
89
+ moves `S0` by ~10⁻⁸;
90
+ - a field below 0.01 G at an oblique angle is no longer taken to lie along
91
+ ±z, which made its Faraday rotation too large, the more so the nearer
92
+ the field is to transverse (6 times at 85°, 300 times at 89.9°);
93
+ - `phi` has the sense of the measured rotation when **B** is along −z
94
+ (4.0.0a1 had the opposite);
95
+ - the light leaving the cell on the non-orthogonal path is transverse
96
+ (`S0` counted the modes' longitudinal part, up to ~2×10⁻⁶ of it);
97
+ - with `Constrain=False` and no `DoppTemp`, the Doppler width is taken at
98
+ `T`; it was taken at 20 °C.
99
+
100
+ ### Added
101
+
102
+ - **A browser GUI**: `python -m elecsus.elecsus_dash_gui`, after
103
+ `pip install "elecsus4[gui]"`. Spectra, fits to your data or to a bundled
104
+ sample spectrum, two-cell filters and energy-level diagrams, each with CSV
105
+ export; plots against detuning or wavelength. It works offline.
106
+ - **Energy levels and transitions** (`elecsus.energy_levels`). For one isotope
107
+ in a field: the levels, labelled by their |mJ, mI⟩ components and the
108
+ |F, mF⟩ state each joins at zero field; the σ⁺, σ⁻ and π lines, with the
109
+ detunings and strengths the spectra use; the levels against field; and
110
+ `level_diagram`, which draws it all above the spectrum, with a stick
111
+ spectrum below. `python -m elecsus.energy_levels ISOTOPE LINE B --out FILE`
112
+ draws it and prints the lines.
113
+ - **Fitting the buffer-gas pressure**: `fit_data` can vary `BufferPressure`,
114
+ with the buffer-gas model on.
115
+ - **Six tutorial notebooks** in `Notebooks/`, with their output.
116
+ - **Checks of the physics that take nothing from ElecSus**: the
117
+ integrated-absorption sum rule against the measured oscillator strengths,
118
+ Kramers–Kronig, Breit–Rabi and the measured hyperfine constants, and the
119
+ symmetries (B → −B, B = 0, S0 ≤ 1, purity). `python -m elecsus.validate`
120
+ runs them, with the comparison against ElecSus 3.
121
+ - **Checked parameters.** An unknown `p_dict` key raises `ValueError`, naming
122
+ the closest valid one (`strict=False` makes it a warning): a mistyped
123
+ `n_window` or `use_non_orthogonal` used to switch that feature off in
124
+ silence. A value outside the model's range (a negative `lcell`, an isotope
125
+ fraction outside 0–100, a temperature below absolute zero, `n_window` below
126
+ 1, an unsupported element or line) raises before anything is computed.
127
+ - `elecsus.__version__`.
128
+
129
+ ### Changed
130
+
131
+ - **Packaging.** ElecSus 4 is on PyPI as `elecsus4`, and is still imported as
132
+ `elecsus`. It is built from `pyproject.toml`, with the extras `gui`, `test`
133
+ and `dev`, and needs Python 3.10, NumPy 1.24, SciPy 1.10, matplotlib 3.7
134
+ and lmfit 1.3.4 or newer. `sympy` and `psutil` are no longer dependencies.
135
+ - **Breaking:** `elecsus/libs/` no longer puts itself on `sys.path`, where it
136
+ registered `spectra`, `EigenSystem`, `AtomConstants` and eight other modules
137
+ under top-level names. Import them as `from elecsus.libs import spectra`.
138
+ - Intensity-like outputs (`S0`–`S3`, `Ix`, `Iy`, `I_P45`, `I_M45`, `Il`, `Ir`,
139
+ `psi`, `DoLP`) are `float64`. They were `complex128`, with an imaginary part
140
+ of ~10⁻¹⁷.
141
+ - `n_window` on its own applies the window model; with
142
+ `use_non_orthogonal=False` it warns that the windows are not modelled.
143
+ - `fit_data` refuses to vary what the data cannot determine, naming it: both
144
+ `E_x` and `E_y` (only their ratio is observable), `BufferTemp_fill`
145
+ (degenerate with the pressure), `BufferPressure` with the buffer-gas model
146
+ off, and `GammaBuf` with it on.
147
+
148
+ ### Fixed
149
+
150
+ Most of these are in ElecSus 3 too.
151
+
152
+ - **Fits use the model you ask for.** The ML fit, which is the default and the
153
+ last stage of differential evolution, dropped `use_non_orthogonal`,
154
+ `n_window` and `wavevector_dirn`, so it fitted the orthogonal, windowless
155
+ model (a temperature 7 °C out in an oblique field). Random restart's last
156
+ fit was a Rb D2 fit without the buffer gas, whatever was asked for.
157
+ `BoltzmannFactor` now reaches the fit model.
158
+ - **Fits stay in the physical range.** Search windows, `p_dict_bounds` and
159
+ random restart's starts are kept inside each parameter's range, so a
160
+ negative width or pressure no longer stops a fit. An unphysical starting
161
+ value is refused by name; a random-restart start whose fit leaves the range
162
+ is dropped, with a warning.
163
+ - **Fits keep what they find for the input polarisation** (`E_x`, `E_y`,
164
+ `E_phase`). After differential evolution, and in random restart, the last
165
+ fit started again from the original `E_in`.
166
+ - **`fit_data` rejects what it used to ignore**: a misspelt keyword (so
167
+ `datatype='S1'` fitted the S0 model), an unknown `fit_algorithm` (which ran
168
+ random restart), and an unknown key in `p_dict`, `p_dict_bools` or
169
+ `p_dict_bounds` (`strict=False` makes the last a warning, as in
170
+ `calculate`).
171
+ - **`p_dict_bounds` reaches random restart** as the width of its search, as
172
+ documented; it was ignored. Each entry is checked in the form its algorithm
173
+ takes.
174
+ - **`fit_data`'s arguments and result.** `data` is `[x, y]`, 2×N, as the code
175
+ always read it: the docstrings said N×2, and an N×2 array was fitted as two
176
+ points. Anything else raises `ValueError`. `E_in` may be the Jones vector
177
+ `[Ex, Ey, 0]` that `calculate` takes, and lmfit's bounds no longer turn
178
+ right-circular light into linear light. `Elem`, `Dline`, `Bfield`, `T` and
179
+ `lcell` may be left out, as in `calculate`. The best parameters returned can
180
+ be passed straight back to `calculate`.
181
+ - **Parameters that crashed or were ignored** now raise or warn, by name:
182
+ `Elem='Ideal'`, which has no susceptibility model; `K40frac` + `K41frac`
183
+ above 100; switches given as strings (`'False'` switched the non-orthogonal
184
+ solver on); `E_x`, `E_y` or `E_phase` given to `calculate`, which takes
185
+ `E_in`; part of an ElecSus 3 input field (`E_x` without `E_y` and `E_phase`)
186
+ in a fit's `p_dict`; and `BufferPressure` without `BufferGas`.
187
+ - A single detuning works: `calculate(5.0, ...)`. `calculate_cascade` takes
188
+ `strict`.
189
+ - Importing ElecSus no longer silences every warning in your session,
190
+ ElecSus's own included. Its warnings point at the line that called it.
191
+ - `python -m elecsus.validate` says when pytest is missing.
192
+ - The plot style falls back to another serif font where Times New Roman is
193
+ not installed, instead of printing a warning for every label it draws.
194
+ - `RotationMatrices` and `JonesMatrices` no longer use the deprecated
195
+ `np.matrix`.
196
+
197
+ ### Removed
198
+
199
+ - **Simulated annealing** (`fit_algorithm='SA'`) raises `ValueError`. It had
200
+ not run on Linux or macOS since ElecSus 3.0.0, and differential evolution
201
+ (`'DE'`) does the same job faster.
202
+ - **ElecSus 3's wxPython GUI.** The browser GUI replaces it.
203
+
204
+ ## 4.0.0a1 — alpha
205
+
206
+ The first ElecSus 4 pre-release, on GitHub only.
207
+
208
+ ### Added
209
+
210
+ - **Non-orthogonal propagation** in oblique fields, validated against
211
+ Briscoe et al. (2025): `use_non_orthogonal=True`, the default since 4.0.0b1.
212
+ - **An analytic solver for the modes in oblique fields**, ~130× faster than
213
+ ElecSus 3's SymPy path, with corrected eigenmodes.
214
+ - **An optional model of the cell windows**, four Fresnel interfaces, set by
215
+ `n_window`. The default, `None`, is a cell without windows, which reproduces
216
+ Briscoe et al.'s Eq. 9; `n_window=1.51` models borosilicate glass.
217
+ - **A buffer-gas model**: `BufferGas`, `BufferPressure` and `BufferTemp_fill`,
218
+ validated on K D1 with neon against Alqarni et al. (2025).
219
+ - **Two cells in series**: `calculate_cascade()`, with an optional polariser
220
+ between them (magneto-optical filters).
221
+ - **New outputs**: the Stokes azimuth `psi` and the degree of linear
222
+ polarisation `DoLP`; the refractive indices n(σ±), the Faraday rotation φ
223
+ and α_π; and the Poynting-flux transmission `S0_P`.
224
+ - **Validation**: a regression test against stored output of ElecSus 3.0.8,
225
+ `python -m elecsus.validate`, and continuous integration.
226
+
227
+ ### Changed
228
+
229
+ - **Breaking:** `S1`, `S2` and `S3` are fractional (divided by `S0`), and the
230
+ sign of `S3` was reversed; 4.0.0b1 restores ElecSus 3's.
@@ -0,0 +1,53 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use this software, please cite the software (this record) and the papers under preferred-citation."
3
+ title: ElecSus
4
+ abstract: "A program to calculate the weak-probe electric susceptibility, refractive index and transmission spectra of thermal alkali-metal vapours, and to fit the model to experimental data."
5
+ type: software
6
+ version: 4.0.0b1
7
+ date-released: 2026-11-22
8
+ # Zenodo's concept DOI, which every version of the software shares
9
+ doi: 10.5281/zenodo.21509735
10
+ license: Apache-2.0
11
+ repository-code: "https://github.com/durham-qlm/ElecSus"
12
+ authors:
13
+ - family-names: Wrathmall
14
+ given-names: S. A.
15
+ affiliation: Durham University
16
+ - family-names: Potvliege
17
+ given-names: R. M.
18
+ affiliation: Durham University
19
+ - family-names: Hughes
20
+ given-names: I. G.
21
+ affiliation: Durham University
22
+ - family-names: Zentile
23
+ given-names: M. A.
24
+ - family-names: Keaveney
25
+ given-names: J.
26
+ - family-names: Weller
27
+ given-names: L.
28
+ - family-names: Whiting
29
+ given-names: D. J.
30
+ - family-names: Adams
31
+ given-names: C. S.
32
+ preferred-citation:
33
+ type: article
34
+ title: "ElecSus: A program to calculate the electric susceptibility of an atomic ensemble"
35
+ authors:
36
+ - family-names: Zentile
37
+ given-names: M. A.
38
+ - family-names: Keaveney
39
+ given-names: J.
40
+ - family-names: Weller
41
+ given-names: L.
42
+ - family-names: Whiting
43
+ given-names: D. J.
44
+ - family-names: Adams
45
+ given-names: C. S.
46
+ - family-names: Hughes
47
+ given-names: I. G.
48
+ journal: "Computer Physics Communications"
49
+ volume: 189
50
+ start: 162
51
+ end: 174
52
+ year: 2015
53
+ doi: 10.1016/j.cpc.2014.11.023
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
@@ -0,0 +1,5 @@
1
+ include *.txt
2
+ include AUTHORS CHANGELOG.md CITATION.cff .zenodo.json
3
+ recursive-include elecsus/sample_data *.csv *.md
4
+ include elecsus/tests/golden/es3_reference.npz
5
+ recursive-include elecsus/assets *.css *.woff2 *.txt *.md