mbsolver 0.6.0__tar.gz → 0.7.0__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 (32) hide show
  1. {mbsolver-0.6.0/src/mbsolver.egg-info → mbsolver-0.7.0}/PKG-INFO +72 -52
  2. {mbsolver-0.6.0 → mbsolver-0.7.0}/README.md +69 -50
  3. {mbsolver-0.6.0 → mbsolver-0.7.0}/pyproject.toml +4 -2
  4. mbsolver-0.7.0/src/mbsolver/three_level/__init__.py +260 -0
  5. mbsolver-0.7.0/src/mbsolver/three_level/_kernel_1d.py +170 -0
  6. mbsolver-0.7.0/src/mbsolver/three_level/sample.py +79 -0
  7. {mbsolver-0.6.0 → mbsolver-0.7.0/src/mbsolver.egg-info}/PKG-INFO +72 -52
  8. {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver.egg-info/SOURCES.txt +1 -0
  9. mbsolver-0.7.0/src/mbsolver.egg-info/requires.txt +12 -0
  10. mbsolver-0.7.0/tests/test_small_signal_gain.py +61 -0
  11. mbsolver-0.7.0/tests/test_three_level.py +236 -0
  12. mbsolver-0.6.0/src/mbsolver/three_level/__init__.py +0 -176
  13. mbsolver-0.6.0/src/mbsolver/three_level/_kernel_1d.py +0 -140
  14. mbsolver-0.6.0/src/mbsolver/three_level/sample.py +0 -85
  15. mbsolver-0.6.0/src/mbsolver.egg-info/requires.txt +0 -7
  16. mbsolver-0.6.0/tests/test_three_level.py +0 -113
  17. {mbsolver-0.6.0 → mbsolver-0.7.0}/LICENSE +0 -0
  18. {mbsolver-0.6.0 → mbsolver-0.7.0}/setup.cfg +0 -0
  19. {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/__init__.py +0 -0
  20. {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/constants.py +0 -0
  21. {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/grids.py +0 -0
  22. {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/profiles.py +0 -0
  23. {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/sample.py +0 -0
  24. {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/two_level/__init__.py +0 -0
  25. {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/two_level/_kernel_1d.py +0 -0
  26. {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/two_level/_kernel_adiabatic_1d.py +0 -0
  27. {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver.egg-info/dependency_links.txt +0 -0
  28. {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver.egg-info/top_level.txt +0 -0
  29. {mbsolver-0.6.0 → mbsolver-0.7.0}/tests/test_profiles.py +0 -0
  30. {mbsolver-0.6.0 → mbsolver-0.7.0}/tests/test_sample.py +0 -0
  31. {mbsolver-0.6.0 → mbsolver-0.7.0}/tests/test_two_level.py +0 -0
  32. {mbsolver-0.6.0 → mbsolver-0.7.0}/tests/test_two_level_adiabatic.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mbsolver
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: Fast Maxwell-Bloch solvers for masers, superradiance and coherent pulse propagation
5
5
  Author: Toktam Rashidi
6
6
  Author-email: Vahid Anari <vahid.anari8@gmail.com>
@@ -23,7 +23,8 @@ Requires-Python: >=3.10
23
23
  Description-Content-Type: text/markdown
24
24
  License-File: LICENSE
25
25
  Requires-Dist: numpy>=1.24
26
- Requires-Dist: numba>=0.58
26
+ Requires-Dist: numba<0.63,>=0.58; sys_platform == "darwin" and platform_machine == "x86_64"
27
+ Requires-Dist: numba>=0.58; sys_platform != "darwin" or platform_machine != "x86_64"
27
28
  Provides-Extra: dev
28
29
  Requires-Dist: build; extra == "dev"
29
30
  Requires-Dist: twine; extra == "dev"
@@ -40,9 +41,8 @@ Dynamic: license-file
40
41
 
41
42
  Fast Maxwell-Bloch solvers in Python (numpy + numba) for astrophysical masers,
42
43
  superradiance and coherent pulse propagation. Use them from scripts,
43
- notebooks or cluster jobs; the
44
- [Maxwell Bloch Studio](https://github.com/vahid-anari/maxwell-bloch-studio)
45
- desktop app runs on the same code.
44
+ notebooks or cluster jobs; the Maxwell Bloch Studio desktop app runs on
45
+ the same code.
46
46
 
47
47
  ## Installation
48
48
 
@@ -50,7 +50,8 @@ desktop app runs on the same code.
50
50
  pip install mbsolver
51
51
  ```
52
52
 
53
- Requires Python 3.10+ (numpy and numba are installed with it).
53
+ Requires Python 3.10+ (numpy and numba are installed with it). On Intel Macs numba
54
+ stays at 0.62, the last version built for them; with it, Python 3.10–3.13 are supported there.
54
55
 
55
56
  ## Two-level model in one dimension
56
57
 
@@ -121,61 +122,66 @@ directly. The limit differs from the full system during the first few `T2`
121
122
  and in bursts faster than `T2`; see the section on it in
122
123
  [`docs/two_level.pdf`](docs/two_level.pdf).
123
124
 
124
- ## Three-level (Λ) model in one dimension
125
+ ## Three-level model in one dimension
125
126
 
126
- Levels 1 and 2 lie below level 3; the transitions 3→1 and 3→2 carry the fields
127
- `E31` and `E32`. With the population differences `n31 = n3 − n1`,
128
- `n32 = n3 − n2` and the coherences `R31`, `R32`, `R21` (all real):
127
+ Levels are ordered by energy, `E1 < E2 < E3`. Two of the three transitions
128
+ are dipole allowed and carry fields; the third is forbidden:
129
+
130
+ | `config` | allowed | forbidden |
131
+ |------------|-------------|-----------|
132
+ | `"lambda"` | 3→1, 3→2 | 2↔1 |
133
+ | `"v"` | 2→1, 3→1 | 3↔2 |
134
+ | `"ladder"` | 2→1, 3→2 | 3↔1 |
135
+
136
+ With `n_ij = n_i − n_j`, `W_ij = ½ E_ij R_ij` and fields as Rabi frequencies,
137
+ the dimensionless equations along `0 ≤ z ≤ 1` are
129
138
 
130
139
  ```
131
- dn31/dt = −(E31 R31 + ½ E32 R32) − (n31 − n31⁰) / T1_31 + Λ31(t)
132
- dn32/dt = −(½ E31 R31 + E32 R32) − (n32 − n32⁰) / T1_32 + Λ32(t)
133
- dR31/dt = E31 n31 − ½ E32 R21 − (R31 − R31⁰) / T2_31
134
- dR32/dt = E32 n32 − ½ E31 R21 − (R32 − R32⁰) / T2_32
135
- dR21/dt = ½ (E31 R32 + E32 R31) − (R21 − R21⁰) / T2_21
136
- dE31/dz = η R31, dE32/dz = R32, η = ω d²
140
+ dn1/dt = W21 + W31, dn2/dt = W32 − W21, dn3/dt = −W31 − W32
141
+ dR21/dt = E21 n21 + ½ (E31 R32 + E32 R31) − (R21 − R21⁰) / T2_21
142
+ dR31/dt = E31 n31 + ½ (E21 R32 − E32 R21) − (R31 − R31⁰) / T2_31
143
+ dR32/dt = E32 n32 − ½ (E21 R31 + E31 R21) − (R32 − R32⁰) / T2_32
144
+ dE_ij/dz = η_ij R_ij
137
145
  ```
138
146
 
139
- with `d = |d31/d32|` and `ω = k31/k32`. Time is in units of the 3→2 time
140
- scale `T0 = 2ε0ħ / (n0 L k32 |d32|²)`. The initial state comes from the
141
- population ratios `r1 = n3/n1`, `r2 = n3/n2` and the coherence fractions
142
- `c_ij`: `R_ij⁰ = c_ij · 2√(n_i n_j)`.
147
+ The field of the forbidden transition is zero. The population differences of
148
+ the two allowed transitions relax with their `T1` and are pumped. In Λ and V
149
+ the two transitions compete for the shared level; in the ladder, emission on
150
+ the upper step raises the inversion of the lower one (a cascade).
143
151
 
144
152
  ```python
145
- from mbsolver import Pulse
153
+ import math
146
154
  from mbsolver.three_level import solve_1d
147
155
 
148
156
  res = solve_1d(
149
- t_max=2500, nt=4000, nz=400, d=0.875, omega=35.95,
150
- r1=0.94, r2=2.33e19, c31=1e-10, c32=1.0, # c21 = 0 by default
151
- t1_31=31.3, t1_32=313, t2_31=2.96, t2_32=29.6, # t2_21 = inf by default
152
- pump32=Pulse(a=5.63e-3, x0=795.5, w=154.8), # pump31, field31_in, field32_in too
157
+ config="ladder", t_max=200, nt=2001, nz=101,
158
+ n_init=(0.05, 0.05, 0.9), # (n1, n2, n3), summing to 1
159
+ eta21=10.0, eta32=10.0, # couplings of the allowed transitions
160
+ c21=1e-3, c32=1e-3, # seeds: R_ij⁰ = c_ij · 2√(n_i n_j)
161
+ t1_21=math.inf, t1_32=math.inf,
162
+ t2_21=math.inf, t2_32=math.inf, # t2 of the forbidden pair: inf by default
153
163
  )
154
- res.intensity32[-1] # 3→2 intensity leaving the medium
164
+ res.e32[-1], res.e21[-1] # upper step bursts first, then the lower one
155
165
  ```
156
166
 
157
- `t1_*` and `t2_*` take numbers or `Steps`, the pumps and entrance fields
158
- `Pulse`s, numbers or lists, as in the two-level model. The result holds
159
- `time`, `z`, the fields `e31`, `e32`, the intensities `intensity31 = (E31/d)²`
160
- and `intensity32 = E32²` (both in units of the 3→2 scale), `n31`, `n32`,
161
- `r31`, `r32`, `r21` (shape `(n_planes, nt)`), and the pumps, entrance fields
162
- and relaxation times on the time grid.
167
+ `eta_ij`, `t1_ij`, `pump_ij` and `field_ij_in` are given only for the allowed
168
+ transitions; `t2_ij` and `c_ij` exist for all three coherences. Relaxation
169
+ times take numbers or `Steps`, pumps and entrance fields `Pulse`s, numbers or
170
+ lists, as in the two-level model. The result holds `time`, `z`, the fields
171
+ `e21`, `e31`, `e32`, the differences `n21`, `n31`, `n32` and the coherences
172
+ `r21`, `r31`, `r32` (shape `(n_planes, nt)`), and the inputs on the time grid.
163
173
 
164
- `populations(r1, r2)` gives `n1`, `n2`, `n3`, `n31⁰`, `n32⁰` and the largest
165
- coherences. `scaling(nu31, nu32, d31, d32, l, n0)` (SI units;
166
- `mbsolver.constants.DEBYE` converts dipoles from debye) gives `d`, `omega`,
167
- `eta`, `t0`, the field and intensity scales `e0`, `i0` (and `i0_jy` = 10²⁶ `i0`)
168
- and the pump scale `lambda0 = n0/t0`. By default the decay rate of the 3→2
169
- line is the Einstein A computed from `d32`; pass `gamma=` to use a measured one.
174
+ Time is in units of a free time unit `T0`; each transition has
175
+ `η_ij = T0 / T_R` with the cooperation time `T_R = 2ε0ħ / (n0 L k_ij |d_ij|²)`.
176
+ `mbsolver.three_level.scaling(t0=, l=, n0=, nu31=, d31=, ...)` computes, for
177
+ each transition given by its frequency and its dipole moment (or Einstein
178
+ coefficient `gamma_ij`), `eta_ij`, `t_r_ij` and the field and intensity scales
179
+ `e0_ij`, `i0_ij`; `mbsolver.constants.DEBYE` converts dipoles from debye.
170
180
 
171
181
  The three-level equations were derived and checked with Toktam Rashidi. The
172
182
  derivation, from the Hamiltonian to the dimensionless equations, with the
173
- initial conditions, physical scales and the S255IR-NIRS3 values, is in
174
- [`docs/three_level.pdf`](docs/three_level.pdf);
175
- [`examples/three_level/s255_flare.py`](examples/three_level/s255_flare.py)
176
- runs the S255IR-NIRS3 flare and plots it with the observed flux (needs
177
- matplotlib). The observations are from the Toruń 32 m telescope,
178
- [Szymczak et al. 2018, A&A 617, A80](https://doi.org/10.1051/0004-6361/201833443).
183
+ three configurations, initial conditions and physical scales, is in
184
+ [`docs/three_level.pdf`](docs/three_level.pdf).
179
185
 
180
186
  ## From physical values: `scaling` (two-level)
181
187
 
@@ -189,8 +195,8 @@ import math
189
195
  import mbsolver
190
196
  from mbsolver.two_level import solve_1d
191
197
 
192
- s = mbsolver.scaling(nu=6.67e9, gamma=1.56e-9, t0=86400, l=7.5e12, n0=5.3e-7)
193
- res = solve_1d(t_max=2000, nt=20001, nz=101, eta=s["eta"], theta0=s["theta0"],
198
+ s = mbsolver.scaling(nu=1.0e9, gamma=1.0e-8, t0=1.0e4, l=1.0e12, n0=1.0e-5) # η ≈ 10.7
199
+ res = solve_1d(t_max=100, nt=20001, nz=101, eta=s["eta"], theta0=s["theta0"],
194
200
  t1=math.inf, t2=math.inf)
195
201
  ```
196
202
 
@@ -200,6 +206,17 @@ and intensity scales for an electric dipole (`d`, `e0`, `p0`, `i0_electric`)
200
206
  and a magnetic dipole (`mu`, `b0`, `m0`, `i0_magnetic`). Times in the solver
201
207
  are in units of `t0`.
202
208
 
209
+ ## Examples
210
+
211
+ Two short scripts in [`examples/`](examples) (in the repository, not in the
212
+ PyPI package; they need matplotlib):
213
+
214
+ - [`examples/two_level/burst.py`](examples/two_level/burst.py): superradiant
215
+ bursts of a fully inverted two-level medium for three couplings η.
216
+ - [`examples/three_level/configurations.py`](examples/three_level/configurations.py):
217
+ the Λ, V and ladder configurations side by side, showing the competition for
218
+ a shared level and the ladder's cascade.
219
+
203
220
  ## Profiles
204
221
 
205
222
  `Pulse(a, x0, w)` is a sum of sech² pulses, `a_i sech²((t − x0_i) / w_i)`.
@@ -221,8 +238,10 @@ pytest
221
238
 
222
239
  The tests include a reference run that must match the solver of the Maxwell
223
240
  Bloch app (version 8.13) exactly, and physics checks (Bloch rotation at the
224
- entrance, relaxation balance, uncoupled propagation). The three-level model
225
- matches the 2025 three-level solver exactly for the S255IR-NIRS3 case. `scaling`
241
+ entrance, relaxation balance, uncoupled propagation, small-signal gain). The three-level
242
+ Λ case must match a stored run of the earlier Λ-only solver; all three configurations
243
+ are checked for purity conservation, Bloch rotation and the reduction to the two-level
244
+ model. `scaling`
226
245
  is checked against the values of Maxwell Bloch Studio.
227
246
 
228
247
  The model documents `docs/two_level.pdf` and `docs/three_level.pdf` are built
@@ -261,12 +280,13 @@ MIT License. See [LICENSE](LICENSE).
261
280
 
262
281
  Vahid Anari ·
263
282
  [GitHub](https://github.com/vahid-anari) ·
264
- [LinkedIn](https://www.linkedin.com/in/vahid-anari/)
283
+ [LinkedIn](https://www.linkedin.com/in/vahid-anari/) ·
284
+ [ORCID](https://orcid.org/0000-0002-2464-3989)
265
285
 
266
286
  Toktam Rashidi ·
267
- [GitHub](https://github.com/ToktamS) ·
268
- [LinkedIn](https://www.linkedin.com/in/toktam-r-71951996/)
287
+ [GitHub](https://github.com/toktamrashidi) ·
288
+ [LinkedIn](https://www.linkedin.com/in/toktam-r-71951996/) ·
289
+ [ORCID](https://orcid.org/0009-0007-2978-7985)
269
290
 
270
291
  Related projects: [sciwidgets](https://github.com/vahid-anari/sciwidgets) ·
271
- [Maxwell Bloch Studio](https://github.com/vahid-anari/maxwell-bloch-studio) ·
272
292
  [linecat](https://github.com/vahid-anari/linecat)
@@ -8,9 +8,8 @@
8
8
 
9
9
  Fast Maxwell-Bloch solvers in Python (numpy + numba) for astrophysical masers,
10
10
  superradiance and coherent pulse propagation. Use them from scripts,
11
- notebooks or cluster jobs; the
12
- [Maxwell Bloch Studio](https://github.com/vahid-anari/maxwell-bloch-studio)
13
- desktop app runs on the same code.
11
+ notebooks or cluster jobs; the Maxwell Bloch Studio desktop app runs on
12
+ the same code.
14
13
 
15
14
  ## Installation
16
15
 
@@ -18,7 +17,8 @@ desktop app runs on the same code.
18
17
  pip install mbsolver
19
18
  ```
20
19
 
21
- Requires Python 3.10+ (numpy and numba are installed with it).
20
+ Requires Python 3.10+ (numpy and numba are installed with it). On Intel Macs numba
21
+ stays at 0.62, the last version built for them; with it, Python 3.10–3.13 are supported there.
22
22
 
23
23
  ## Two-level model in one dimension
24
24
 
@@ -89,61 +89,66 @@ directly. The limit differs from the full system during the first few `T2`
89
89
  and in bursts faster than `T2`; see the section on it in
90
90
  [`docs/two_level.pdf`](docs/two_level.pdf).
91
91
 
92
- ## Three-level (Λ) model in one dimension
92
+ ## Three-level model in one dimension
93
93
 
94
- Levels 1 and 2 lie below level 3; the transitions 3→1 and 3→2 carry the fields
95
- `E31` and `E32`. With the population differences `n31 = n3 − n1`,
96
- `n32 = n3 − n2` and the coherences `R31`, `R32`, `R21` (all real):
94
+ Levels are ordered by energy, `E1 < E2 < E3`. Two of the three transitions
95
+ are dipole allowed and carry fields; the third is forbidden:
96
+
97
+ | `config` | allowed | forbidden |
98
+ |------------|-------------|-----------|
99
+ | `"lambda"` | 3→1, 3→2 | 2↔1 |
100
+ | `"v"` | 2→1, 3→1 | 3↔2 |
101
+ | `"ladder"` | 2→1, 3→2 | 3↔1 |
102
+
103
+ With `n_ij = n_i − n_j`, `W_ij = ½ E_ij R_ij` and fields as Rabi frequencies,
104
+ the dimensionless equations along `0 ≤ z ≤ 1` are
97
105
 
98
106
  ```
99
- dn31/dt = −(E31 R31 + ½ E32 R32) − (n31 − n31⁰) / T1_31 + Λ31(t)
100
- dn32/dt = −(½ E31 R31 + E32 R32) − (n32 − n32⁰) / T1_32 + Λ32(t)
101
- dR31/dt = E31 n31 − ½ E32 R21 − (R31 − R31⁰) / T2_31
102
- dR32/dt = E32 n32 − ½ E31 R21 − (R32 − R32⁰) / T2_32
103
- dR21/dt = ½ (E31 R32 + E32 R31) − (R21 − R21⁰) / T2_21
104
- dE31/dz = η R31, dE32/dz = R32, η = ω d²
107
+ dn1/dt = W21 + W31, dn2/dt = W32 − W21, dn3/dt = −W31 − W32
108
+ dR21/dt = E21 n21 + ½ (E31 R32 + E32 R31) − (R21 − R21⁰) / T2_21
109
+ dR31/dt = E31 n31 + ½ (E21 R32 − E32 R21) − (R31 − R31⁰) / T2_31
110
+ dR32/dt = E32 n32 − ½ (E21 R31 + E31 R21) − (R32 − R32⁰) / T2_32
111
+ dE_ij/dz = η_ij R_ij
105
112
  ```
106
113
 
107
- with `d = |d31/d32|` and `ω = k31/k32`. Time is in units of the 3→2 time
108
- scale `T0 = 2ε0ħ / (n0 L k32 |d32|²)`. The initial state comes from the
109
- population ratios `r1 = n3/n1`, `r2 = n3/n2` and the coherence fractions
110
- `c_ij`: `R_ij⁰ = c_ij · 2√(n_i n_j)`.
114
+ The field of the forbidden transition is zero. The population differences of
115
+ the two allowed transitions relax with their `T1` and are pumped. In Λ and V
116
+ the two transitions compete for the shared level; in the ladder, emission on
117
+ the upper step raises the inversion of the lower one (a cascade).
111
118
 
112
119
  ```python
113
- from mbsolver import Pulse
120
+ import math
114
121
  from mbsolver.three_level import solve_1d
115
122
 
116
123
  res = solve_1d(
117
- t_max=2500, nt=4000, nz=400, d=0.875, omega=35.95,
118
- r1=0.94, r2=2.33e19, c31=1e-10, c32=1.0, # c21 = 0 by default
119
- t1_31=31.3, t1_32=313, t2_31=2.96, t2_32=29.6, # t2_21 = inf by default
120
- pump32=Pulse(a=5.63e-3, x0=795.5, w=154.8), # pump31, field31_in, field32_in too
124
+ config="ladder", t_max=200, nt=2001, nz=101,
125
+ n_init=(0.05, 0.05, 0.9), # (n1, n2, n3), summing to 1
126
+ eta21=10.0, eta32=10.0, # couplings of the allowed transitions
127
+ c21=1e-3, c32=1e-3, # seeds: R_ij⁰ = c_ij · 2√(n_i n_j)
128
+ t1_21=math.inf, t1_32=math.inf,
129
+ t2_21=math.inf, t2_32=math.inf, # t2 of the forbidden pair: inf by default
121
130
  )
122
- res.intensity32[-1] # 3→2 intensity leaving the medium
131
+ res.e32[-1], res.e21[-1] # upper step bursts first, then the lower one
123
132
  ```
124
133
 
125
- `t1_*` and `t2_*` take numbers or `Steps`, the pumps and entrance fields
126
- `Pulse`s, numbers or lists, as in the two-level model. The result holds
127
- `time`, `z`, the fields `e31`, `e32`, the intensities `intensity31 = (E31/d)²`
128
- and `intensity32 = E32²` (both in units of the 3→2 scale), `n31`, `n32`,
129
- `r31`, `r32`, `r21` (shape `(n_planes, nt)`), and the pumps, entrance fields
130
- and relaxation times on the time grid.
134
+ `eta_ij`, `t1_ij`, `pump_ij` and `field_ij_in` are given only for the allowed
135
+ transitions; `t2_ij` and `c_ij` exist for all three coherences. Relaxation
136
+ times take numbers or `Steps`, pumps and entrance fields `Pulse`s, numbers or
137
+ lists, as in the two-level model. The result holds `time`, `z`, the fields
138
+ `e21`, `e31`, `e32`, the differences `n21`, `n31`, `n32` and the coherences
139
+ `r21`, `r31`, `r32` (shape `(n_planes, nt)`), and the inputs on the time grid.
131
140
 
132
- `populations(r1, r2)` gives `n1`, `n2`, `n3`, `n31⁰`, `n32⁰` and the largest
133
- coherences. `scaling(nu31, nu32, d31, d32, l, n0)` (SI units;
134
- `mbsolver.constants.DEBYE` converts dipoles from debye) gives `d`, `omega`,
135
- `eta`, `t0`, the field and intensity scales `e0`, `i0` (and `i0_jy` = 10²⁶ `i0`)
136
- and the pump scale `lambda0 = n0/t0`. By default the decay rate of the 3→2
137
- line is the Einstein A computed from `d32`; pass `gamma=` to use a measured one.
141
+ Time is in units of a free time unit `T0`; each transition has
142
+ `η_ij = T0 / T_R` with the cooperation time `T_R = 2ε0ħ / (n0 L k_ij |d_ij|²)`.
143
+ `mbsolver.three_level.scaling(t0=, l=, n0=, nu31=, d31=, ...)` computes, for
144
+ each transition given by its frequency and its dipole moment (or Einstein
145
+ coefficient `gamma_ij`), `eta_ij`, `t_r_ij` and the field and intensity scales
146
+ `e0_ij`, `i0_ij`; `mbsolver.constants.DEBYE` converts dipoles from debye.
138
147
 
139
148
  The three-level equations were derived and checked with Toktam Rashidi. The
140
149
  derivation, from the Hamiltonian to the dimensionless equations, with the
141
- initial conditions, physical scales and the S255IR-NIRS3 values, is in
142
- [`docs/three_level.pdf`](docs/three_level.pdf);
143
- [`examples/three_level/s255_flare.py`](examples/three_level/s255_flare.py)
144
- runs the S255IR-NIRS3 flare and plots it with the observed flux (needs
145
- matplotlib). The observations are from the Toruń 32 m telescope,
146
- [Szymczak et al. 2018, A&A 617, A80](https://doi.org/10.1051/0004-6361/201833443).
150
+ three configurations, initial conditions and physical scales, is in
151
+ [`docs/three_level.pdf`](docs/three_level.pdf).
147
152
 
148
153
  ## From physical values: `scaling` (two-level)
149
154
 
@@ -157,8 +162,8 @@ import math
157
162
  import mbsolver
158
163
  from mbsolver.two_level import solve_1d
159
164
 
160
- s = mbsolver.scaling(nu=6.67e9, gamma=1.56e-9, t0=86400, l=7.5e12, n0=5.3e-7)
161
- res = solve_1d(t_max=2000, nt=20001, nz=101, eta=s["eta"], theta0=s["theta0"],
165
+ s = mbsolver.scaling(nu=1.0e9, gamma=1.0e-8, t0=1.0e4, l=1.0e12, n0=1.0e-5) # η ≈ 10.7
166
+ res = solve_1d(t_max=100, nt=20001, nz=101, eta=s["eta"], theta0=s["theta0"],
162
167
  t1=math.inf, t2=math.inf)
163
168
  ```
164
169
 
@@ -168,6 +173,17 @@ and intensity scales for an electric dipole (`d`, `e0`, `p0`, `i0_electric`)
168
173
  and a magnetic dipole (`mu`, `b0`, `m0`, `i0_magnetic`). Times in the solver
169
174
  are in units of `t0`.
170
175
 
176
+ ## Examples
177
+
178
+ Two short scripts in [`examples/`](examples) (in the repository, not in the
179
+ PyPI package; they need matplotlib):
180
+
181
+ - [`examples/two_level/burst.py`](examples/two_level/burst.py): superradiant
182
+ bursts of a fully inverted two-level medium for three couplings η.
183
+ - [`examples/three_level/configurations.py`](examples/three_level/configurations.py):
184
+ the Λ, V and ladder configurations side by side, showing the competition for
185
+ a shared level and the ladder's cascade.
186
+
171
187
  ## Profiles
172
188
 
173
189
  `Pulse(a, x0, w)` is a sum of sech² pulses, `a_i sech²((t − x0_i) / w_i)`.
@@ -189,8 +205,10 @@ pytest
189
205
 
190
206
  The tests include a reference run that must match the solver of the Maxwell
191
207
  Bloch app (version 8.13) exactly, and physics checks (Bloch rotation at the
192
- entrance, relaxation balance, uncoupled propagation). The three-level model
193
- matches the 2025 three-level solver exactly for the S255IR-NIRS3 case. `scaling`
208
+ entrance, relaxation balance, uncoupled propagation, small-signal gain). The three-level
209
+ Λ case must match a stored run of the earlier Λ-only solver; all three configurations
210
+ are checked for purity conservation, Bloch rotation and the reduction to the two-level
211
+ model. `scaling`
194
212
  is checked against the values of Maxwell Bloch Studio.
195
213
 
196
214
  The model documents `docs/two_level.pdf` and `docs/three_level.pdf` are built
@@ -229,12 +247,13 @@ MIT License. See [LICENSE](LICENSE).
229
247
 
230
248
  Vahid Anari ·
231
249
  [GitHub](https://github.com/vahid-anari) ·
232
- [LinkedIn](https://www.linkedin.com/in/vahid-anari/)
250
+ [LinkedIn](https://www.linkedin.com/in/vahid-anari/) ·
251
+ [ORCID](https://orcid.org/0000-0002-2464-3989)
233
252
 
234
253
  Toktam Rashidi ·
235
- [GitHub](https://github.com/ToktamS) ·
236
- [LinkedIn](https://www.linkedin.com/in/toktam-r-71951996/)
254
+ [GitHub](https://github.com/toktamrashidi) ·
255
+ [LinkedIn](https://www.linkedin.com/in/toktam-r-71951996/) ·
256
+ [ORCID](https://orcid.org/0009-0007-2978-7985)
237
257
 
238
258
  Related projects: [sciwidgets](https://github.com/vahid-anari/sciwidgets) ·
239
- [Maxwell Bloch Studio](https://github.com/vahid-anari/maxwell-bloch-studio) ·
240
259
  [linecat](https://github.com/vahid-anari/linecat)
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mbsolver"
7
- version = "0.6.0"
7
+ version = "0.7.0"
8
8
  description = "Fast Maxwell-Bloch solvers for masers, superradiance and coherent pulse propagation"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -32,7 +32,9 @@ classifiers = [
32
32
  ]
33
33
  dependencies = [
34
34
  "numpy>=1.24",
35
- "numba>=0.58",
35
+ # numba (and llvmlite) have no Intel-Mac wheels after 0.62 (0.45): newer ones would be compiled from source
36
+ "numba>=0.58,<0.63; sys_platform == 'darwin' and platform_machine == 'x86_64'",
37
+ "numba>=0.58; sys_platform != 'darwin' or platform_machine != 'x86_64'",
36
38
  ]
37
39
 
38
40
  [project.optional-dependencies]