Metadata-Version: 2.4
Name: sqzcomb
Version: 0.20.0
Summary: Squeezed light and timing noise in Kerr microcombs: Lugiato-Lefever steady states, linearized quantum noise, detected output spectra, and the Raman noise of glass
Author-email: "Tanvir M. Mahim" <tanvir.mahim@bracu.ac.bd>
License-Expression: Apache-2.0
Project-URL: Homepage, https://tanvir-mahmud-mahim.github.io/software/
Project-URL: Repository, https://github.com/TaN-MM-Org/sqzcomb
Project-URL: Issues, https://github.com/TaN-MM-Org/sqzcomb/issues
Project-URL: Changelog, https://github.com/TaN-MM-Org/sqzcomb/releases
Keywords: squeezed light,microcomb,Kerr,Lugiato-Lefever,quantum optics,homodyne,soliton,timing jitter,Raman,fluctuation-dissipation
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.22
Requires-Dist: scipy>=1.10
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Provides-Extra: interop
Requires-Dist: qutip>=4.7; extra == "interop"
Dynamic: license-file

# sqzcomb

[![PyPI](https://img.shields.io/pypi/v/sqzcomb)](https://pypi.org/project/sqzcomb/) [![DOI](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.22015375-blue)](https://doi.org/10.5281/zenodo.22015375) [![tests](https://github.com/TaN-MM-Org/sqzcomb/actions/workflows/ci.yml/badge.svg)](https://github.com/TaN-MM-Org/sqzcomb/actions)

`sqzcomb` is a free Python package for the quantum noise of light in
Kerr microcombs: small ring resonators that turn one pump laser into a
comb of evenly spaced lines. It started with one question: how much
squeezed light (noise below the quantum floor) does such a ring deliver
to a detector? It follows the light from the field circulating in the
ring, through the quantum noise around it, to the number a detector on
the output fiber would report. Squeezing inside the ring is not what an
experiment sees; only what leaves through the port is.

Since version 0.20 it also computes how much the glass itself adds to
that noise: the Raman noise of the glass, which sets how steadily a
soliton comb ticks, and how much it takes from squeezed light.

Every model is checked against an exact answer, a published number or
an independent calculation, in tests you can run yourself. When an
input cannot give a result you can trust, the package stops and says
why instead of printing a number that only looks right.

## What it can do

**Squeezed light, from the ring to the detector**

- The field in the ring (flat states, solitons, soliton crystals) from
  the Lugiato-Lefever equation, and the quantum noise around it.
- The squeezing a detector would see, at each analysis frequency, with
  the best local-oscillator angle found exactly, also the best single
  angle for a whole band.
- What loss, detector electronics and phase jitter take away, and the
  budget a target needs.
- Two coupled rings, rings with different line spacings, entangled
  pairs of lines, pulsed pumps, above-threshold and non-Gaussian
  states, and classical noise of the ring and the pump.

**From the lab bench**

- Linewidth, escape efficiency and coupling from a transmission scan
  (also split resonances, and the phase of the transmission).
- The Kerr shift per photon from the threshold power, raw
  spectrum-analyzer traces turned into dB relative to shot noise with
  error bars, fits of measured spectra, and what a measured pair of
  squeezed and antisqueezed levels says about the source.
- Planning: will the planned measurement pin down the numbers, and how
  hard to pump for a target squeezing.

**The Raman noise of glass, and soliton timing (new in 0.20)**

- The Raman response of silica (three published models), its noise
  from the fluctuation-dissipation theorem, and the simple law that
  turns a measured self-frequency shift into the size of that noise.
- The timing noise of a soliton microcomb, with the vacuum and the
  Raman parts, from the exact linear theory, with the full Raman drag:
  ratios, spectra in s^2/Hz, phase noise of a microwave carrier,
  temperature, and avoided mode crossings.
- The Raman noise added to any squeezing spectrum.

## Install

```
pip install sqzcomb              # needs NumPy and SciPy
pip install sqzcomb[interop]     # adds QuTiP, for drift_from_qutip only
```

It needs Python 3.9 or newer, NumPy 1.22 or newer and SciPy 1.10 or
newer. For development: clone the repository and
`pip install -e .[test]`.

## A first look

The physics runs in the usual normalized units of the Lugiato-Lefever
equation (rates in units of half the linewidth); a noise variance of
0.5 is the vacuum level. The reference page lists every convention.

**Squeezing from a pumped ring, at four output couplings**

```python
import numpy as np
from sqzcomb import (lle_evolve, homogeneous_steady_states,
                     fluctuation_matrix, output_quadrature_variance,
                     squeezing_db)

F, alpha = 0.9, 0.3                          # illustrative, below threshold
psi = lle_evolve(np.full(16, 0.05 + 0j), F=F, alpha=alpha, t_end=100.0)
print(f"|psi|^2 from the solver: {abs(psi[0]) ** 2:.6f}")
print(f"root of the cubic:       {homogeneous_steady_states(F, alpha)[0]:.6f}")

M, modes = fluctuation_matrix(psi, alpha)    # quantum noise around it
i0 = int(np.where(modes == 0)[0][0])         # the pumped line
phis = np.linspace(0.0, np.pi, 181)
for eta in (0.2, 0.5, 0.8, 1.0):
    best = min(squeezing_db(output_quadrature_variance(
        M, eta, 0.0, i0, modes.size, phi=p)) for p in phis)
    print(f"eta = {eta}: best squeezing {best:6.3f} dB")
```

```
|psi|^2 from the solver: 0.698836
root of the cubic:       0.698836
eta = 0.2: best squeezing -0.730 dB
eta = 0.5: best squeezing -2.126 dB
eta = 0.8: best squeezing -4.194 dB
eta = 1.0: best squeezing -6.460 dB
```

`eta` is the fraction of the ring's loss that goes into the output
fiber. The more of the light that leaves through the port, the more
squeezing a detector can see.

**How steadily a soliton comb ticks, and what the glass adds**

```python
import sqzcomb as sq

comb = sq.SolitonComb(fsr_hz=21.9e9, linewidth_hz=2.1e6,
                      detuning_hz=9.5 * 2.1e6, soliton_width_s=131e-15,
                      reference="device A of Table 1, Mahim et al. (2026)")
glass = sq.scaled_to_shock_time(sq.silica_response("hc"), 2.49e-15,
                                comb.width)  # measured shock time
for t in sq.soliton_timing_noise(comb, temperature=[300.0, 77.0, 0.0],
                                 response=glass):
    print(f"{t.temperature:5.0f} K: Raman/vacuum {t.raman_to_vacuum:.2f}, "
          f"total/vacuum-only {t.total_over_vacuum_only:.2f}")
print(f"self-frequency shift {t.frequency_shift_hz / 1e9:.1f} GHz, "
      f"repetition rate {t.repetition_rate_shift_hz / 1e3:+.1f} kHz")
print(f"grid check {t.grid_change:.0e}, slowest decay "
      f"{t.largest_growth_rate:.2f} (stable)")
```

```
  300 K: Raman/vacuum 5.20, total/vacuum-only 5.18
   77 K: Raman/vacuum 1.49, total/vacuum-only 2.08
    0 K: Raman/vacuum 0.76, total/vacuum-only 1.47
self-frequency shift -226.7 GHz, repetition rate -132.5 kHz
grid check 2e-16, slowest decay -0.82 (stable)
```

A soliton's arrival time wanders because random kicks change its
speed. The usual "fundamental" floor counts only the vacuum noise that
enters through the ring's losses. The glass adds its own kicks: the
vibrations that drag the soliton's spectrum to the red (here by 227 GHz)
also flicker, and at room temperature they add about four times the
vacuum noise for this silica ring. Cooling removes most of it.

## Learn more

The details live in the `docs` folder:

- [Examples](https://github.com/TaN-MM-Org/sqzcomb/blob/main/docs/examples.md):
  34 worked examples, each with the output it prints, and three
  tutorials that go from synthetic measured data to results with error
  bars.
- [Reference](https://github.com/TaN-MM-Org/sqzcomb/blob/main/docs/reference.md):
  a short guide to the words used, units and conventions, every
  function by topic, the cases where the package refuses to answer,
  and where the methods come from.
- [How it is checked](https://github.com/TaN-MM-Org/sqzcomb/blob/main/docs/checks.md):
  what each test compares against and how closely, and the corrections
  made in past versions.
- [Limits](https://github.com/TaN-MM-Org/sqzcomb/blob/main/docs/limits.md):
  what the models leave out, in detail.
- [Changes](https://github.com/TaN-MM-Org/sqzcomb/blob/main/CHANGELOG.md)
  from version to version.

## How it is checked

376 automated tests run on every change, on Python 3.9 to 3.14 and
with the oldest NumPy, SciPy and QuTiP the package allows. They compare
against a closed-form result, an exact identity, a published number or
the same quantity worked out a second, different way; none compares
against a number stored from an earlier run. Two examples: a passive
ring returns exactly the vacuum level at any coupling and frequency,
and the timing noise reproduces the published tables of the Raman
paper and agrees with a Monte-Carlo simulation of the full nonlinear
equation. The full list is in
[How it is checked](https://github.com/TaN-MM-Org/sqzcomb/blob/main/docs/checks.md).

## What it does not do

The main gaps, in plain terms:

- The quantum noise is the usual linearized (Gaussian) picture around
  a steady state. Above threshold and for few photons there are exact
  tools, but only for a few modes.
- The noise of the ring's material other than the Raman noise of glass
  (thermorefractive noise, the pump laser's noise) is not computed from
  physics: you supply its spectrum, with its source, and the package
  carries it to the detector.
- Only silica's Raman response ships. The models are anchored at
  terahertz frequencies; below about 0.5 THz they are extrapolations,
  and Brillouin scattering and guided acoustic waves are not included.
- The timing model is one soliton with dispersion up to D2, without
  dispersive waves other than single shifted resonances, without the
  coupling of counter-propagating solitons and without the measurement
  chain.
- No material numbers for the ring itself: its Kerr index, loss and
  dispersion come from you, with their source.
- There is no paid support. Questions and bug reports go to the
  [issue tracker](https://github.com/TaN-MM-Org/sqzcomb/issues).

The full list is in [Limits](https://github.com/TaN-MM-Org/sqzcomb/blob/main/docs/limits.md).

## Citing

If sqzcomb helps your work, please cite it with the concept DOI
[10.5281/zenodo.22015375](https://doi.org/10.5281/zenodo.22015375),
which always points to the latest version
([CITATION.cff](https://github.com/TaN-MM-Org/sqzcomb/blob/main/CITATION.cff)
has the details). The squeezing methods were developed for

> T. M. Mahim, M. M. Rahman and A. S. M. Mohsin, "Overcoming the 3 dB
> squeezing extraction limit in silicon carbide microcombs with a
> photonic molecule," Optics Express 34(18), 34822-34834 (2026),
> https://doi.org/10.1364/OE.612248

and the Raman noise and timing tools follow

> T. M. Mahim, M. M. Rahman and A. S. M. Mohsin, "The Raman
> self-frequency shift predicts thermal timing noise in soliton
> microcombs" (manuscript, 2026).

The other sources each part builds on are listed in the
[Reference](https://github.com/TaN-MM-Org/sqzcomb/blob/main/docs/reference.md#where-it-comes-from).

## Who makes it

Written and maintained by Tanvir Mahmud Mahim (Department of Electrical
and Electronic Engineering, BRAC University), who reviews every change.
Contributions are welcome: see
[CONTRIBUTING.md](https://github.com/TaN-MM-Org/sqzcomb/blob/main/CONTRIBUTING.md).
A change to the physics comes with a test, and a new number comes with
its source. While the version is below 1.0 the API may still change
between minor versions; such changes are named in the release notes.

Licensed under Apache-2.0.
