cavsqueeze
Beyond-mean-field simulation of cavity-mediated spin squeezing (one-axis twisting) for solid-state clock-transition ensembles, and of squeezing by measurement of the spin population through the resonator. Developed for 171Yb3+:CaWO4 and applicable to any spin ensemble coupled to a resonator.
cavsqueeze implements
- the adiabatically eliminated Tavis-Cummings model with collective emission,
collective thermal absorption, single-spin dephasing and coupling inhomogeneity
(
resonator.py); - discretization of Gaussian, Lorentzian and Voigt lines into frequency classes with
tail resolution (
ensemble.py); - a class-resolved second-order cumulant expansion in connected variables, whose
cost is set by the number of classes rather than by N, so that N = 1e15 is no
harder than N = 1e3, and which loses no precision to cancellation at large N
because the means are subtracted analytically (
cumulant.py), together with the raw-moment form used as a test reference (cumulant_raw.py); the solver can condition the ensemble on a continuous measurement of J_z through the resonator (Rates.meas,Rates.meas_eta); - exact references: QuTiP master equation for distinguishable spins and the
permutation-invariant Dicke solver PIQS (
exact.py); - pulse sequences: echo twist, Ramsey, twist-untwist readout, plain squeezed readout
(
protocols.py); - far-detuned spectator spins propagated analytically, which removes the stiffness of
heavy-tailed lines (
ensemble.tail_resolved_classes,cumulant.evolve); - an independent solver for cross-checking: discrete truncated Wigner trajectories
(
dtwa.py), which truncate the equations of motion rather than the statistics.
Installation
From PyPI:
pip install cavsqueeze # core solver (numpy, scipy, matplotlib)
pip install cavsqueeze[exact] # adds QuTiP for the exact reference solvers
Or from source, to run the tests:
git clone https://github.com/TaN-MM-Org/cavsqueeze
cd cavsqueeze
pip install -e .[test]
pytest tests # validation testbench (about 2 minutes)
The test suite validates the cumulant solver against exact QuTiP and PIQS references, against closed-form limits, and against the independent discrete truncated Wigner solver; it runs in CI on every push and pull request.
Minimal example
import numpy as np
from cavsqueeze import from_hz, homogeneous
from cavsqueeze.protocols import optimal_squeezing
N = 1e10
p = from_hz(g_hz=1e6/np.sqrt(N), kappa_hz=1e4, Delta_hz=30e6, T=0.02, T2=0.15)
best = optimal_squeezing(p, homogeneous(N), 1e-6, 1e-2)
print(10*np.log10(best["xi2"]), "dB at", best["t"], "s")
Associated paper
The physics, the conventions and the validation of this package are described in: T. M. Mahim, M. M. Rahman, A. S. M. Mohsin, Synchronization sets the coherence and the squeezing limit of a spin ensemble in a cavity. The paper's companion repository, yb-cawo4-cavity-squeezing, contains the scripts, datasets and figures that reproduce the paper and is archived on Zenodo; this repository is the software's home for development, releases and support.
Contributing and support
Bug reports, questions and pull requests are welcome through GitHub issues; see CONTRIBUTING.md for the development setup and the testing requirements. Tagged releases are published to PyPI by CI.
License
Apache-2.0 (see LICENSE). Please cite the paper if you use this code; citation metadata is in CITATION.cff.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cavsqueeze-1.7.0.tar.gz.
File metadata
- Download URL: cavsqueeze-1.7.0.tar.gz
- Upload date:
- Size: 36.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83d561fe712ddebc8ecdd9fd092139e7a6139faecd94d93d7f4b0b645bc32454
|
|
| MD5 |
a3eb318c278d714387544aba619aee0d
|
|
| BLAKE2b-256 |
fb7eb8fc74b0e862473dc413b41a218f395294f21078eab2f839fb03426d7e0b
|
Provenance
The following attestation bundles were made for cavsqueeze-1.7.0.tar.gz:
Publisher:
publish.yml on TaN-MM-Org/cavsqueeze
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cavsqueeze-1.7.0.tar.gz -
Subject digest:
83d561fe712ddebc8ecdd9fd092139e7a6139faecd94d93d7f4b0b645bc32454 - Sigstore transparency entry: 2698523688
- Sigstore integration time:
-
Permalink:
TaN-MM-Org/cavsqueeze@a1c2784318dd2f8165614f2aa2639e61adaa6520 -
Branch / Tag:
refs/tags/v1.7.0 - Owner: https://github.com/TaN-MM-Org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a1c2784318dd2f8165614f2aa2639e61adaa6520 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cavsqueeze-1.7.0-py3-none-any.whl.
File metadata
- Download URL: cavsqueeze-1.7.0-py3-none-any.whl
- Upload date:
- Size: 32.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
031b40762c60de21be44c0ecbbcac9ea7e3cff8a69e5e396965df2ad3ee40bbc
|
|
| MD5 |
552f5829a9e7bffd958a8cc967122070
|
|
| BLAKE2b-256 |
02ac96e22ae380fdd059a00dc1d4e33a4e6a3b445ce4412f78d7bb2ded944658
|
Provenance
The following attestation bundles were made for cavsqueeze-1.7.0-py3-none-any.whl:
Publisher:
publish.yml on TaN-MM-Org/cavsqueeze
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cavsqueeze-1.7.0-py3-none-any.whl -
Subject digest:
031b40762c60de21be44c0ecbbcac9ea7e3cff8a69e5e396965df2ad3ee40bbc - Sigstore transparency entry: 2698523775
- Sigstore integration time:
-
Permalink:
TaN-MM-Org/cavsqueeze@a1c2784318dd2f8165614f2aa2639e61adaa6520 -
Branch / Tag:
refs/tags/v1.7.0 - Owner: https://github.com/TaN-MM-Org
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a1c2784318dd2f8165614f2aa2639e61adaa6520 -
Trigger Event:
release
-
Statement type: