Skip to main content

maxbloch

Fast Maxwell-Bloch solvers in Python (numpy + numba) for astrophysical masers, superradiance and coherent pulse propagation. Use them from scripts, notebooks or cluster jobs; the Maxwell Bloch Solver desktop app runs on the same code.

pip install maxbloch

Two-level model in one dimension

Dimensionless equations for the population inversion w, the coherence R and the field A along a medium 0 ≤ z ≤ 1:

dw/dt = A R − (w − w0) / T1 + Λ(t)
dR/dt = −A w − (R − R0) / T2
dA/dz = −η R

The field A(t) entering at z = 0 is given; population and coherence are advanced with fourth-order Runge-Kutta in time, the field step by step in z.

import matplotlib.pyplot as plt
from maxbloch import Pulse, Steps
from maxbloch.two_level import solve_1d

res = solve_1d(
    t_max=300, nt=3001, nz=121, eta=40.0,
    theta0=0.003,                                  # or w0=..., R0=...
    pump=[Pulse(a=[2e-3, 1e-3], x0=[60, 180], w=[15, 25])],
    field_in=Pulse(a=1e-3, x0=30, w=5),            # A(t) at z = 0
    t1=Steps(y=[80, 40, 60], x0=[100, 200], w=[10, 0]),
    t2=5.0,
    n_planes=7,                                    # stored z planes, 0 ... 1
)

plt.plot(res.time, res.intensity[-1])              # intensity leaving the medium
plt.show()

Arguments

Argument Meaning
t_max, nt time grid from 0 to t_max with nt points
nz number of z points
eta coupling coefficient η
theta0, or w0 and R0 initial state (w0 = cos θ0, R0 = sin θ0); the medium also relaxes towards it
t1, t2 relaxation times: a number or Steps (> 0, math.inf for none)
pump Λ(t): a Pulse, a number, or a list of them (summed)
field_in A(t) at z = 0: a Pulse, a number, or None
n_planes number of evenly spaced z planes returned (default 2: entrance and exit)

Result

res.time, res.z (positions of the stored planes), res.intensity and res.w (shape (n_planes, nt)), res.pump, res.field_in, res.t1, res.t2.

Profiles

Pulse(a, x0, w) is a sum of sech² pulses, a_i sech²((t − x0_i) / w_i). Give wl and wr instead of w for a different width on each side.

Steps(y, x0, w) goes from level y[0] to y[1] around x0[0], then to y[2] around x0[1], and so on, each step smoothed as (1 + tanh)/2 with width w (0 for a sharp step). x0 and w have one value fewer than y.

A zero width gives a single point (pulse) or a sharp step; an infinite width a constant. profile.evaluate(t) returns the values on any grid.

Tests

pip install -e ".[dev]"
pytest

The tests include a reference run that must match the Maxwell Bloch Solver app exactly, and physics checks (Bloch rotation at the entrance, relaxation balance, uncoupled propagation).

License

MIT

Metadata

Release files for maxbloch 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maxbloch 0.1.0
File Size Uploaded Provenance Actions
maxbloch-0.1.0.tar.gz 12.7 kB Without provenance Details for maxbloch-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for maxbloch 0.1.0
File Interpreter ABI Platform Actions
maxbloch-0.1.0-py3-none-any.whl Python 3 none any Details for maxbloch-0.1.0-py3-none-any.whl

Total release size: 23.5 kB

Release files / maxbloch-0.1.0.tar.gz

Download URL maxbloch-0.1.0.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
21ec49729400fccbd66d488019b3e8eb30d425d9edcc5f93fb828a486710db16
BLAKE2b-256 checksum
How to use checksums
c8e98e7f916fb37613f071214104596d5bea899f128332e5b2849c3d119edf66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / maxbloch-0.1.0-py3-none-any.whl

Download URL maxbloch-0.1.0-py3-none-any.whl
Size 10.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83305e3f014e4f847d22834db34e73fcbb620db74fa4499ce673505047540079
BLAKE2b-256 checksum
How to use checksums
c27b641a27f00cd2985965063a886564cb92254105c0702cd53f36b398cdb229
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Security for maxbloch 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page