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.
- {mbsolver-0.6.0/src/mbsolver.egg-info → mbsolver-0.7.0}/PKG-INFO +72 -52
- {mbsolver-0.6.0 → mbsolver-0.7.0}/README.md +69 -50
- {mbsolver-0.6.0 → mbsolver-0.7.0}/pyproject.toml +4 -2
- mbsolver-0.7.0/src/mbsolver/three_level/__init__.py +260 -0
- mbsolver-0.7.0/src/mbsolver/three_level/_kernel_1d.py +170 -0
- mbsolver-0.7.0/src/mbsolver/three_level/sample.py +79 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0/src/mbsolver.egg-info}/PKG-INFO +72 -52
- {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver.egg-info/SOURCES.txt +1 -0
- mbsolver-0.7.0/src/mbsolver.egg-info/requires.txt +12 -0
- mbsolver-0.7.0/tests/test_small_signal_gain.py +61 -0
- mbsolver-0.7.0/tests/test_three_level.py +236 -0
- mbsolver-0.6.0/src/mbsolver/three_level/__init__.py +0 -176
- mbsolver-0.6.0/src/mbsolver/three_level/_kernel_1d.py +0 -140
- mbsolver-0.6.0/src/mbsolver/three_level/sample.py +0 -85
- mbsolver-0.6.0/src/mbsolver.egg-info/requires.txt +0 -7
- mbsolver-0.6.0/tests/test_three_level.py +0 -113
- {mbsolver-0.6.0 → mbsolver-0.7.0}/LICENSE +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/setup.cfg +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/__init__.py +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/constants.py +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/grids.py +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/profiles.py +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/sample.py +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/two_level/__init__.py +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/two_level/_kernel_1d.py +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver/two_level/_kernel_adiabatic_1d.py +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver.egg-info/dependency_links.txt +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/src/mbsolver.egg-info/top_level.txt +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/tests/test_profiles.py +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/tests/test_sample.py +0 -0
- {mbsolver-0.6.0 → mbsolver-0.7.0}/tests/test_two_level.py +0 -0
- {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.
|
|
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
|
|
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
|
-
|
|
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
|
|
125
|
+
## Three-level model in one dimension
|
|
125
126
|
|
|
126
|
-
Levels
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
|
|
132
|
-
|
|
133
|
-
dR31/dt = E31 n31
|
|
134
|
-
dR32/dt = E32 n32 − ½ E31 R21 − (R32 − R32⁰) / T2_32
|
|
135
|
-
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
-
|
|
153
|
+
import math
|
|
146
154
|
from mbsolver.three_level import solve_1d
|
|
147
155
|
|
|
148
156
|
res = solve_1d(
|
|
149
|
-
t_max=
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
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.
|
|
164
|
+
res.e32[-1], res.e21[-1] # upper step bursts first, then the lower one
|
|
155
165
|
```
|
|
156
166
|
|
|
157
|
-
`
|
|
158
|
-
`
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
`
|
|
162
|
-
and
|
|
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
|
-
|
|
165
|
-
|
|
166
|
-
`mbsolver.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
-
|
|
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=
|
|
193
|
-
res = solve_1d(t_max=
|
|
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
|
|
225
|
-
|
|
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/
|
|
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
|
-
|
|
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
|
|
92
|
+
## Three-level model in one dimension
|
|
93
93
|
|
|
94
|
-
Levels
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
dR31/dt = E31 n31
|
|
102
|
-
dR32/dt = E32 n32 − ½ E31 R21 − (R32 − R32⁰) / T2_32
|
|
103
|
-
|
|
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
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
|
|
120
|
+
import math
|
|
114
121
|
from mbsolver.three_level import solve_1d
|
|
115
122
|
|
|
116
123
|
res = solve_1d(
|
|
117
|
-
t_max=
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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.
|
|
131
|
+
res.e32[-1], res.e21[-1] # upper step bursts first, then the lower one
|
|
123
132
|
```
|
|
124
133
|
|
|
125
|
-
`
|
|
126
|
-
`
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
`
|
|
130
|
-
and
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
`mbsolver.
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
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=
|
|
161
|
-
res = solve_1d(t_max=
|
|
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
|
|
193
|
-
|
|
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/
|
|
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.
|
|
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
|
-
|
|
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]
|