absnoise
absnoise is a Python package about one question: how well can a
superconducting junction measure temperature, or detect a single
photon? The junctions in question are proximity Josephson junctions:
two superconductors joined by a short piece of normal (not
superconducting) conductor, in the shipped examples graphene. Such a
junction carries its supercurrent (a current that flows with zero
resistance) through a few discrete energy levels, the Andreev levels. Each level is
randomly filled and emptied, even in perfect thermal equilibrium. That
flicker -- not the readout electronics -- sets the final limit on how
well the junction can sense temperature.
The package follows the whole chain, from the levels to a detector:
- Where are the Andreev levels, and how do they move with phase and temperature?
- How large and how fast is the occupation flicker, and what temperature resolution does it allow?
- For a real device read out by a microwave resonator: what are the frequency-noise spectrum, the noise-equivalent power and the energy resolution for a single photon?
It also works backward from measured data: a critical-current curve, a readout time trace, or a noise spectrum. And it helps plan those measurements before the fridge time is spent.
The main results are checked by automated tests against exact formulas or a second, independent calculation (see How the results are checked). When a question cannot be answered from the data or parameters given, the package stops with an error that says why, instead of returning a number that looks fine but is not.
Contents
- A short guide to the words used here
- Install
- Units and conventions
- Examples (each with the output it prints)
- Tutorials (three end-to-end scripts in
examples/) - What changed in 0.17.0
- What changed in 0.16.0
- What changed in 0.14.0
- What changed in 0.13.0
- What changed in 0.12.0
- What changed in 0.11.0
- What is in the package
- When it refuses, and why
- How the results are checked
- Corrections in earlier versions
- Limits
- Where it comes from
- Citing, support and license
A short guide to the words used here
The junction
- Superconducting gap (
Delta) -- the energy a superconductor needs to break a pair of electrons. It shrinks as the temperature rises and closes at the critical temperatureTc. Here the gap is the one the superconductor induces in the junction (the "proximity gap"), taken asDelta = 1.764 kB Tcat zero temperature. - Phase (
phi) -- the phase difference across the junction, in radians. The supercurrent depends on it (the current-phase relation); the largest supercurrent is the critical currentIc. - Andreev levels -- discrete energy levels inside the gap that carry the supercurrent. Their energies depend on the phase.
- Transparency (
tau, between 0 and 1) -- how easily electrons pass the contacts.tau = 1is a perfectly clean contact. - Channel -- one of the separate paths (quantum modes) that electrons can take across the junction; a wide junction has many.
- Short junction -- a junction much shorter than the
superconducting coherence length
xi(roughly, how far the electron pairing of the superconductors reaches into the normal conductor). Then each channel has one level,E = Delta sqrt(1 - tau sin^2(phi/2)). For a longer junction the package solves the exact levels. - Recipe -- one junction design: materials,
Tc, size, gate voltage, transparency, measured critical current and resistance. - Matsubara sum: a standard way to write a thermal quantity as a
sum over the frequencies
(2n+1) pi kB T / hbar(n = 0, 1, 2, ...). For a junction it gives the free energy of the levels and of the continuum together, without finding the levels.
The noise
- Occupation -- whether a level holds an extra electron-like excitation (a quasiparticle). It flips between filled and empty at random: a telegraph signal.
- Correlation time (
tauA) -- how long an occupation typically lasts before it changes. The package does not predicttauA; you supply it, or measure it with the fitting tools. - Power spectral density (PSD) -- how the noise power is spread over
frequency. A telegraph signal has a Lorentzian spectrum: flat up
to a knee at
1/(2 pi tau), then falling. White noise has the same density at all frequencies. A periodogram is the PSD estimated from one recorded trace; averaging many periodograms reduces their scatter. - Sampling: a recorded trace holds the signal at times spaced by
the sample interval
dt. The highest frequency such a trace can show is the Nyquist frequency1/(2 dt). Noise at higher frequencies does not vanish: it reappears at lower frequencies in the spectrum of the samples (aliasing, or folding back). - Monte Carlo -- a simulation driven by random numbers, used here to generate example noise traces and check the formulas against them.
- Heat capacity -- energy needed to warm something by 1 K.
C_eis that of the junction's electrons;C_Ais the part that comes from the Andreev occupations. - Thermal conductance
Gand thermal timetau_th = C_e / G-- how fast the electrons lose heat to the crystal lattice (the phonons). Random heat exchange with the phonons causes phonon thermal-fluctuation noise (TFN), the classic noise limit of a thermal detector. - Cauchy-Schwarz bound -- the package's lower limit on the
temperature error from occupation noise,
var(T) >= 2 kB T^2 tauA / (C_A t)for averaging timet. A uniform short junction reaches it exactly.
The detector
- Readout -- the junction ends a microwave resonator. A change in
temperature changes the junction's Josephson inductance
L_J, which moves the resonance frequency.yis the fractional frequency shift. Two readouts are named bywhich:"L"(the inductance at phase near 0; the default of the device budget) and"I"(the supercurrent at the phase where it is largest). - Noise-equivalent power (NEP) -- the input power that would give a signal as large as the noise in a 1 Hz bandwidth (half a second of averaging, with the convention below), in W/sqrt(Hz). Smaller is better.
- Energy resolution -- the uncertainty (one standard deviation) with which a deposited energy, for example one photon, can be measured, using the best ("matched") filter. Smaller is better.
- Allan variance -- a measure of how much a reading changes from one averaging window to the next. It shows how long averaging still helps.
- Hidden Markov model (HMM) -- a statistical model of a hidden two-state signal seen through noise. Used here to recover the occupation from a noisy readout trace.
Install
pip install absnoise
It needs Python 3.9 or newer, NumPy 1.24 or newer and SciPy 1.10 or
newer. The optional extra absnoise[plot] installs matplotlib; no part
of the package imports it. For development: clone the repository and
run pip install -e .[test], then pytest.
Units and conventions
- SI units throughout: kelvin, joules, seconds, amperes, hertz, metres. Phases are in radians.
- Spectra are single-sided (positive frequencies only). With this
convention, the variance of a
t-second average of white noise with spectral densitySisS / (2 t), and a Lorentzian with variancevarand correlation timetauhas plateauS(0) = 4 var tau. - The shipped constants (
KB,HBAR, ...) are CODATA 2018 values. - Graphene thermal parameters follow Lee et al. (see
Where it comes from): by default the
electron-phonon cooling power is
P = Sigma A (Te^3 - Tp^3)withSigma = 2.0 W m^-2 K^-3.
Examples
Each example below runs as written, and the output shown is what it printed with absnoise 0.17.0 (Python 3.13, NumPy 2.5.5, SciPy 1.18.1). Examples 1 to 15 print the same as with 0.16.0. Values not taken from the shipped recipes -- correlation times, geometries, noise levels -- are illustrative, not measurements.
1. A detector budget for a shipped junction
import numpy as np
from absnoise import RECIPES, SensorBudget, H_PLANCK
budget = SensorBudget(RECIPES[1]) # the Ti/Al/Au junction of Jung et al.
T = 0.3 * budget.recipe.Tc # operating temperature (K)
tauA = 1e-6 # occupation correlation time (s), illustrative
dT_A, sums = budget.dT_andreev(T, tauA, t=1.0) # 1 s of averaging
dT_ph = budget.dT_phonon(T, t=1.0)
print(f"T = {T:.3f} K, thermal time tau_th = {budget.tau_th(T) * 1e9:.2f} ns")
print(f"temperature resolution in 1 s: Andreev {dT_A * 1e6:.2f} uK, "
f"phonon {dT_ph * 1e6:.2f} uK")
print(f"tauA/C_A = {tauA / sums['C_A']:.3e} s K/J, "
f"tau_th/C_e = {budget.tau_th(T) / budget.Ce(T):.3e} s K/J")
sigE = budget.energy_resolution(T, tauA)
print(f"energy resolution: {sigE:.3e} J "
f"(the energy of a {sigE / H_PLANCK / 1e9:.0f} GHz photon)")
f = np.array([0.0, 1e7, 1e8])
nep = budget.nep_spectrum(T, tauA, f)
for fi, a, p in zip(f, nep["andreev"], nep["phonon"]):
print(f"NEP at {fi:.0e} Hz: Andreev {a:.2e}, phonon {p:.2e} W/sqrt(Hz)")
T = 0.225 K, thermal time tau_th = 0.78 ns
temperature resolution in 1 s: Andreev 40.48 uK, phonon 3.58 uK
tauA/C_A = 1.172e+15 s K/J, tau_th/C_e = 9.145e+12 s K/J
energy resolution: 1.752e-22 J (the energy of a 264 GHz photon)
NEP at 0e+00 Hz: Andreev 6.26e-18, phonon 5.53e-19 W/sqrt(Hz)
NEP at 1e+07 Hz: Andreev 6.27e-18, phonon 5.53e-19 W/sqrt(Hz)
NEP at 1e+08 Hz: Andreev 6.97e-18, phonon 5.53e-19 W/sqrt(Hz)
At this operating point the occupation noise, not the phonon noise,
sets the temperature resolution. That matches the criterion stated in
the code: occupation noise dominates when tauA/C_A is larger than
tau_th/C_e. In the NEP, the phonon part is flat at every frequency
(sqrt(4 kB T^2 G)), and the occupation part rises as
sqrt(1 + (2 pi f tau_th)^2). The energy resolution is computed in
closed form over all frequencies (since 0.11.0; 0.10.x printed
1.810e-22 J here, 3.3 % too high, because its numerical integral
stopped at a finite frequency).
2. The temperature bound, finite length, and pair processes
import numpy as np
from absnoise import RECIPES, ShortJunction, FiniteLJunction, sigma_spectrum
r = RECIPES[3] # Ti/Al(thick): L = 0.3 um, xi = 3.6 um
T = 0.3 * r.Tc
sj = ShortJunction(r) # every channel has the same level
sj.calibrate()
achieved, bound, _ = sj.temperature_bound(T, tauA=1e-6, t_int=1.0)
print(f"short-junction model: achieved / bound = {achieved / bound:.6f}")
fl = FiniteLJunction(r) # exact levels at the real length
print(f"finite-length model at phi = 1: achieved / bound = "
f"{fl.saturation_ratio(1.0, T):.4f}")
# pair processes can only shorten the correlation time
for Gp in (0.0, 1.0, 10.0):
_, S0, var, tau_eff = sigma_spectrum(0.25, 1.0, Gp, np.array([0.0]))
print(f"Gp = {Gp:4.1f} Gs: tau_eff = {tau_eff:.4f} / Gs")
short-junction model: achieved / bound = 1.000000
finite-length model at phi = 1: achieved / bound = 1.0392
Gp = 0.0 Gs: tau_eff = 1.0000 / Gs
Gp = 1.0 Gs: tau_eff = 0.7500 / Gs
Gp = 10.0 Gs: tau_eff = 0.3750 / Gs
A short junction whose channels all have the same transparency sits
exactly on the bound. At the real length of this junction the levels
move differently with phase, and the resolution is a little worse than
the bound (never better). sigma_spectrum shows that pair processes
(two quasiparticles entering or leaving together, at rate Gp) can
only shorten the effective correlation time, so the single-quasiparticle
case is the worst one. Here Gs is the single-quasiparticle rate.
3. Characterize your junction from a critical-current curve
import numpy as np
from absnoise import ic_model, fit_ic_curve, validate_ic_data, SensorBudget
# Synthetic "measurement": 10 temperatures, 1 % noise, fixed seed.
# The true values (illustrative) are Ic0 = 2 uA, Tc = 0.75 K, tau = 0.78.
T = np.linspace(0.05, 0.65, 10)
rng = np.random.default_rng(1)
sigma = 0.02e-6
Ic = ic_model(T, 2.0e-6, 0.75, 0.78) + rng.normal(0.0, sigma, T.size)
print(validate_ic_data(T, Ic)) # nothing suspicious
print(validate_ic_data(T * 1e3, Ic)["flags"][:2]) # millikelvin typed as kelvin?
fit = fit_ic_curve(T, Ic, sigma_Ic=sigma)
print(f"Ic0 = {fit.Ic0 * 1e6:.3f} +- {fit.sigma['Ic0'] * 1e6:.3f} uA")
print(f"Tc = {fit.Tc:.4f} +- {fit.sigma['Tc']:.4f} K")
print(f"tau = {fit.tau:.3f} +- {fit.sigma['tau']:.3f}")
print(f"chi2 = {fit.chi2:.2f} for {fit.chi2_dof} degrees of freedom")
# Package the fit (plus your own measured geometry) for the budgets.
rec = fit.to_recipe(name="my junction", label="mine", xi=5e-6,
L=0.2e-6, W=2e-6, Vbg=30.0, Rn=50.0)
b = SensorBudget(rec)
print(f"Josephson inductance at 0.2 K: {b.LJ(0.2) * 1e9:.3f} nH")
{'n_points': 10, 'flags': []}
[(0, 'T_large', 50.0), (1, 'T_large', 116.66666666666667)]
Ic0 = 2.007 +- 0.012 uA
Tc = 0.7530 +- 0.0057 K
tau = 0.794 +- 0.032
chi2 = 3.79 for 7 degrees of freedom
Josephson inductance at 0.2 K: 0.226 nH
fit_ic_curve fits the package's own short-junction model for three
numbers: Ic0 (the critical current at zero temperature), Tc and
tau. The error bars are the standard linearized estimate at the
solution (from the slopes of the model at the best fit; accurate when
the errors are small). chi2 is given when you pass measurement
errors; a value near the number of degrees of freedom (the number of
points minus the three fitted numbers) means model and errors are
consistent. validate_ic_data never rescales anything: it returns flags
for values that look like a unit mix-up (above 30 K, or above 1 mA, by
default). to_recipe needs your measured geometry, because an Ic(T)
curve does not determine it.
4. Plan the measurements before the cooldown
import numpy as np
from absnoise import (plan_ic_measurement, design_ic_temperatures,
psd_band_for_tau, plan_psd_measurement,
averages_for_tau)
# Expected junction (illustrative): Ic0 = 2 uA, Tc = 0.75 K, tau = 0.78.
Ic0, Tc, tau = 2.0e-6, 0.75, 0.78
sig = 0.02e-6 # expected error per point (A)
for top in (0.2, 0.65): # highest temperature reached (K)
T = np.linspace(0.05, top, 8)
p = plan_ic_measurement(T, sig, Ic0, Tc, tau)
print(f"run up to {top} K: sigma(Tc) = {p['sigma']['Tc'] * 1e3:.1f} mK, "
f"covers_tc_knee = {p['covers_tc_knee']}")
cand = np.linspace(0.03, 0.70, 15) # temperatures the fridge can hold
pick = design_ic_temperatures(cand, 5, sig, Ic0, Tc, tau)
print("measure at:", np.round(np.sort(cand[pick["indices"]]), 3), "K")
f_lo, f_hi, f_knee = psd_band_for_tau(3e-4) # expect tau near 0.3 ms
print(f"PSD band {f_lo:.1f} to {f_hi:.0f} Hz (knee {f_knee:.0f} Hz)")
f = np.geomspace(f_lo, f_hi, 48)
plan = plan_psd_measurement(f, 64, S0=1e-3, tau_s=3e-4, floor=1e-5)
print(f"64 averages: sigma(tau) = {plan['sigma']['tau_s'] * 1e6:.2f} us")
n, _ = averages_for_tau(3e-6, f, S0=1e-3, tau_s=3e-4, floor=1e-5)
print(f"averages needed for sigma(tau) <= 3 us: {n}")
run up to 0.2 K: sigma(Tc) = 1031.1 mK, covers_tc_knee = False
run up to 0.65 K: sigma(Tc) = 6.1 mK, covers_tc_knee = True
measure at: [0.03 0.078 0.365 0.413 0.7 ] K
PSD band 132.6 to 2122 Hz (knee 531 Hz)
64 averages: sigma(tau) = 15.56 us
averages needed for sigma(tau) <= 3 us: 1709
The planned error bars are the same matrix the fit reports, computed
from the package's own model before any data exist. A run that stays
far below Tc barely feels Tc; the plan flags this as
covers_tc_knee = False (the fit warns about the same case).
design_ic_temperatures picks the most informative temperatures one at
a time (a greedy method, not a proof of the best set).
psd_band_for_tau returns a band from f_knee/4 to 4 f_knee that
satisfies the rules fit_telegraph_psd enforces. Error bars fall as
sqrt(psi'(n_avg)), which is close to 1/sqrt(n_avg) for many
averages (see Example 8), and
averages_for_tau inverts that. (0.10.x used 1/sqrt(n_avg) and
printed 15.50 us and 1708.)
5. Occupation noise from a spectrum, and the Allan variance
import numpy as np
from absnoise import (telegraph_traces, psd_single_sided, fit_telegraph_psd,
allan_variance, avar_exponential)
# Simulated occupation noise: 64 channels, f = 0.3, tau = 0.2 ms, 5 us steps.
rng = np.random.default_rng(0)
f_occ, tau, dt = 0.3, 2e-4, 5e-6
tr = telegraph_traces(f_occ, tau, dt, 40000, 64, rng)
# Channel-averaged periodogram, then averaged into 40 log-spaced bins.
S = np.mean([psd_single_sided(tr[:, c].astype(float), dt)[1]
for c in range(64)], axis=0)[1:]
fr = np.fft.rfftfreq(40000, dt)[1:]
edges = np.geomspace(fr[0], fr[-1], 41)
fb, Sb = [], []
for lo, hi in zip(edges[:-1], edges[1:]):
m = (fr >= lo) & (fr < hi)
if m.sum() >= 3:
fb.append(fr[m].mean())
Sb.append(S[m].mean())
fit = fit_telegraph_psd(np.array(fb), np.array(Sb))
print(f"fitted tau = {fit.tau_s * 1e6:.0f} +- {fit.sigma['tau_s'] * 1e6:.0f} us "
f"(true {tau * 1e6:.0f} us)")
print(f"variance under the fitted Lorentzian {fit.variance:.4f}, "
f"trace variance {tr.astype(float).var():.4f}")
# Allan variance of the 64-channel sum against the closed form.
x = tr.astype(float).sum(axis=1)
taus, avar = allan_variance(x, dt, m_list=[20, 80, 320])
closed = avar_exponential(64 * f_occ * (1 - f_occ), tau, taus)
for T, a, c in zip(taus, avar, closed):
print(f"T = {T * 1e3:.1f} ms: measured {a:.2e}, closed form {c:.2e}")
fitted tau = 201 +- 2 us (true 200 us)
variance under the fitted Lorentzian 0.2116, trace variance 0.2107
T = 0.1 ms: measured 3.12e+00, closed form 3.13e+00
T = 0.4 ms: measured 5.17e+00, closed form 5.12e+00
T = 1.6 ms: measured 2.33e+00, closed form 2.73e+00
fit_telegraph_psd fits S0 / (1 + (2 pi f tau)^2) + floor in
logarithmic units. The variance under the fitted Lorentzian,
S0/(4 tau), is compared here with the variance of the simulated
traces. The Allan variance of the simulated signal follows the closed
form avar_exponential; the longest window has the fewest independent
samples and scatters most (the test suite checks agreement within 12 %
on a longer record).
6. Decode a noisy readout trace, with error bars
import os, tempfile
import numpy as np
from absnoise import telegraph_traces, save_trace_csv, load_trace_csv, fit_hmm
# A simulated readout: occupation f = 0.3, tau = 1 ms, sampled every 50 us,
# with Gaussian readout noise 0.3 (levels 0 and 1). Illustrative values.
rng = np.random.default_rng(0)
dt = 5e-5
n = telegraph_traces(0.3, 1e-3, dt, 20000, 1, rng)[:, 0]
y = n + rng.normal(0.0, 0.3, n.size)
path = os.path.join(tempfile.mkdtemp(), "readout.csv")
save_trace_csv(path, dt, y) # header t_s,y
dt2, y2 = load_trace_csv(path) # refuses a non-uniform time grid
model, logliks = fit_hmm(y2)
f_hat, tau_hat = model.rates(dt2)
err = model.uncertainties(y2, dt2)["sigma"]
print(f"f = {f_hat:.3f} +- {err['f']:.3f}, "
f"tau = {tau_hat * 1e3:.3f} +- {err['tauA'] * 1e3:.3f} ms")
print(f"levels {model.means[0]:.3f} and {model.means[1]:.3f}, "
f"noise {model.sigma:.3f}, EM iterations: {len(logliks)}")
path_hat = model.viterbi(y2)
print(f"samples decoded correctly: {(path_hat == n).mean() * 100:.2f} %")
# The same process read out only every 0.5 ms (half of tau):
m = telegraph_traces(0.3, 1e-3, 5e-4, 20000, 1, rng)[:, 0]
coarse, _ = fit_hmm(m + rng.normal(0.0, 0.3, m.size))
print(f"sampled every 0.5 ms: tau = {coarse.rates(5e-4)[1] * 1e3:.3f} ms "
f"(first-order formula of 0.10: "
f"{5e-4 / (coarse.p_up + coarse.p_dn) * 1e3:.3f} ms)")
f = 0.290 +- 0.020, tau = 0.993 +- 0.056 ms
levels -0.001 and 1.003, noise 0.302, EM iterations: 6
samples decoded correctly: 99.70 %
sampled every 0.5 ms: tau = 1.014 ms (first-order formula of 0.10: 1.284 ms)
fit_hmm finds the occupation fraction, the correlation time, the two
readout levels and the noise from the trace alone, by
expectation-maximization (a standard method that improves the
estimates step by step until they stop changing). viterbi gives the most probable filled/empty
sequence and posterior the probability of "filled" at every sample.
The trace goes through the documented file format (t_s,y) on the way.
uncertainties (new in 0.11.0) gives one-standard-deviation error
bars. They come from how sharply the likelihood (the probability of
the recorded trace under the model) falls off around the best fit --
the standard large-sample estimate, good when the trace holds many
flips. Here the fitted f is 0.47 error bars and tau 0.12 error
bars away from the true values (0.3 and 1 ms).
The last lines read the same process only every 0.5 ms. Since 0.11.0
the decoder treats the samples as snapshots of a process that runs
in continuous time, which is exact for any sampling interval. The
0.10.x conversion was correct only for samples much closer together
than tau, and here it would have reported 1.284 ms instead of
1.014 ms.
7. A single photon: matched design, click, and a refusal
from absnoise import (matched_Tc, matched_recipe, SensorBudget, click_template,
click_monte_carlo, two_temperature_click, H_PLANCK)
T0 = 0.05 # bath temperature (K)
print(f"matched junction Tc for T0 = 50 mK: {matched_Tc(T0):.4f} K")
b = SensorBudget(matched_recipe(T0, W=5.3e-6, L=0.5e-6)) # illustrative geometry
E = H_PLANCK * 26e9 # one 26 GHz photon
tpl = click_template(b, E, tauA=1e-7, T0=T0)
print(f"peak electron temperature {tpl['Te_peak'] * 1e3:.1f} mK, "
f"occupation dip {(1 - tpl['ms'].min() / tpl['m0']) * 100:.1f} %")
mc = click_monte_carlo(b, E, tauA=1e-7, T0=T0, n_trials=200, seed=3)
print(f"Monte Carlo: SNR {mc['snr']:.1f}, efficiency {mc['efficiency']:.2f}, "
f"dark fraction {mc['dark_fraction']:.2f}")
try:
two_temperature_click(b, E, 1e-7, T0) # no phonon parameters given
except ValueError as err:
print("refused:", err)
matched junction Tc for T0 = 50 mK: 0.0776 K
peak electron temperature 121.8 mK, occupation dip 1.5 %
Monte Carlo: SNR 1.9, efficiency 0.82, dark fraction 0.21
refused: c_ph, kappa_pb and delta_pb carry no vetted defaults: the phonon heat capacity and boundary escape law of a real stack are measurements of that stack. Supply all three from your device's thermal characterization (or a cited equivalent stack).
matched_Tc chooses the junction Tc so that the gap at the operating
temperature is 2.3994 kB T0 (the MATCHED_RATIO in the code).
click_template follows the electron temperature and the occupations
after the photon is absorbed, without noise; click_monte_carlo adds
occupation, phonon and readout noise and detects clicks with a matched
filter. Its numbers are statistics-limited; the tests only check
ordering relations. two_temperature_click also lets the local phonons
heat up, but it has no default phonon parameters and refuses to run
without them.
8. A noise spectrum with few averages
import numpy as np
from absnoise import (telegraph_traces, psd_single_sided, fit_telegraph_psd)
# One long simulated record: 16 channels summed, f = 0.3, tau = 0.2 ms,
# 5 us steps (illustrative values).
rng = np.random.default_rng(4)
f_occ, tau, dt = 0.3, 2e-4, 5e-6
x = telegraph_traces(f_occ, tau, dt, 4 * 2**15, 16, rng).sum(axis=1)
# Cut it into 4 segments and average their periodograms: n_avg = 4.
segs = x.reshape(4, -1).astype(float)
fr = np.fft.rfftfreq(segs.shape[1], dt)
S = np.mean([psd_single_sided(s, dt)[1] for s in segs], axis=0)
keep = np.arange(1, 3000) # every bin up to 18 kHz
f_b, S_b = fr[keep], S[keep]
S0_true = 4 * 16 * f_occ * (1 - f_occ) * tau
plain = fit_telegraph_psd(f_b, S_b)
told = fit_telegraph_psd(f_b, S_b, n_avg=4)
print(f"true S0 = {S0_true:.3e}")
print(f"n_avg not given: S0 = {plain.S0:.3e}, tau = {plain.tau_s * 1e6:.0f} us")
print(f"n_avg = 4: S0 = {told.S0:.3e} +- {told.sigma['S0']:.1e}, "
f"tau = {told.tau_s * 1e6:.0f} +- {told.sigma['tau_s'] * 1e6:.0f} us")
print(f"chi2 = {told.chi2:.1f} for {told.chi2_dof} degrees of freedom")
true S0 = 2.688e-03
n_avg not given: S0 = 2.473e-03, tau = 206 us
n_avg = 4: S0 = 2.816e-03 +- 1.6e-04, tau = 206 +- 6 us
chi2 = 2961.5 for 2996 degrees of freedom
A periodogram scatters a lot, and its logarithm (which the fit uses)
is on average too low: for an average of n periodograms by
psi(n) - ln n, where psi is the digamma function (a standard
special function; psi', the trigamma function, is its derivative
and gives the scatter). For n = 4 that makes S0 and the floor 12 %
too low. Given n_avg, the fit (since 0.11.0) removes this offset
and uses the exact scatter, so chi2 close to the degrees of freedom
confirms the noise model. tau does not depend on the offset. Here
the uncorrected S0 lies 1.3 error bars below the true value and the
corrected one 0.8 error bars above it; with fewer averages the offset
is larger (44 % for n_avg = 1). n_avg must be the number of
independent periodograms behind every point: do not also average
neighboring frequencies, or pass that larger number.
9. Error bars on the budget from your Ic(T) fit
import numpy as np
from absnoise import ic_model, fit_ic_curve, SensorBudget
# The synthetic Ic(T) measurement of Example 3, fitted the same way.
T = np.linspace(0.05, 0.65, 10)
rng = np.random.default_rng(1)
sigma = 0.02e-6
Ic = ic_model(T, 2.0e-6, 0.75, 0.78) + rng.normal(0.0, sigma, T.size)
fit = fit_ic_curve(T, Ic, sigma_Ic=sigma)
geometry = dict(xi=5e-6, L=0.2e-6, W=2e-6, Vbg=30.0, Rn=50.0) # yours
T_op, tauA = 0.2, 1e-6 # operating point (illustrative)
lj = fit.propagate(lambda r: SensorBudget(r).LJ(T_op), **geometry)
print(f"L_J = {lj['value'] * 1e9:.4f} +- {lj['sigma'] * 1e9:.4f} nH")
dT = fit.propagate(lambda r: SensorBudget(r).dT_andreev(T_op, tauA, 1.0)[0],
**geometry)
print(f"Andreev resolution in 1 s: {dT['value'] * 1e6:.2f} "
f"+- {dT['sigma'] * 1e6:.2f} uK")
sE = fit.propagate(lambda r: SensorBudget(r).energy_resolution(T_op, tauA),
**geometry)
print(f"energy resolution: {sE['value']:.3e} +- {sE['sigma']:.1e} J "
f"(nonlinearity {sE['nonlinearity']:.3f})")
try: # 10 mK below the fitted Tc
fit.propagate(lambda r: SensorBudget(r).LJ(0.743), **geometry)
except ValueError as err:
print("refused:", err)
L_J = 0.2264 +- 0.0046 nH
Andreev resolution in 1 s: 44.23 +- 0.79 uK
energy resolution: 1.782e-22 +- 3.2e-24 J (nonlinearity 0.007)
refused: func is too nonlinear over the fit's error bars: the second-order change over one standard deviation is 0.387 times the first-order error bar (limit 0.1). A first-order error bar would mislead; sample (Ic0, Tc, tau) from `cov` and look at the spread of func instead
propagate (new in 0.12.0) carries the error bars of the Ic(T) fit
into any number the package computes from the fitted junction. You
pass a function of a Recipe and your measured geometry. The geometry
stays fixed; only Ic0, Tc and tau vary. The method moves the
three parameters by one standard deviation, in both directions, along
each principal direction of the fit's covariance, and combines the
changes of the result. For a result that depends linearly on the
parameters, this is exactly the usual first-order error bar. The tests
check it against that exact result, against a quadratic closed form,
and against 400 parameter sets drawn at random from the covariance.
nonlinearity is the second-order change over one standard deviation,
in units of the error bar. Above 0.1 (the default limit) the call is
refused, because one error bar would then hide a skewed or shifted
spread. Here that happens 10 mK below the fitted Tc, where L_J
rises steeply. The phonon parameters (sigma, delta) and the
readout settings of SensorBudget carry no error bars here; only the
fit's do.
10. Is the readout trace a single-rate telegraph process?
import numpy as np
from absnoise import telegraph_traces, fit_hmm, markov_dwell_test
rng = np.random.default_rng(2)
dt = 5e-5 # 50 us samples, noise 0.3
# A Markov occupation: f = 0.3, tau = 1 ms (illustrative values).
n = telegraph_traces(0.3, 1e-3, dt, 20000, 1, rng)[:, 0]
y = n + rng.normal(0.0, 0.3, n.size)
model, _ = fit_hmm(y)
res = markov_dwell_test(y, model, n_boot=500, seed=0)
print(f"Markov trace: p = {res['p_value']:.2f}, dispersion "
f"{res['dispersion'][0]:.2f} (empty), {res['dispersion'][1]:.2f} (filled)")
# Filled stays with two time scales: 0.25 ms or 3 ms, equal odds.
parts, s = [], 0
while sum(len(p) for p in parts) < 20000:
mean = 47 if s == 0 else (5 if rng.random() < 0.5 else 60)
parts.append(np.full(rng.geometric(1 / mean), s))
s ^= 1
n2 = np.concatenate(parts)[:20000]
y2 = n2 + rng.normal(0.0, 0.3, n2.size)
model2, _ = fit_hmm(y2)
res2 = markov_dwell_test(y2, model2, n_boot=500, seed=0)
print(f"two time scales: p = {res2['p_value']:.3f}, dispersion "
f"{res2['dispersion'][0]:.2f} (empty), {res2['dispersion'][1]:.2f} (filled)")
print("complete stays:", res2["n_dwells"])
Markov trace: p = 0.50, dispersion 0.96 (empty), 1.11 (filled)
two time scales: p = 0.008, dispersion 0.87 (empty), 2.09 (filled)
complete stays: {0: 207, 1: 207}
fit_hmm assumes one Markov process: every stay in a state ends with
the same probability per sample, so the stays follow an exponential
law (geometric, counted in samples) with one correlation time. Several
trap states, slow drifts of the rates or a dead time break this, and
then the fitted f and tau describe no single process.
markov_dwell_test (new in 0.12.0) decodes the trace with viterbi,
measures every complete stay, and computes the dispersion index
var / (mean (mean - 1)) of the stay lengths in samples, which is 1
for a geometric law. It compares this number with 500 traces simulated
from the fitted model and decoded in the same way, so decoding errors
(short stays missed in the noise) affect data and reference alike.
In the first trace nothing is found (p = 0.50). In the second, the
filled stays are far too spread out (dispersion 2.09), and the test
rejects the single-rate model. 0.008 is the smallest p-value that 500
simulated traces can give (4/501); ask for more if you need to resolve
smaller values. A large p-value means that no departure was found, not
that the model is proven. dwell_times returns the stays themselves,
for a histogram.
11. Josephson inductance and Kerr term of a finite-length junction
import numpy as np
from absnoise import RECIPES, JunctionModel, junction_properties, gap_bcs
from absnoise.constants import HBAR, E_CHARGE
r = RECIPES[1] # Ti/Al/Au: L = 0.2 um, xi = 5.1 um
out = junction_properties(r, np.array([0.02, 0.225]))
for T, Ic, a1, a3 in zip(out["T"], out["Ic"], out["dIdphi0"], out["a3"]):
LJ = HBAR / (2 * E_CHARGE) / a1 # Josephson inductance at phi = 0
print(f"T = {T:.3f} K: Ic = {Ic * 1e6:.3f} uA, L_J = {LJ * 1e9:.4f} nH, "
f"a3/a1 = {a3 / a1:.4f}")
# the current at phi = pi/2, calculated two independent ways
m = JunctionModel(r) # 121 phases; m.phis[60] = pi/2
m.Delta = gap_bcs(0.225, r.Tc, r.Delta)
I_levels = m.current_phase(0.225)[60] # bound levels + continuum
I_sum = m.cpr_matsubara(0.225, m.phis[60]) # Matsubara sum
print(f"I(pi/2): levels + continuum {I_levels * 1e6:.5f} uA, "
f"Matsubara sum {I_sum * 1e6:.5f} uA (scale 1)")
T = 0.020 K: Ic = 2.110 uA, L_J = 0.2196 nH, a3/a1 = -0.0594
T = 0.225 K: Ic = 2.007 uA, L_J = 0.2220 nH, a3/a1 = -0.0640
I(pi/2): levels + continuum 3.67599 uA, Matsubara sum 3.67775 uA (scale 1)
The full model of a recipe (JunctionModel) counts every transverse
channel at its real length, with the states above the gap (the
continuum). Since 0.13.0 the slope a1 = I'(0), which sets the
Josephson inductance L_J = (hbar/2e) / a1, and the cubic term a3
of the current-phase relation I = a1 phi + a3 phi^3 + ... are exact
for this model (cpr_series). They come from the free energy written
as a sum over Matsubara frequencies (P. W. Brouwer and C. W. J.
Beenakker, Chaos, Solitons & Fractals 8, 1249 (1997), Eqs. (6) and (8)). That
sum needs no level search and does not split bound levels from the
continuum, so it stays accurate near zero phase, where bound levels
leave the gap and the two parts nearly cancel. cpr_matsubara gives
the whole current-phase relation the same way. The last line compares
it with the level-based current_phase at phi = pi/2; the two
calculations differ by 5e-4, the size of the energy and phase grid
errors of current_phase. 0.12.1 fitted a1 and a3 to the
level-based current and printed a3/a1 = -0.0679 at 0.225 K here (6 %
off) and L_J = 0.2198 nH at 20 mK; its JunctionModel.dIdphi0 was
57 % low for this recipe (see the corrections below).
12. The electron-phonon cooling law from a heating curve
import numpy as np
from absnoise import RECIPES, SensorBudget, ep_temperature, fit_ep_coupling
r = RECIPES[1] # Ti/Al/Au, area 0.2 um x 1.8 um
P = np.concatenate([[0.0, 0.0], np.geomspace(1e-17, 3e-14, 12)]) # heater (W)
rng = np.random.default_rng(5) # illustrative "measurement":
Te = ep_temperature(P, 0.03, r.area, 2.5, 3.0) + rng.normal(0.0, 1e-3, P.size)
fit = fit_ep_coupling(P, Te, r.area, Tp_K=0.03, sigma_Te=1e-3, fit_Tp=True)
print(f"Sigma = {fit.Sigma:.2f} +- {fit.sigma['Sigma']:.2f} W m^-2 K^-delta, "
f"delta = {fit.delta:.3f} +- {fit.sigma['delta']:.3f}, "
f"Tp = {fit.Tp * 1e3:.1f} +- {fit.sigma['Tp'] * 1e3:.1f} mK")
print(f"chi2 = {fit.chi2:.1f} for {fit.chi2_dof} degrees of freedom")
T = 0.225 # operating temperature (K)
G = fit.propagate(lambda s, d: SensorBudget(r, sigma=s, delta=d).Gep(T))
print(f"G_ep at {T} K: {G['value'] * 1e15:.1f} +- {G['sigma'] * 1e15:.1f} fW/K")
low = fit_ep_coupling(P[:5], Te[:5], r.area, Tp_K=0.03, sigma_Te=1e-3)
print(f"five lowest powers only: delta = {low.delta:.1f} +- {low.sigma['delta']:.1f}")
Sigma = 2.50 +- 0.06 W m^-2 K^-delta, delta = 3.002 +- 0.015, Tp = 29.5 +- 0.6 mK
chi2 = 12.0 for 11 degrees of freedom
G_ep at 0.225 K: 136.2 +- 1.0 fW/K
five lowest powers only: delta = 2.1 +- 1.5
Every detector number of SensorBudget depends on the cooling law
P = Sigma A (Te^delta - Tp^delta), whose default (Sigma = 2.0,
delta = 3) follows Lee et al. fit_ep_coupling (new in 0.13.0)
measures it on your own device, the way Lee et al. did: from the
electron temperature at several heater powers. It fits Te (the
measured quantity) with the closed form
Te = (Tp^delta + P / (Sigma A))^(1/delta), can fit the bath
temperature too, and gives error bars and a chi-square. propagate
carries them into any number computed from (Sigma, delta), as
IcFit.propagate does for the Ic(T) fit. The last line shows why the
heating range matters: close to the bath the law is nearly linear, and
only the conductance G is determined, not Sigma and delta
apart. The fit warns when every point stays within 10 % of the bath
(in Te^delta), and refuses when the exponent runs to the end of its
search range (1 to 8) or the parameters cannot be told apart.
13. How much readout bandwidth does the energy resolution need?
from absnoise import RECIPES, SensorBudget
b = SensorBudget(RECIPES[1]) # Ti/Al/Au
T, tauA = 0.225, 1e-6 # operating point (illustrative)
S_ro = 5e-15 # white readout floor of y (1/Hz)
ideal = b.energy_resolution(T, tauA, S_ro_y=S_ro)
print(f"unlimited band: sigma_E = {ideal:.3e} J")
for f_max in (1e5, 1e6, 1e7, 1e8): # readout bandwidth (Hz)
s = b.energy_resolution(T, tauA, S_ro_y=S_ro, f_max=f_max)
print(f"f_max = {f_max:.0e} Hz: sigma_E = {s:.3e} J ({s / ideal:.3f} x)")
for floor in (S_ro, 0.0):
f_bw = b.bandwidth_for_resolution(T, tauA, factor=1.1, S_ro_y=floor)
print(f"bandwidth for 1.1 x the unlimited value, floor {floor:.0e}: "
f"{f_bw / 1e6:.2f} MHz")
unlimited band: sigma_E = 2.629e-21 J
f_max = 1e+05 Hz: sigma_E = 1.010e-20 J (3.842 x)
f_max = 1e+06 Hz: sigma_E = 3.639e-21 J (1.384 x)
f_max = 1e+07 Hz: sigma_E = 2.705e-21 J (1.029 x)
f_max = 1e+08 Hz: sigma_E = 2.633e-21 J (1.001 x)
bandwidth for 1.1 x the unlimited value, floor 5e-15: 3.29 MHz
bandwidth for 1.1 x the unlimited value, floor 0e+00: 732.60 MHz
energy_resolution assumes a matched filter that uses every
frequency. A real readout passes only a band: the resonator
linewidth, the amplifier or the digitizer. With f_max (new in
0.14.0) the filter uses only the frequencies from 0 to f_max, as an
ideal low-pass readout allows, and the integral
sigma_E^-2 = 4 int_0^f_max df / NEP^2 still has a closed form.
bandwidth_for_resolution returns the bandwidth at which the
resolution comes within a chosen factor of the unlimited value. A
readout floor makes the highest frequencies worthless, so it lowers
the bandwidth you need: 3.3 MHz here with the floor, against 733 MHz
without it, where the thermal time of 0.78 ns sets the scale. The
tests compare the closed form with numerical integration of the NEP
of nep_spectrum.
14. The exact critical current of the full model
from absnoise import RECIPES, JunctionModel
m = JunctionModel(RECIPES[1]) # Ti/Al/Au, full model, scale 1
Ic_grid = m.Ic(0.02) # maximum on the phase grid
Ic_exact, phi_c = m.Ic_matsubara(0.02, return_phase=True)
print(f"Ic(20 mK), scale 1: phase grid {Ic_grid * 1e6:.5f} uA, "
f"exact {Ic_exact * 1e6:.5f} uA at phi = {phi_c:.4f} rad "
f"({(Ic_grid / Ic_exact - 1) * 1e4:.1f}e-4)")
scale = m.calibrate(method="matsubara") # exact Ic(20 mK) = measured Ic20
print(f"scale {scale:.6f} (levels: {RECIPES[1].Ic20 / Ic_grid:.6f}), "
f"Ic(20 mK) = {m.Ic_matsubara(0.02) * 1e6:.4f} uA")
Ic(20 mK), scale 1: phase grid 4.07482 uA, exact 4.07668 uA at phi = 1.9698 rad (-4.5e-4)
scale 0.517578 (levels: 0.517814), Ic(20 mK) = 2.1100 uA
JunctionModel.Ic takes the largest value of current_phase on its
phase grid, and calibrate scales the model so that this value at
20 mK equals the measured Ic20. Ic_matsubara (new in 0.14.0)
finds the maximum of the Matsubara-sum current instead (no energy or
phase grid; see Example 11), and calibrate(method="matsubara") uses
it. For Ti/Al/Au the two differ by 4.5e-4. For MoRe the level-based
current scatters by up to 3 % between neighboring grid phases near its
maximum, and its Ic lies 1.7 % above the exact maximum. Since 0.15.0
the exact maximum is the default of calibrate and of
junction_properties, so a calibrated model reproduces the measured
Ic20 exactly. method="levels" gives the calibrations of earlier
releases.
15. A trace sampled not much faster than it flips
import numpy as np
from absnoise import (telegraph_traces, psd_single_sided, fit_telegraph_psd,
allan_variance, avar_exponential)
# 8 occupations summed, f = 0.3, tau = 1 ms, sampled every 0.25 ms
# (a quarter of tau; illustrative values), cut into 32 segments.
rng = np.random.default_rng(0)
f_occ, tau, dt = 0.3, 1e-3, 2.5e-4
x = telegraph_traces(f_occ, tau, dt, 32 * 2048, 8, rng).sum(axis=1)
x = x.astype(float)
S = np.mean([psd_single_sided(s, dt)[1] for s in x.reshape(32, -1)],
axis=0)[1:-1]
f = np.fft.rfftfreq(2048, dt)[1:-1] # every bin below the Nyquist frequency
for label, kw in (("Lorentzian, floor fitted", {}),
("Lorentzian, no floor ", dict(fit_floor=False)),
("sampled (dt), no floor ", dict(fit_floor=False, dt=dt))):
fit = fit_telegraph_psd(f, S, n_avg=32, **kw)
print(f"{label}: tau = {fit.tau_s * 1e3:.3f} +- "
f"{fit.sigma['tau_s'] * 1e3:.3f} ms, "
f"chi2 = {fit.chi2:.0f} for {fit.chi2_dof} dof")
var = 8 * f_occ * (1 - f_occ)
taus, avar = allan_variance(x, dt, m_list=[1, 2, 8])
cont = avar_exponential(var, tau, taus)
samp = avar_exponential(var, tau, taus, dt=dt)
for T, a, c, s in zip(taus, avar, cont, samp):
print(f"T = {T * 1e3:.2f} ms: measured {a:.3f}, "
f"continuous {c:.3f}, sampled {s:.3f}")
Lorentzian, floor fitted: tau = 1.053 +- 0.017 ms, chi2 = 1056 for 1020 dof
Lorentzian, no floor : tau = 0.713 +- 0.008 ms, chi2 = 2722 for 1021 dof
sampled (dt), no floor : tau = 0.993 +- 0.013 ms, chi2 = 1019 for 1021 dof
T = 0.25 ms: measured 0.372, continuous 0.233, sampled 0.372
T = 0.50 ms: measured 0.457, continuous 0.391, sampled 0.459
T = 2.00 ms: measured 0.664, continuous 0.640, sampled 0.654
A recorded trace holds samples, not the continuous signal. The noise
above the Nyquist frequency (2 kHz here) folds back into the spectrum
of the samples, which at 2 kHz is 2.5 times the Lorentzian. Without
dt, fit_telegraph_psd fits the Lorentzian: here it puts tau 5 %
too long when the floor takes up the folded noise, and 29 % too short
without a floor (with a chi2 far above the degrees of freedom). With
dt (new in 0.16.0) it fits the exact spectrum of the sampled
process, the Lorentzian summed over all its folded copies (see
telegraph_psd_model). Then tau lies 0.5 error bars from the true
1 ms and chi2 matches the degrees of freedom. Over 40 such records the
tests find the plain fit with a floor 4 % long on average, and the
sampled fit without a bias.
The Allan variance has the same issue for short windows.
allan_variance averages whole samples, and for a window of one or
two samples its expectation differs from the continuous-time closed
form (0.372 against 0.233 here). avar_exponential(..., dt=dt) (new
in 0.16.0) gives the expectation for samples taken every dt. For
long windows the two agree: Example 5 uses windows of 20 samples and
more, where they differ by less than 0.2 %. Both sampled formulas
assume that each sample is the value of the signal at one instant, as
in telegraph_traces. A readout that averages over each sample
interval, or filters the signal before sampling, has a different
spectrum; Example 16 covers a readout that averages.
16. A readout that averages, and short records
import numpy as np
from absnoise import (telegraph_traces, psd_single_sided, fit_telegraph_psd,
allan_variance, avar_exponential)
# An integrating readout: each sample is the mean of the signal over its
# own interval dt. Simulated by averaging a 64 times finer trace
# (8 channels, f = 0.3, tau = 1 ms, dt = tau/4; illustrative values).
rng = np.random.default_rng(1)
f_occ, tau, dt = 0.3, 1e-3, 2.5e-4
fine = telegraph_traces(f_occ, tau, dt / 64, 32 * 1024 * 64, 8, rng)
y = fine.sum(axis=1).reshape(-1, 64).mean(axis=1)
S = np.mean([psd_single_sided(s, dt)[1] for s in y.reshape(32, -1)],
axis=0)[1:-1]
f = np.fft.rfftfreq(1024, dt)[1:-1]
for samp, n_rec in (("instant", None), ("average", None), ("average", 1024)):
fit = fit_telegraph_psd(f, S, fit_floor=False, n_avg=32, dt=dt,
sampling=samp, n_record=n_rec)
print(f"{samp}, n_record={n_rec!s:4}: tau = {fit.tau_s * 1e3:.3f} "
f"+- {fit.sigma['tau_s'] * 1e3:.3f} ms, chi2 = {fit.chi2:.0f} "
f"for {fit.chi2_dof} dof")
var = 8 * f_occ * (1 - f_occ)
taus, avar = allan_variance(y, dt, m_list=[1, 4])
for T, a in zip(taus, avar):
avg = avar_exponential(var, tau, T, dt=dt, sampling="average")
ins = avar_exponential(var, tau, T, dt=dt)
print(f"Allan variance at {T * 1e3:.2f} ms: measured {a:.4f}, "
f"averaging readout {avg:.4f}, instantaneous samples {ins:.4f}")
# Short segments: 400 records of 128 instantaneous samples (15 tau each).
x = telegraph_traces(f_occ, tau, 1.2e-4, 400 * 128, 4, rng).sum(axis=1)
S2 = np.mean([psd_single_sided(s, 1.2e-4)[1]
for s in x.reshape(400, -1).astype(float)], axis=0)[1:-1]
f2 = np.fft.rfftfreq(128, 1.2e-4)[1:-1]
for n_rec in (None, 128):
fit = fit_telegraph_psd(f2, S2, fit_floor=False, n_avg=400, dt=1.2e-4,
n_record=n_rec)
print(f"short records, n_record={n_rec!s:4}: tau = "
f"{fit.tau_s * 1e3:.3f} +- {fit.sigma['tau_s'] * 1e3:.3f} ms")
instant, n_record=None: tau = 1.514 +- 0.032 ms, chi2 = 2228 for 509 dof
average, n_record=None: tau = 0.967 +- 0.017 ms, chi2 = 507 for 509 dof
average, n_record=1024: tau = 0.974 +- 0.017 ms, chi2 = 507 for 509 dof
Allan variance at 0.25 ms: measured 0.2368, averaging readout 0.2331, instantaneous samples 0.3716
Allan variance at 1.00 ms: measured 0.5668, averaging readout 0.5648, instantaneous samples 0.5968
short records, n_record=None: tau = 0.914 +- 0.019 ms
short records, n_record=128 : tau = 0.971 +- 0.022 ms
Example 15 assumes that each sample is the value of the signal at one
instant. Many readouts instead record the mean of the signal over each
sample interval (an integrating digitizer, or a boxcar average of a
faster record). The spectrum of such samples is the Lorentzian times
sinc^2(pi f dt), folded back from above the Nyquist frequency, and
sampling="average" (new in 0.17.0) fits it in closed form. The
instantaneous model on the same data puts tau 51 % too long, with
chi2 more than four times the degrees of freedom. For the Allan
variance the averaging readout is simpler: the mean of m averaged
samples is the mean of the signal over m dt, so the continuous-time
closed form is exact (avar_exponential(..., sampling="average")
returns it). The 64-fold average of the simulation is close to a true
average over the interval (its spectrum differs by less than 0.05 %).
A periodogram of a record of N samples is, on average, the spectrum
smeared by the record (leakage). With n_record=N (new in 0.17.0) the
fit uses the exact expected periodogram of such a record. For the
short records of the last two lines (128 samples, 15 tau) the
Lorentzian of an infinite record puts tau 4.5 error bars low; with
n_record the difference is 1.3 error bars. Leakage matters even for
long records once many periodograms are averaged: in the tests, at 32
averages of 1024 samples (256 tau), tau comes out low by 0.2
(instantaneous samples) to 0.4 (averaged samples) error bars on
average without n_record, and without a bias with it.
17. A spectrum averaged into log-spaced bins
import numpy as np
from absnoise import (telegraph_traces, psd_single_sided, fit_telegraph_psd,
telegraph_psd_model)
# 16 channels, f = 0.3, tau = 0.2 ms, 5 us steps, 8 segments of 4096
# samples (illustrative). Each periodogram bin is an average of 8.
rng = np.random.default_rng(6)
f_occ, tau, dt = 0.3, 2e-4, 5e-6
x = telegraph_traces(f_occ, tau, dt, 8 * 4096, 16, rng).sum(axis=1)
S = np.mean([psd_single_sided(s, dt)[1]
for s in x.reshape(8, -1).astype(float)], axis=0)[1:-1]
fr = np.fft.rfftfreq(4096, dt)[1:-1]
# Log-spaced bins up to 25 kHz: each point averages `count` neighboring
# bins, so it rests on 8 * count periodogram values.
edges = np.geomspace(fr[0], 25e3, 31)
fb, Sb, nb = [], [], []
for lo, hi in zip(edges[:-1], edges[1:]):
m = (fr >= lo) & (fr < hi)
if m.any():
fb.append(fr[m].mean())
Sb.append(S[m].mean())
nb.append(8 * m.sum())
fb, Sb, nb = map(np.array, (fb, Sb, nb))
print(f"{fb.size} points, resting on {nb.min()} to {nb.max()} values")
S0_true = 4 * 16 * f_occ * (1 - f_occ) * tau
for label, n in (("one n_avg = 8", 8), ("n_avg per point", nb)):
fit = fit_telegraph_psd(fb, Sb, fit_floor=False, n_avg=n, dt=dt)
print(f"{label:15}: S0 = {fit.S0 / S0_true:.3f} +- {fit.sigma['S0'] / S0_true:.3f} x true, "
f"tau = {fit.tau_s * 1e6:.1f} +- {fit.sigma['tau_s'] * 1e6:.1f} us, "
f"chi2 = {fit.chi2:.1f} for {fit.chi2_dof} dof")
27 points, resting on 8 to 776 values
one n_avg = 8 : S0 = 0.936 +- 0.120 x true, tau = 184.2 +- 16.6 us, chi2 = 7.3 for 25 dof
n_avg per point: S0 = 0.932 +- 0.095 x true, tau = 190.5 +- 10.1 us, chi2 = 21.1 for 25 dof
Averaging neighboring frequencies into wider bins, as in Example 5,
reduces the scatter, but by a different amount for each point: here
the lowest point rests on the 8 periodograms alone and the highest on
776 values. Since 0.17.0 n_avg can be an array with one number per
point, and each point then gets its own offset and weight. With one
number for all points the fit takes the high-frequency points as far
noisier than they are: chi2 comes out at a third of the degrees of
freedom and the error bar of tau 64 % larger than with the array.
With the array, chi2 matches the degrees of freedom. The model is
evaluated at the mean frequency of each bin, so the bins should stay
narrow compared with the knee (here 0.09 decade each, knee at
800 Hz).
18. A readout with different noise in the two states
import numpy as np
from absnoise import telegraph_traces, fit_hmm, markov_dwell_test
# A readout whose noise is larger when the level is filled: widths 0.2
# (empty) and 0.45 (filled), f = 0.3, tau = 1 ms, 50 us samples
# (illustrative values).
rng = np.random.default_rng(3)
dt = 5e-5
n = telegraph_traces(0.3, 1e-3, dt, 20000, 1, rng)[:, 0]
y = n + np.where(n == 1, 0.45, 0.2) * rng.standard_normal(n.size)
for equal in (True, False):
model, _ = fit_hmm(y, equal_noise=equal)
f_hat, tau_hat = model.rates(dt)
err = model.uncertainties(y, dt)["sigma"]
print(f"equal_noise={equal!s:5}: f = {f_hat:.3f} +- {err['f']:.3f}, "
f"tau = {tau_hat * 1e3:.3f} +- {err['tauA'] * 1e3:.3f} ms, "
f"widths {np.round(model.sigmas, 3)}, "
f"decoded {(model.viterbi(y) == n).mean() * 100:.2f} %")
res = markov_dwell_test(y, model, n_boot=500, seed=0)
print(f"two widths: p = {res['p_value']:.2f} (dispersion), "
f"successive stays: correlation {res['correlation']:+.3f}, "
f"p = {res['p_correlation']:.2f}")
# Linked stays: every empty stay and the filled stay after it come from
# the same random number, so each state alone has geometric stays.
parts = []
while sum(len(p) for p in parts) < 20000:
u = rng.random()
k0 = int(np.ceil(np.log1p(-u) / np.log1p(-1 / 47)))
k1 = int(np.ceil(np.log1p(-u) / np.log1p(-1 / 20)))
parts += [np.zeros(k0, int), np.ones(k1, int)]
n2 = np.concatenate(parts)[:20000]
y2 = n2 + rng.normal(0.0, 0.3, n2.size)
model2, _ = fit_hmm(y2)
res2 = markov_dwell_test(y2, model2, n_boot=500, seed=0)
print(f"linked stays: p = {res2['p_value']:.2f} (dispersion), "
f"successive stays: correlation {res2['correlation']:+.3f}, "
f"p = {res2['p_correlation']:.3f}")
equal_noise=True : f = 0.261 +- 0.014, tau = 0.514 +- 0.026 ms, widths [0.275 0.275], decoded 98.34 %
equal_noise=False: f = 0.279 +- 0.019, tau = 0.898 +- 0.050 ms, widths [0.199 0.452], decoded 99.66 %
two widths: p = 0.43 (dispersion), successive stays: correlation -0.014, p = 0.70
linked stays: p = 0.29 (dispersion), successive stays: correlation +0.503, p = 0.004
In a dispersive readout the noise is often not the same for both
levels. fit_hmm(..., equal_noise=False) (new in 0.17.0) fits one
width per state. With one width for both, the decoder takes the large
noise of the filled level for extra flips: here tau comes out at
about half its value. With two widths the fit returns f = 0.279 and
tau = 0.898 ms; the simulated path itself has f = 0.279 and,
counted from its flips, tau = 0.905 ms. uncertainties gives error
bars for all six parameters (sigma0, sigma1 in place of sigma).
markov_dwell_test also returns, since 0.17.0, the correlation of each
complete stay with the next one (each stay ranked among the stays of
its own state) and its p-value from the same simulated traces. In a
Markov process the stays are independent. The last trace has exactly
geometric stays in each state, so the dispersion test finds nothing
(p = 0.29), but every empty stay and the filled stay after it are
drawn from the same random number. The correlation test finds that
(0.503, p = 0.004). p_value is still the dispersion test alone, as
in earlier releases.
19. The best set of temperatures
import numpy as np
from absnoise import design_ic_temperatures
# The planning case of Example 4: 15 reachable temperatures, pick 5.
Ic0, Tc, tau, sig = 2.0e-6, 0.75, 0.78, 0.02e-6
cand = np.linspace(0.03, 0.70, 15)
res = {}
for method in ("greedy", "exhaustive"):
res[method] = design_ic_temperatures(cand, 5, sig, Ic0, Tc, tau,
method=method)
s = res[method]["sigma"]
print(f"{method:10}: {np.round(np.sort(cand[res[method]['indices']]), 3)} K, "
f"sigma(Tc) = {s['Tc'] * 1e3:.2f} mK, sigma(tau) = {s['tau']:.4f}")
gain = np.exp(res["exhaustive"]["log_det"] - res["greedy"]["log_det"]) - 1
print(f"determinant of the information: {gain * 100:.2f} % larger for the best subset")
greedy : [0.03 0.078 0.365 0.413 0.7 ] K, sigma(Tc) = 4.84 mK, sigma(tau) = 0.0322
exhaustive: [0.03 0.078 0.413 0.461 0.7 ] K, sigma(Tc) = 4.94 mK, sigma(tau) = 0.0323
determinant of the information: 0.50 % larger for the best subset
design_ic_temperatures(..., method="exhaustive") (new in 0.17.0)
checks all 3003 subsets of 5 temperatures and returns the one with the
largest determinant of the information matrix, the quantity the greedy
method also increases step by step. Here the best subset beats the
greedy one by 0.5 % in the determinant, while its error bars for Tc
and tau are slightly larger: the determinant measures the volume of
the error ellipsoid of all three parameters, not each error bar.
log_det (new in 0.17.0) is returned by both methods. The exhaustive
search is refused above 2 000 000 subsets.
20. Error bars that include the heater calibration and the Monte Carlo
import numpy as np
from absnoise import (RECIPES, SensorBudget, ep_temperature, fit_ep_coupling,
matched_recipe, click_monte_carlo, H_PLANCK)
# The heating curve of Example 12, with a heater calibration known to 5 %.
r = RECIPES[1]
P = np.concatenate([[0.0, 0.0], np.geomspace(1e-17, 3e-14, 12)])
rng = np.random.default_rng(5)
Te = ep_temperature(P, 0.03, r.area, 2.5, 3.0) + rng.normal(0.0, 1e-3, P.size)
for pse in (0.0, 0.05):
fit = fit_ep_coupling(P, Te, r.area, Tp_K=0.03, sigma_Te=1e-3,
fit_Tp=True, power_scale_error=pse)
G = fit.propagate(lambda s, d: SensorBudget(r, sigma=s, delta=d).Gep(0.225))
print(f"heater known to {pse * 100:.0f} %: Sigma = {fit.Sigma:.2f} +- "
f"{fit.sigma['Sigma']:.2f}, delta = {fit.delta:.3f} +- "
f"{fit.sigma['delta']:.3f}, G_ep(0.225 K) = {G['value'] * 1e15:.1f} "
f"+- {G['sigma'] * 1e15:.1f} fW/K")
# The click Monte Carlo of Example 7, now with its statistical errors.
b = SensorBudget(matched_recipe(0.05, W=5.3e-6, L=0.5e-6))
mc = click_monte_carlo(b, H_PLANCK * 26e9, tauA=1e-7, T0=0.05,
n_trials=200, seed=3)
print(f"SNR {mc['snr']:.2f} +- {mc['snr_err']:.2f}, efficiency "
f"{mc['efficiency']:.3f} +- {mc['efficiency_err']:.3f}, dark fraction "
f"{mc['dark_fraction']:.3f} +- {mc['dark_fraction_err']:.3f}")
heater known to 0 %: Sigma = 2.50 +- 0.06, delta = 3.002 +- 0.015, G_ep(0.225 K) = 136.2 +- 1.0 fW/K
heater known to 5 %: Sigma = 2.50 +- 0.14, delta = 3.002 +- 0.015, G_ep(0.225 K) = 136.2 +- 6.9 fW/K
SNR 1.86 +- 0.12, efficiency 0.820 +- 0.027, dark fraction 0.210 +- 0.029
The cooling law depends on P / Sigma only, so if the heater delivers
k times the power you think, the fit returns Sigma / k and the same
delta and bath temperature. power_scale_error (new in 0.17.0) adds
that uncertainty to Sigma (and so to everything propagate computes
from it, here G_ep); delta does not change. The click Monte Carlo
now reports the statistical errors of its results: the binomial error
of the two fractions and the first-order error of the SNR. The tests
compare all of them with the scatter over independent seeds.
Tutorials
Three end-to-end scripts in the examples/ folder go from synthetic
"measured" data (fixed seeds, illustrative true values) to a final
result with error bars. Each prints a short summary; the test suite
runs all three and checks every printed number against the output
below.
examples/tutorial_detector_budget.py (a few seconds): an Ic(T)
curve and a heating curve, fitted with fit_ic_curve and
fit_ep_coupling, give the junction and its cooling law; the detector
budget built from them gives the thermal time, the phonon NEP and the
energy resolution. The error bars of both fits are carried through
with propagate and added in quadrature (the two curves are
independent measurements).
Ic(T) fit: Ic0 = 2.006 +- 0.006 uA, Tc = 0.7514 +- 0.0022 K, tau = 0.793 +- 0.013
heating fit: Sigma = 2.51 +- 0.06 W m^-2 K^-delta, delta = 2.991 +- 0.020, chi2 = 6.6 for 13 dof
budget at T = 0.200 K, tauA = 1 us (illustrative):
thermal time tau_th = 0.69 +- 0.01 ns
phonon NEP = 5.19e-19 +- 0.02e-19 W/sqrt(Hz)
energy resolution = 1.998e-22 J +- 0.014e-22 (Ic fit) +- 0.009e-22 (heating fit)
= 1.998e-22 +- 0.016e-22 J, the energy of a 301 +- 2 GHz photon
examples/tutorial_readout_trace.py (about 10 s): a noisy readout
trace of one Andreev level. The decoder gives the occupation and the
correlation time with error bars, markov_dwell_test checks the
single-rate model, the noise spectrum of the same record gives a
second estimate of the correlation time, and the occupation-noise
temperature resolution of Ti/Al/Au at 0.3 Tc follows for that
correlation time. It scales exactly as sqrt(tauA): Example 1 gives
40.48 uK for 1 us, and 40.48 uK times sqrt(998) is 1279 uK. Both
estimates of the correlation time come from the same record, so the
"difference" line is a loose consistency check, not a test.
decoder: f = 0.301 +- 0.011, tauA = 0.998 +- 0.031 ms (EM iterations: 6)
model check: p = 0.92 (dispersion 0.90 empty, 0.93 filled; 637 and 638 stays)
spectrum: tauA = 0.974 +- 0.033 ms (chi2 = 1993 for 2045 dof)
difference decoder - spectrum: 0.5 error bars
Ti/Al/Au at 0.225 K: dT_A in 1 s = 1279.01 +- 20.03 uK for tauA = 0.998 ms
examples/tutorial_readout_bandwidth.py (new in 0.14.0, a few
seconds): how much readout bandwidth a junction calorimeter needs. A
synthetic noise record of the resonator frequency (occupation noise of
Ti/Al/Au at 0.3 Tc with tauA = 1 us, plus a white readout floor)
is averaged into a spectrum of 32 segments and fitted with
fit_telegraph_psd(..., n_avg=32). The fit gives tauA, the floor
and the plateau; the plateau is checked against the budget's own
prediction. The energy resolution then follows for an unlimited band
and for readout bandwidths of 1, 3 and 10 MHz, together with the
bandwidth that brings it within 10 % of the unlimited value. The error
bars come from the fit's covariance of tauA and the floor
(TelegraphPSDFit.cov, new in 0.14.0), carried through along its
principal axes.
spectrum fit: tauA = 1.023 +- 0.021 us, floor = 5.58e-15 +- 0.02e-15 1/Hz, chi2 = 2820 for 2946 dof
plateau S0 = 1.747e-13 +- 0.056e-13 1/Hz, budget prediction 1.682e-13 (1.2 error bars apart)
energy resolution, unlimited band: 2.751e-21 +- 0.043e-21 J
readout bandwidth 1 MHz: 3.735e-21 +- 0.046e-21 J (1.36 times the unlimited value)
readout bandwidth 3 MHz: 3.035e-21 +- 0.044e-21 J (1.10 times the unlimited value)
readout bandwidth 10 MHz: 2.826e-21 +- 0.043e-21 J (1.03 times the unlimited value)
bandwidth for 1.1 times the unlimited value: 3.08 +- 0.03 MHz
What changed in 0.17.0
New:
sampling="average"intelegraph_psd_model,fit_telegraph_psd,plan_psd_measurement,averages_for_tauandavar_exponential: the spectrum and the Allan variance of a readout that records the mean of the signal over each sample interval (Example 16). This lifts a stated limit of 0.16.0.n_recordin the same spectrum functions: the exact expected periodogram of a record ofn_recordsamples (leakage of a finite record). This lifts another stated limit of 0.16.0 (Example 16).n_avgwith one value per point infit_telegraph_psdandplan_psd_measurement, for spectra whose points rest on different numbers of periodogram values (Example 17). Up to 0.16.0 one number had to serve all points.fit_hmm(..., equal_noise=False)andTelegraphHMM(..., sigma=(s0, s1)): a readout noise width for each state, with the exact gradient and error bars for all six parameters (Example 18).markov_dwell_testalso tests the correlation of successive stays (correlation,p_correlation; Example 18).p_valueis unchanged.design_ic_temperatures(..., method="exhaustive"): the best subset of temperatures, by checking every subset, andlog_detin the result (Example 19).fit_ep_coupling(..., power_scale_error=...): the uncertainty of the heater calibration in the error bar ofSigma(Example 20).click_monte_carloreturnsefficiency_err,dark_fraction_errandsnr_err(Example 20).
Faster, with the same results: the Matsubara sums of JunctionModel
(Ic_matsubara, cpr_matsubara, cpr_series, and so calibrate and
junction_properties) add the terms one by one only up to 20 times the
gap and integrate the rest. calibrate() at 20 mK, median of 3 on a
shared machine: 1.49 s -> 0.18 s (Ta/Ti/Au), 0.47 s -> 0.06 s
(Ti/Al/Au), 1.32 s -> 0.08 s (Ti/Al(thin)), 2.36 s -> 0.11 s
(Ti/Al(thick)), 2.77 s -> 0.06 s (Ti/Nb/NbN) and 8.93 s -> 0.13 s
(MoRe). The scales agree to all nine printed digits, and the sums
agree with the full sum of 0.16.0 to about 1e-12.
Corrected (details under
Corrections in earlier versions):
inputs that gave silent nonsense or a confusing error in 0.16.0, in
allan_variance (a window of 2.5 samples was taken as 2), ic_model,
gap_bcs, steady_temperature, noneq_penalty, tau_activated,
channel_generator, avar_white, TelegraphHMM, matched_Tc,
click_template, click_monte_carlo, two_temperature_click,
telegraph_traces, save_ic_csv and save_trace_csv; and
SensorBudget.freq_noise_spectrum, which raised TypeError for a list
of frequencies. No function was renamed or removed, and Examples 1 to
15 and the tutorials print what they printed with 0.16.0.
What changed in 0.16.0
New (Example 15):
fit_telegraph_psd(..., dt=...),telegraph_psd_model(..., dt=...),plan_psd_measurement(..., dt=...)andaverages_for_tau(..., dt=...): the noise spectrum of a trace sampled everydt, with the noise folded back from above the Nyquist frequency, in closed form. Withoutdtthe fit treats the spectrum as a Lorentzian, as before; on a spectrum that reaches the Nyquist frequency this biasestau(by 3.7 % even atdt = tau/40, in the tests). This lifts a stated limit of earlier releases.avar_exponential(..., dt=...): the Allan variance thatallan_varianceactually estimates, for windows of whole samples. For a window of one sample it differs from the continuous-time closed form by 51 % atdt = tau/40.
Corrected (details and before/after numbers under Corrections in earlier versions):
occupation_heat_capacitiesandcontinuum_shareat a phase that is not on their internal phase grid: they used the nearest grid phase (up to 0.020 rad away), without notice. The heat capacity of the bound levels was then 1.2 % off atphi0 = 1.0for Ti/Al/Au.load_ic_csvandload_trace_csvreadnanandinf; anantime madeload_trace_csvreturndt = nan.ShortJunction.andreev_sumsandtemperature_boundtook anywhichother than"I"as"L"(asFiniteLJunctiondid up to 0.13.0).two_temperature_clickran with a negativetauA(the occupation then rose above 1) and returned NaN for a NaN input.psd_single_sidedaccepted a negativedt(a negative spectrum),allan_variancean infinite or NaNdt, andTelegraphHMM.ratesa negativedt(a negative correlation time).
Also: 77 comparisons in the earlier tests stated a relative tolerance
but no absolute one, so the default absolute tolerance of
pytest.approx (1e-12) or of NumPy's isclose (1e-8) applied. For
quantities of order 1e-21 J/K or 1e-6 A that made the check almost
empty: pytest.approx(1.30e-21, rel=1e-5) accepts 1.29e-21. All of
them now state an absolute tolerance of 0 and still pass, so the
tolerances this README quotes do hold. No function was renamed or
removed, and Examples 1 to 14 print what they printed with 0.15.0.
What changed in 0.14.0
New:
energy_resolution(..., f_max=...)andmatched_filter_sigma(..., f_max=...): the matched-filter energy resolution for a readout of finite bandwidth, in closed form; andSensorBudget.bandwidth_for_resolution: the bandwidth that brings it within a chosen factor of the unlimited value (Example 13).JunctionModel.Ic_matsubara: the exact critical current of the full finite-length model, from the Matsubara-sum current;calibrate(method="matsubara")andjunction_properties(..., method="matsubara")use it (Example 14). In 0.14.0 the default calibration stayed as it was; since 0.15.0 it is the exact one.TelegraphPSDFit.cov: the covariance of the fitted spectrum parameters, with their correlations.- A third tutorial, on the readout bandwidth (see Tutorials).
Corrected (details and before/after numbers under Corrections in earlier versions):
FiniteLJunctionwithin1e-3rad of zero phase (its finite difference step), where the two levels of an Andreev doublet cross: the inductance-readout sums were wrong by a factor of up to about 1000 (saturation ratio 853.79 instead of 1.00747 for Ti/Al(thick) atphi = 1e-4).
Also new: FiniteLJunction refuses an unknown which (it was taken as
"L") and a temperature at or above Tc; SensorBudget refuses a
non-positive sigma, delta, L_r or nu_r. The source
distribution now contains examples/, so the tutorial tests run from
it too.
Faster, with the same results: markov_dwell_test decodes its
simulated traces in batches (identical paths, checked exactly; 2.8 to
3.0 times faster for the 500 traces of Example 10). No function was
renamed or removed, and Examples 1 to 12 print what they printed with
0.13.0.
What changed in 0.13.0
New:
JunctionModel.cpr_series(T)andJunctionModel.cpr_matsubara(T): the exact slope and cubic term of the current-phase relation, and the whole relation, of the finite-length model with its continuum, from the Matsubara-sum free energy (Example 11).junction_propertiesandJunctionModel.dIdphi0now use them.fit_ep_coupling(P, Te, area, Tp)andEPCouplingFit: the electron-phonon cooling law (Sigma,delta, optionally the bath temperature) from a measured heating curve, with error bars andpropagate(Example 12).ep_temperatureis its model curve.- Two tutorials in
examples/(see Tutorials).
Corrected (details and before/after numbers under Corrections in earlier versions):
JunctionModel.dIdphi0(44 % low for a zero-length junction, 57 % low for Ti/Al/Au) and thea3ofjunction_properties(6 % off for Ti/Al/Au).abs_energiesat zero phase: it returned one level of each degenerate pair, soFiniteLJunctionatphi = 0counted half of the occupation heat capacity.ShortJunction.dlnIc_dTanddlnI1_dTfar below and just belowTc(inf, NaN or -inf).sigma_spectrumfor tiny occupations (it stopped with anAssertionError) and for small rates (it returned zero).continuum_sharebelow about 0.03Tc(ZeroDivisionError, for example at 20 mK for Ti/Al/Au) and below 0.002Tc(evaluated at a negative temperature).SensorBudget.nep_spectrumaccepted a negative readout floor.
Faster, with the same results: telegraph_traces (identical traces;
4 times faster for the 64 channels of Example 5, about 350 times for
one channel), and the level search and free energy of JunctionModel
(levels about 2.8 times faster, free energy 2.4 times, calibrate 2.4
times; free energy equal to 1e-13). No function was renamed or removed. JunctionModel.dIdphi0
ignores its k argument (with a DeprecationWarning).
What changed in 0.12.0
New:
IcFit.propagate(func, ...): error bars on any number computed from a fitted junction, from the covariance of the Ic(T) fit (Example 9). It refuses when the result is too nonlinear over the error bars for one error bar to describe it.markov_dwell_test(y, model)anddwell_times(path, dt): a check that a decoded readout trace follows the single-rate telegraph model the decoder assumes, calibrated by simulating the fitted model (Example 10).
Corrected (details and before/after numbers under Corrections in earlier versions):
gap_bcsbetween 0.99TcandTc(it returned 0 from 0.9995Tcon, and was up to 0.7 % off just below).avar_exponentialfor averaging times much shorter than the correlation time (it lost all accuracy, and turned negative atT = 1e-6 tau).ic_modelandShortJunction.Icat and aboveTc(NaN, now 0), and soplan_ic_measurementwith a planned temperature aboveTc.- The sign of
absnoise.levels.continuum_free_energy. plan_psd_measurementwith a non-integern_avg.
Also new: click_template refuses a negative deposited energy, a
non-positive tauA or T0, and accepts a zero deposit (it raised
ZeroDivisionError); avar_exponential refuses non-finite inputs.
No function was renamed or removed, and results that were correct
before are unchanged (all eight earlier examples print exactly what
they printed with 0.11.0).
What changed in 0.11.0
New:
SensorBudget.energy_resolutionis computed in closed form over all frequencies (matched_filter_sigma); 0.10.x integrated numerically over a band that ended too early and overestimated the resolution (see "Corrections" below).method="grid"reproduces the old numbers.TelegraphHMM.uncertainties(y, dt): error bars for everythingfit_hmmreturns (Example 6); alsoscore(the exact gradient of the likelihood) andloglik.flip_probabilities(f, tauA, dt): the exact per-sample flip probabilities, now used by bothtelegraph_tracesand the decoder.fit_telegraph_psd(..., n_avg=n)corrects the known offset of a log-averaged periodogram and uses its exact scatter; the PSD planner uses the same scatter (Example 8).fit_hmmstarts from the best two-group split of the samples, which works for traces the old median split could not handle, and the decoder runs about 10 times faster.
The corrections, with before/after numbers, are listed under Corrections in earlier versions.
What is in the package
Junctions and levels
Recipe,RECIPES-- a junction design; the six measured recipes of Jung et al. (index 0 to 5: Ta/Ti/Au, Ti/Al/Au, Ti/Al(thin), Ti/Al(thick), Ti/Nb/NbN, MoRe).abs_energies(phi, tau, c, Delta)-- the exact Andreev levels of one channel of finite length, found by solving a closed-form equation.gap_bcs(T, Tc, Delta0)-- the gapDelta(T), from the gap equation of BCS theory (the standard Bardeen-Cooper-Schrieffer theory of superconductivity) solved numerically, not the common interpolation formula. Since 0.12.0 it follows the square-root closing of the gap right up toTc.ShortJunction-- the closed-form short-junction model: levels, current-phase relation,Ic,dIdphi0, occupation sums andtemperature_bound.FiniteLJunction-- the same sums from the exact finite-length levels, andsaturation_ratio(1 means on the bound).JunctionModel,junction_properties-- the full mode-summed model of a recipe, including states above the gap (the continuum), calibrated to the measuredIcat 20 mK. Since 0.13.0,JunctionModel.cpr_series(exactI'(0)and phase-cubic term) andJunctionModel.cpr_matsubara(the current-phase relation) evaluate the same model as a sum over Matsubara frequencies; since 0.14.0,JunctionModel.Ic_matsubaragives its exact critical current, andcalibrateandjunction_propertiestakemethod="matsubara". Since 0.17.0 these sums add the terms one by one only up to 20 times the gap and integrate the rest, 8 to 70 times faster at 20 mK.continuum_share,occupation_heat_capacities-- how much of the current, and of the occupation heat capacity, comes from the continuum.
Graphene thermal model (materials)
carrier_density,fermi_energy,dos_ef,n_modes-- electron density from the gate voltage, and quantities derived from it.heat_capacity,ep_power,gth-- electron heat capacity, electron-phonon cooling power and thermal conductance.steady_temperature-- the electron temperature at which cooling balances a steady absorbed power (readout self-heating).fit_ep_coupling,EPCouplingFit,ep_temperature(0.13.0): fit the cooling law to a measured heating curve; the fit result (withGandpropagate); the model curve. Since 0.17.0 the fit takes the uncertainty of the heater calibration (power_scale_error).
Occupation noise
channel_generator,sigma_spectrum-- the four-state master equation of one channel (the equations for how the probabilities of its four occupation states change in time), with single and pair processes, and its exact spectrum.tau_activated,noneq_penalty-- an energy-dependent (thermally activated) correlation time, and the resolution penalty of an excess, non-equilibrium occupation.telegraph_traces,psd_single_sided,flip_probabilities-- Monte Carlo telegraph signals (exact at any time step), their periodogram, and the exact per-sample flip probabilities.allan_variance,avar_exponential,avar_white-- the Allan variance of data, and its closed forms for exponentially correlated and white noise (avar_exponentialis accurate for any averaging time since 0.12.0, and withdtsince 0.16.0 gives the expectation ofallan_variancefor data sampled everydt; withsampling="average"since 0.17.0, for a readout that averages over each sample interval).
Device budget and single photons
SensorBudget-- one recipe as a detector:dT_andreev,dT_phonon,freq_noise_spectrum,energy_resolution,energy_resolution_analytic_A,nep_spectrum, plusCe,Gep,tau_th,LJandparticipation(the share of the resonator's inductance that the junction supplies). Since 0.14.0energy_resolutiontakes a readout bandwidthf_max, andbandwidth_for_resolutionreturns the bandwidth a target resolution needs.matched_filter_sigma(P, Q, W, tau_th, tauA, f_max=None)-- the closed-form energy resolution behindenergy_resolution, from the three noise levels ofnep_spectrum(phonon, occupation, readout) at zero frequency, for an unlimited band or up tof_max.matched_Tc,matched_recipe-- the matched-level design.click_template,click_monte_carlo-- the response to one photon, noiseless and with noise (with the standard errors of the Monte Carlo results since 0.17.0).two_temperature_click,total_energy-- the same with a heated local phonon bath, and its conserved energy.
From measured data
fit_ic_curve,IcFit,ic_model-- the Ic(T) fit, its result (withto_recipe, andpropagatefor error bars on anything computed from the fitted junction), and the model curve.fit_telegraph_psd,TelegraphPSDFit,telegraph_psd_model-- the noise-spectrum fit, its result (with the covariancecovsince 0.14.0), and the model spectrum. Since 0.16.0 all three take the sample intervaldtof the trace, and then use the spectrum of the sampled process, folded-back noise included. Since 0.17.0 they also takesampling="average"(a readout that averages over each sample interval) andn_record(the expected periodogram of a finite record), and the fit takesn_avgwith one value per point.fit_hmm,TelegraphHMM-- the readout-trace decoder (posterior,viterbi,forward_backward,rates,from_rates, anduncertainties,score,loglikfor error bars). Since 0.17.0 with one noise width for both states or one for each (equal_noise=False).markov_dwell_test,dwell_times-- does a decoded trace follow the single-rate telegraph model (the spread of the stays, and since 0.17.0 the correlation of successive stays)? And the stays in each state.load_ic_csv,save_ic_csv(headerT_K,Ic_AorT_K,Ic_A,sigma_Ic_A),load_trace_csv,save_trace_csv(headert_s,y),validate_ic_data-- the file formats and unit checks.
Planning
plan_ic_measurement,design_ic_temperatures-- planned Ic(T) error bars, and which temperatures to measure (greedy, or since 0.17.0 the best subset by checking all of them).psd_band_for_tau,plan_psd_measurement,averages_for_tau-- the frequency band, the planned spectrum-fit error bars, and the number of averages for a target error ontau(the last two also for a sampled spectrum, withdt, since 0.16.0, and withsamplingandn_recordsince 0.17.0).
Constants -- HBAR, KB, E_CHARGE, H_PLANCK, PHI0, EPS0
(CODATA 2018) and V_F (graphene Fermi velocity, 1.0e6 m/s).
Each function's docstring (help(absnoise.fit_ic_curve), for example)
gives its inputs, units and conventions.
When it refuses, and why
absnoise raises an error instead of guessing when:
two_temperature_clickis called without all three phonon parameters (c_ph,kappa_pb,delta_pb): they are measurements of a real device, and none are shipped. It also refuses a non-positivec_phordelta_pb, a negativekappa_pbor a negative deposited energy.fit_telegraph_psdgets a spectrum that changes by less than a factor of 4 across the band, or whose fitted knee lies outside[2 f_min, f_max/2]: such a band cannot determinetau. It also needs at least 8 points, positive frequencies (drop the zero-frequency point), a positive PSD and, if given,n_avg >= 1.plan_psd_measurementandaverages_for_tauget a planned band the fit would refuse (the same rules, applied in advance),n_avg < 1or not finite, or a non-positive target;psd_band_for_taugets a margin below 4.fit_ic_curvegets fewer than 4 points, fewer than 5 points without measurement errors (the noise level must then be estimated from the residuals), non-finite values, non-positive temperatures or currents, or non-positive errors. It raisesRuntimeErrorif the fit does not converge or the data cannot separate the three parameters. If the data stay below 0.3Tc, it warns (it does not refuse) thatTcandtauare weakly determined.plan_ic_measurementanddesign_ic_temperaturesgettauoutside (0, 1], a non-positiveIc0,Tc, temperature or error, a number of picks outside 3 to the number of candidates, or candidates that cannot determine the parameters even all together.- a data file has the wrong header or number of fields, fewer than 2
rows, temperatures that do not strictly increase, or (for a trace) a
time grid that is not uniform; the file is refused, not repaired.
validate_ic_datarefuses non-finite values, non-positive temperatures and negative currents. allan_variancegets fewer than 4 samples, non-finite samples, adtthat is not finite and positive (non-finite since 0.16.0) or a window outside1 <= m <= len(x)//2; the closed forms get a negative variance or PSD, or non-positive times (avar_exponentialalso refuses non-finite inputs).TelegraphHMMgets flip probabilities outside (0, 1), a non-positive noise or not exactly two levels.steady_temperaturegets a negative power;nep_spectrumgets a negative or non-finite frequency;click_templateandtwo_temperature_clickget a scenario other than"C"or"T".- a
SensorBudgetmethod gets a temperature that is not positive, or one at or aboveTcwhere the gap has closed (onlyCe,Gep,tau_thanddT_phononwork aboveTc), a non-positivetauAor averaging time, awhichother than"L"or"I", or a negative readout floor. (Up to 0.10.x these gave aZeroDivisionErroror a silent NaN.)matched_Tcgets a non-positiveT0. telegraph_tracesandflip_probabilitiesgetfoutside [0, 1] or a non-positivetauAordt. (Up to 0.10.xtelegraph_tracesinstead refused coarse time steps, with a Pythonassert.)IcFit.propagatefinds that the result is too nonlinear over the error bars (second-order change over one standard deviation abovemax_nonlinearitytimes the error bar, default 0.1), that a parameter would leave its range within one standard deviation (Ic0 > 0,Tc > 0,0 < tau <= 1), or thatfuncreturns a non-finite value.markov_dwell_testgets fewer thanmin_dwells(default 30) complete stays in a state, a mean stay below 2 samples (sampling too coarse), fewer than 19 simulated traces, or a model that is not aTelegraphHMM.click_templategets a negative or non-finite deposited energy, or a non-positivetauAorT0.fit_hmmgets fewer than 4 samples, non-finite samples or a constant trace;forward_backwardandviterbiget an empty trace;ratesgets flip probabilities adding up to 1 or more (successive samples anti-correlated: no telegraph process does that);uncertaintiesfinds that the likelihood is not at a maximum or does not determine all five parameters.fit_ep_coupling(0.13.0) gets arrays of different lengths, non-finite values, a negative power, a non-positive temperature, area or error, too few points (the number of fitted parameters plus 1, or plus 2 without errors), no heated point, or no point above the bath. It refuses a fit whose exponent ends at the edge of its search range (1 to 8) and data that cannot separate the parameters, and it warns when every point stays within 10 % of the bath inTe^delta.EPCouplingFit.propagaterefuses in the same cases asIcFit.propagate.ep_temperaturerefuses a negative power and non-positive parameters.sigma_spectrum(0.13.0) getsfoutside [0, 1], a non-positive or non-finiteGs, or a negativeGp.ShortJunction.dlnIc_dTanddlnI1_dT(0.13.0) get a temperature that is not positive or is at or aboveTc;continuum_sharegets a temperature outside (0,Tc).SensorBudget.nep_spectrumrefuses a negative or non-finite readout floor (0.13.0), asenergy_resolutionalready did.energy_resolutionandmatched_filter_sigma(0.14.0) get anf_maxthat is not finite and positive, or anf_maxwithmethod="grid";bandwidth_for_resolutiongets afactorthat is not finite or not above 1.JunctionModel.Ic_matsubara(0.14.0) gets a temperature that is not positive, a model without a gap, fewer than 5 grid phases or a phase tolerance outside (0, 0.1);calibrateandjunction_propertiesget amethodother than"levels"or"matsubara".FiniteLJunction.andreev_sumsandsaturation_ratio(0.14.0) get awhichother than"I"or"L"(it was taken as"L") or a temperature that is not positive or is at or aboveTc(a NaN ratio up to 0.13.0);SensorBudgetgets asigma,delta,L_rornu_rthat is not finite and positive.fit_telegraph_psd,plan_psd_measurementandaverages_for_tau(0.16.0) get adtthat is not finite and positive, or, withdt, a frequency above the Nyquist frequency1/(2 dt);avar_exponentialgets adtthat is not finite and positive, or an averaging time that is not a whole number of samples.load_ic_csvandload_trace_csv(0.16.0) findnanorinfin the file.ShortJunction.andreev_sumsandtemperature_boundget awhichother than"I"or"L", a temperature that is not positive or is at or aboveTc, or (temperature_bound) atauAort_intthat is not finite and positive.two_temperature_clickgets a non-finite input or a non-positivetauAorT0.psd_single_sidedgets adtthat is not finite and positive, or non-finite samples;allan_variance,TelegraphHMM.ratesanduncertaintiesget adtthat is not finite and positive.continuum_sharegets aphi0closer than one grid step to 0 orpi, andoccupation_heat_capacitiesaphi0outside (0,pi), a temperature outside (0,Tc) or adT_fracoutside (0, 1).- the spectrum functions (0.17.0) get a
samplingother than"instant"or"average",sampling="average"orn_recordwithoutdt, ann_recordthat is not a whole number of at least 4, or, withn_record, a frequency that is not a binj / (n_record dt)with0 < j < n_record / 2;fit_telegraph_psdandplan_psd_measurementget an arrayn_avgof the wrong length or with a value below 1. TelegraphHMM(0.17.0) gets a noise width or a level that is not finite, or more than two widths.design_ic_temperaturesgets amethodother than"greedy"or"exhaustive", or more than 2 000 000 subsets to check.fit_ep_couplinggets a negative or non-finitepower_scale_error.- (0.17.0)
allan_variancegets a window that is not a whole number of samples;avar_whitea non-finite input;ic_modelatauoutside (0, 1], aTcthat is not finite and positive, or a negative temperature;gap_bcsa negative or non-finite temperature or aTcthat is not finite and positive;steady_temperaturea negative bath temperature or a non-positive area,sigmaordelta;noneq_penaltyanfoutside (0, 1) or aqoutside [0, 1];tau_activatedaTortau0that is not finite and positive;channel_generatorthe inputssigma_spectrumrefuses;matched_Tcaratiothat noTcbetween 1.01 and 6 timesT0gives (the error names the range);click_templateandtwo_temperature_clicka time step that is not finite and positive or a negative end time;click_monte_carlofewer than 2 trials;telegraph_tracesa number of steps or channels that is not whole;save_ic_csvandsave_trace_csvvalues that their loaders would refuse;freq_noise_spectruma negative or non-finite frequency.
How the results are checked
351 automated tests run on every push and pull request, on Python 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14, and once more on Python 3.9 with the oldest NumPy (1.24.0) and SciPy (1.10.0) the package allows. The numerical checks compare the package with an exact formula, a second calculation done a different way, or a simulation. A few checks compare with stored numbers on purpose, for example the recipe table (locked to its source) and one tabulated value of the BCS gap. Others check that refusals fire. Since 0.16.0 every comparison with a tolerance states its absolute tolerance, which is 0 wherever a relative tolerance is quoted below. The main checks:
Levels and gap
- Short-junction limit: the exact solver gives
Delta sqrt(1 - tau sin^2(phi/2))to 1e-12 (relative toDelta), for 6 transparencies and 4 phases. - Fully transparent, finite length: the levels satisfy the known exact level condition for that case (the Kulik condition) to 1e-10 rad.
- One clean channel at 1 mK:
Ic = 2 e Delta / hbarwithin 0.5 %. - BCS gap: equals
Delta0at 0.01Tcto 1e-10, is below 0.05Delta0at 0.99999Tc, equals the tabulated 0.956887 atTc/2within 2e-4, and falls monotonically. - BCS gap near
Tc(0.12.0): between 0.99 and 0.9998Tcit equals direct solutions of the gap equation in integral form to 1e-9, and closer toTcdirect solutions of its Matsubara-sum form; the two forms agree to 1e-9 from 0.1 to 0.999Tc. At 0.99999 and 0.999999Tcit matches the Ginzburg-Landau limitu = (pi t / A) sqrt(8 ln(t1/t) / (7 zeta(3))), derived from the sum, to 2e-5. It is continuous at 0.99Tc(1e-6), and below it returns the values of 0.11.0 (two checked to 1e-12). - The free energy of the continuum (0.12.0):
F_bound + F_contstays continuous (within 2 % of the bound-level jump) where a bound level leaves for the continuum, andcontinuum_free_energyagrees with theJunctionModelcode path to 5e-4. - Short junction: the continuum carries no phase dependence (below 1e-14).
- Levels at zero phase (0.13.0): the degenerate pair is returned twice,
equal to the levels at
phi = 1e-6within 1e-6; near zero phase (1e-9 to 1e-5) the levels satisfy the level condition with the angle2 asin(sqrt(tau) sin(phi/2))computed in the test to 1e-12 of that angle, and their splitting equals the first-order closed form within 1e-5;FiniteLJunctiongives the sameC_Aatphi = 0and1e-7(1e-9); away from the degeneracy the levels are identical to those of 0.12.1. Fortau = 1the level near zero energy close tophi = piis found (first-order closed form, 1e-6). - Matsubara-sum current (0.13.0): for zero length it equals the
closed-form short-junction current at every phase to 1e-9 of its
maximum, at 0.027, 0.3 and 0.9
Tc, and its slope and cubic term equal their closed forms (derived in the test) to 1e-9 and 1e-8. At finite length (Ti/Al(thick)) it agrees with the level-plus-continuumcurrent_phase, an independent calculation, within 2e-3 of the maximum away from zero phase, and its slope with an odd polynomial fitted to that current within 3e-3. The Legendre chi function used for the tail equals its series (1e-13) andpi^2/8at 1.junction_propertiesreturns the closed-form slope and cubic term (1e-9, 1e-8; 0.12.1 was more than 1 % off in the cubic term), anddIdphi0the closed-form slope (0.12.1: 44 % low). - Free energy speed-up (0.13.0):
free_energy_multiandfree_energy_componentsequal the 0.12.1 phase-by-phase loop (kept in the tests) to 1e-13 relative. - Finite-length sums near zero phase (0.14.0): for
|phi|below the difference step of 1e-3 rad, the inductance-readout responsivity and saturation ratio and the current-readout noise sum equal a calculation from the analytic level slopes and curvatures (implicit differentiation of the level condition along each branch, coded in the test) to 1e-6, andC_Ato 1e-12. The 0.13.0 ratio was more than 10 times too large there. From|phi| = 1e-3on, the level data are identical to those of 0.13.0. - Exact critical current (0.14.0): for zero length
Ic_matsubaraequals the closed-form maximum of the short-junction current at 0.027Tcto 1e-9 (its phase to 1e-6 rad), and the maximum over 200 001 phases at 0.5Tcto 1e-9. At finite length it agrees with the level-basedIcwithin 2e-3 and is never below the Matsubara current on a 40-phase grid. Aftercalibrate(method="matsubara")it returns the measuredIc20(1e-12). In thejunction_propertiestable with that method, the slope and the cubic term differ from the default only by the calibration scale (1e-12), andIcis theIc_matsubaravalue (1e-12). - Matsubara sums at low temperature (0.17.0): the head-plus-integral
sum equals the full sum of 0.16.0 (kept in the tests) for
temperatures from 0.0027 to 0.3
Tc, lengthsc Deltafrom 0 to 20 and transparencies 0.05 to 1, to 3e-12 (measured 1.9e-12, the rounding of the full sum itself), and the current of MoRe at 20 mK, all 159 modes, to 1e-12 (measured 2.4e-14).
Occupation noise and the bound
- A uniform short junction reaches the Cauchy-Schwarz bound to 1e-9; a finite-length junction (Ti/Al(thick), two phases) never goes below it (to 1e-9).
- The occupation responsivity (how much the signal changes per
kelvin) matches numerical differentiation to 1e-5, and
dIdphi0matches its closed form to 1e-12. - Master equation: without pair processes the variance is
2f(1-f)and the correlation time1/Gs, both to 1e-12; the variance does not depend on the pair rate (1e-12); the correlation time never rises with the pair rate; probability is conserved (1e-14); the spectrum integrates to the variance within 5e-4. - Telegraph Monte Carlo: the plateau within 10 %, half the plateau at
the knee within 0.12, and the variance of 50-second averages equals
S(0)/(2t)within 25 %. - Exact sampling: the flip probabilities equal the matrix exponential
of the two-state rate matrix (computed by SciPy) to 1e-9 relative,
for occupations 0.02 to 0.9 and time steps from 1e-6 to 7
tau, and reduce to the first-order values for tiny steps (1e-5); traces sampled atdt = tauhave autocorrelatione^-kat lags 1 to 3 within 0.01 (the first-order rule would give 0). - Periodogram:
sum(S) dfequals the variance of the data to 1e-12 (Parseval), for even and odd lengths. - Spectrum of a sampled trace (0.16.0): the closed form of
telegraph_psd_model(..., dt)equals the transform of the sampled autocovariance, summed term by term, to 1e-9 fordt/taufrom 0.01 to 4, and the sum of the Lorentzian over its folded copies (|n| <= 200 000, the rest in closed form) to 1e-9. Its integral up to the Nyquist frequency is the variance (1e-10), and atdt = 1e-4 tauit equals the Lorentzian to 1e-6. Noise-free sampled spectra (from the autocovariance sum) give backS0,tauand the variance to 1e-6 and the floor to 1e-4. On 40 telegraph records sampled atdt = tau/4, the errors oftauandS0divided by their error bars have a mean within 0.6 of 0 and a spread between 0.75 and 1.3, the meanchi2/dofis within 0.025 of 1, and the scatter oftauis within 20 % of the planned error bar; the Lorentzian fit with a floor is more than 2.5 % long on average. The planned error bars withdtequal the fit's within 0.1 %. sigma_spectrum(0.13.0): forfdown to 1e-200 and at 0 and 1 the variance, plateau and correlation time equal the closed form of two independent spins (1e-12; 0.12.1 stopped with anAssertionError); scaling all rates by 1e-20 to 1e15 rescales the result exactly (1e-12; 0.12.1 returned 0 below 1e-14); for ordinary inputs it equals the 0.12.1 code (kept in the tests) to 1e-12.- Telegraph speed-up (0.13.0): the traces are identical to those of the 0.12.1 step-by-step loop (kept in the tests) for eight sets of occupations, time steps and shapes, including block boundaries.
occupation_heat_capacities: the bound part equals the level sumC_AofFiniteLJunctionwithin 1e-5 (two code paths), also at phases off the old phase grid (0.16.0; 0.15.0 was 1.2 % off atphi0 = 1.0); the continuum part is exactly 0 at zero length; for Ti/Al/Au at 0.3Tcit is positive and below 10 % of the total.continuum_share(0.16.0): at two grid phases it equals the 0.15.0 computation (kept in the tests) to 1e-9, and across the midpoint between two grid phases it changes by less than 1e-5 (0.15.0 jumped by 0.007 inshare_Ithere).- Averaged samples (0.17.0): the spectrum of
sampling="average"equals the Lorentzian timessinc^2(pi f dt)summed over 400 001 aliases (1e-13; measured 1e-15) and the transform of the autocovariance of the averaged samples, obtained by numerical integration (1e-11; measured 5e-13); its integral up to the Nyquist frequency is the variance of the averaged samples (1e-10), and atdt = 1e-4 tauit is the Lorentzian (1e-6). Noise-free averaged spectra (from that autocovariance) give backtauandS0to 1e-9 and the floor to 1e-7 (measured 8e-15 and 1.1e-14). On 40 records of exactly averaged telegraph noise (the time spent filled in each interval, from simulated switch times) atdt = tau/4the fit returnstauandS0with errors that, in units of their error bars, have mean -0.09 and 0.03 and spread 1.03 and 0.93, chi2/dof 1.013, and a scatter oftau2 % from the plan; the instantaneous model putstau57 % long there. - Finite records (0.17.0): the expected periodogram of
n_recordequals the quadratic formv^H C vof the full covariance matrix of the samples, for both samplings and records of 16 to 257 samples (3e-12; measured 1.7e-13 for instantaneous samples, 1.8e-12 for averaged ones, where the quadratic form itself rounds), and the infinite-record spectrum for2^20samples (1e-4; measured 3e-5). The mean of 12 000 simulated periodograms of 128 samples follows it (largest deviation 2.3 standard errors over 63 bins) and not the infinite-record spectrum (8.5). On 30 such telegraph records the fit withoutn_recordputstau2.9 error bars short on average; with it the mean is 0.06 (spread 0.76: the error bars are conservative there, because neighboring bins of a short record are correlated). On 300 spectra with exact Gamma scatter around the expected periodogram of 1024-sample segments, the fit withoutn_recordis 0.22 (instantaneous) and 0.40 (averaged) error bars low on average, and with it -0.007.
Allan variance
- Linear drift: the estimator gives
(c T)^2 / 2to 1e-12. - The closed form matches the defining integral, rewritten without
cancellation and integrated adaptively, to 1e-9 from
T = 1e-8 tauto3 tau, and its Taylor series2r/3 - r^2/2 + 7r^3/30 - r^4/12(r = T/tau) to 1e-12 atr = 1e-3(0.12.0). - The closed form matches numerical integration of the defining integrals to 1e-6, and both limits to 1e-3.
- Telegraph Monte Carlo matches the closed form within 12 %, white
noise matches
S0/(2T)within 5 %. - Sampled data (0.16.0):
avar_exponential(..., dt)equals the defining double sum over the autocovariance, evaluated in 50-digit decimal arithmetic, to 1e-13 for windows of 1 to 60 samples anddt/taufrom 1e-7 to 20. It equalsvar (1 - e^(-dt/tau))for one sample (1e-14) andvar/mfor samples far apart (1e-12), and the continuous form at 20 000 samples per window (1e-4). Telegraph noise sampled atdt = tau/2follows it within 3 %, while the continuous form lies 41 % (one sample) and 18 % (two samples) below it. - Averaged samples (0.17.0): with
sampling="average"the expected Allan variance equals the double sum over the autocovariance of the averaged samples in 50-digit arithmetic (1e-12; measured 3e-16) for windows of 1 to 60 samples anddt/taufrom 1e-3 to 5; it is the continuous-time closed form.
Device budget
- The frequency-noise spectrum is exactly half the plateau at the knee and 1/101 of it at ten times the knee (1e-12).
- The phonon resolution equals its closed form (1e-18 K); the occupation resolution respects the bound; the full energy resolution is never better than 0.99 times the occupation-only closed form.
- NEP: the phonon part equals
sqrt(4 kB T^2 G)at every frequency to 1e-14; the occupation part has exactly the shapesqrt(1 + (2 pi f tau_th)^2)(1e-12); the zero-frequency ratio of the two equals the documented criterion (1e-12) and doubles whentauAdoubles (1e-12); the readout part rises faster. - Energy resolution: the closed form equals adaptive numerical
integration of
4 / NEP^2over all frequencies to 1e-8 (two code paths), with and without a readout floor, for both readouts"L"and"I"and two correlation times; the bare closed form matches the same integration to 1e-9 for five sets of noise levels, and two exact limits (occupation noise only; readout floor only) to 1e-14. The 0.10.x band-limited integral (method="grid") still equals the NEP integral on its own grid to 1e-10, and lies 3.3 % and 10.7 % above the closed form fortauA= 1 us and 1 ns. - Out-of-range temperatures, correlation times and averaging times
are refused, and (0.13.0) a negative readout floor in
nep_spectrum. - Readout bandwidth (0.14.0): the closed-form band integral equals
adaptive quadrature to 1e-10 for real, complex, equal and nearly
equal roots of the quartic, and without the quartic term. The
band-limited resolution equals quadrature of
4 / NEP^2fromnep_spectrumto 1e-8, for both readouts with and without a floor, and falls as the bandwidth grows; at 1 Hz it equalsNEP(0) / sqrt(4 f_max)(1e-12). The 0.10.x grid integral equals the closed form over its own band (1e-6). Without a floor the bandwidth for a factorFequals the closed formsqrt(a / b) tan(pi / (2 F^2)) / (2 pi)(1e-9); with a floor the resolution at the returned bandwidth isFtimes the unlimited value (1e-10). - Log slopes (0.13.0):
ShortJunction.dlnIc_dTat 0.99, 0.999 and 0.9999Tcequals a five-point derivative ofic_model(a separate implementation of Ic(T)) within 5e-3 (0.12.1: -inf above 0.998Tc); at 10 mK for MoRe both slopes are finite and below 1e-12 (0.12.1: inf and NaN); at 0.5Tcthe value is the 0.12.1 one, bit for bit. continuum_shareat 0.027Tcreturns a finite current share and NaN for the derivative share (0.12.1:ZeroDivisionError).
Recipes and thermal model
- The label,
Tc,tau,Ic20andRnof all six recipes equal Table I of Jung et al. exactly. - Gate voltage 20 V gives the quoted density 1.7e16 m^-2 within 5 %;
the heat capacity at 1 um^2, 1.7e16 m^-2 and 0.1 K lies between 4 and
8
kB. steady_temperatureround trip:ep_power(steady_temperature(P))returnsPwithinmax(1e-12 P, 1e-30 W).- Cooling-law fit (0.13.0): noise-free data return
Sigma,delta(1e-8) and the bath temperature (1e-7); a Nelder-Mead search on a chi-square coded in the test finds the same minimum (1e-6); withdeltaandTpfixed the error bar ofSigmaequals the closed form[sum (dTe/dSigma / sigma)^2]^(-1/2)(1e-6); over 150 noisy fits the scatter ofSigmaanddeltais between 0.8 and 1.2 times the reported error bars and their means are within 4 standard errors of the true values;GequalsSensorBudget.Gepwith the fitted parameters (1e-14) and a numerical derivative ofep_power(1e-8);propagateis exact for a linear function (1e-10) and forSigma^2(1e-9), and uses the marginal block whenTpis fitted; refusals and the near-linear warning fire. - Heater calibration (0.17.0): fitting the powers times 1.3 gives
Sigmatimes 1.3 and the samedeltaand bath temperature (1e-8; measured 3e-9, the optimizer's tolerance);power_scale_erroradds exactly(Sigma s)^2to the variance ofSigma; over 150 heating curves with calibrations drawn from 1 +- 5 %, the scatter ofSigmais within 15 % of the stated error bar (measured 4 %) and 9 times the error bar without the calibration.
Single photons
- Matched design:
Delta(T0) / (kB T0) = 2.3994to 1e-9, both from the gap equation and inside theSensorBudgetof the matched recipe (0.10.x gave 2.39954 there). - The starting electron temperature satisfies
gamma (T_pk^2 - T0^2) / 2 = E_gammato 1e-12 (this checks the starting point, not the time integration). - The noiseless template dips and returns within 0.5 % of its start; the Monte Carlo has signal-to-noise above 1 and efficiency above the dark fraction.
- Two-temperature model: with nothing deposited, both temperatures
stay exactly at the start value (not even rounding drift); with no
escape, energy is conserved within 1e-5 and both temperatures end at
the independently computed common temperature within 1e-5; with a
very large phonon heat capacity it reproduces
click_templatewithin 1e-3; with escape on, both temperatures shed more than 99 % of their excursion. - Click Monte Carlo errors (0.17.0): over 24 seeds of 60 records, the scatter of the efficiency, the dark fraction and the SNR equals the mean of their stated errors within 35 % (measured -0.2 %, -3.7 % and +7.9 %).
Fits and decoder
- Ic(T) model: the closed-form zero-temperature maximum equals a dense
grid maximum within 1e-8 (transparencies 0.05, 0.3, 0.78, 0.99 and
1);
ic_modelequalsShortJunction.Icwithin 1e-12 for all six recipes; both are exactly 0 at and aboveTc, and a planned point aboveTcleaves the planned error bars unchanged (1e-12). - Error propagation (
IcFit.propagate): exact for a linear function of the parameters (1e-10, also the fit's own error bars and covariance block); forTc^2the closed form2 Tc sigma(Tc)(1e-9) and the expected range of the nonlinearity measure; for the Josephson inductance, the spread of 400 parameter sets drawn from the covariance within 12 % (the standard error of that spread is 3.5 %); refusals for a nonlinear function,tauwithin one error bar of 1, and non-finite results. - Dwell-time check: stays counted by hand on a short path; the
dispersion index of 200 000 geometric samples within 0.02 of 1; the
simulated reference paths have the closed-form occupation and flip
rate (1 % and 3 %); on 12 Markov traces (
telegraph_tracesplus noise, each fitted withfit_hmm) no p-value is below 0.01 and their mean lies between 0.3 and 0.75; a trace whose filled stays have two time scales gives dispersion above 1.4 and p-value at most 0.01. - Ic(T) fit: noise-free data return
Ic0andTcwithin 1e-6 andtauwithin 1e-5; over 60 noisy fits the scatter is between 0.5 and 1.5 times the reported error bars; a fitted recipe fed back intoShortJunctionreproduces the curve within 1e-4. - Spectrum fit: noise-free data return
S0andtauwithin 1e-6 and the floor within 1e-4; on telegraph Monte Carlo,tauwithin 15 %, the variance within 15 % of the trace variance,S0within 20 %. - Spectrum fit with
n_avg: the offset correction changestauby less than 1e-7 and scalesS0and the floor by exactlyexp(ln n - psi(n))(1e-7); on 300 spectra with the exact scatter of an average of two periodograms, the mean ofln(S0_fit/S0)is within 3 standard errors of 0 (0.10.x: -0.27), the floor within 10 % (it keeps a bias of about -5 % from the fit's nonlinearity), the meanchi2/dofwithin 0.06 of 1 (0.10.x: 1.29), and the scatter oftauwithin 20 % of the planned error bar. - Decoder: above 99.9 % of samples correct at noise 0.15; at noise 0.5
the stated confidence matches the real accuracy within 0.01; the fit
finds
fandtauwithin 4 statistical errors and the levels and noise within 0.02; the log-likelihood never decreases (within 1e-6 relative).ratesinvertsfrom_ratesto 1e-9, also atdt = 2 tau. - Decoder speed-up: the new recursions give the same posteriors, transition probabilities and log-likelihood as the 0.10.1 matrix code (kept in the tests) to 1e-12, and the same Viterbi path.
- Decoder error bars: the exact gradient equals finite differences of
the log-likelihood to 1e-5; at high signal-to-noise the error bars
of the flip probabilities equal the binomial closed form
sqrt(p (1 - p) / N)within 0.5 %; over 30 simulated traces the errors oftauandf, divided by each trace's own error bar, have a standard deviation between 0.65 and 1.4 and a mean within 0.6 of zero; atdt = tau/2the fit findstauwithin 4 error bars (the 0.10.x conversion is more than 20 % off on the same fit). - Decoder robustness: with one 200-sigma outlier (0.10.1 returned NaN) the log-likelihood equals a log-space forward recursion to 1e-10 and the fit runs with a non-decreasing likelihood; a single-sample trace matches its closed form to 1e-14.
- Decoder start: a noise-free trace filled 90 % of the time (which 0.10.x could not start on) returns both levels to 1e-6 and the exact state sequence; the two-group split equals a brute-force search over all thresholds to 1e-12.
- Spectrum-fit covariance (0.14.0): over 400 spectra with the exact
scatter of an average of four periodograms, the observed
correlations of
S0,tauand the floor agree withcovwithin 0.12, and the observed scatter with its diagonal within 15 %;sqrt(diag(cov))equalssigma(1e-12). - Dwell test speed-up (0.14.0): the batched decoder returns the same
paths as
viterbi(compared exactly, also with a far outlier and with exact ties), andmarkov_dwell_testthe same p-values and dispersions as the 0.13.0 loop (kept in the tests). - Files: Ic files round-trip exactly; trace files round-trip the
samples exactly and
dtwithin 1e-18 s. - Tutorials (0.13.0, the third since 0.14.0): every script in
examples/runs in the tests, and every printed line matches the output given in the README and in the script, each number within two units of its last printed digit. - Spectrum fit with one
n_avgper point (0.17.0): an array of equal values gives the scalar fit (1e-7; measured 2e-8, the optimizer's path) and the scalar plan (1e-12); on 300 spectra whose points rest on 1 to 40 periodogram values (exact Gamma scatter) the mean ofln(S0_fit / S0)is within 3 standard errors of 0 (measured 1.8), chi2/dof is 0.993 and the scatter oftauis 0.6 % from the plan; one mean number for all points putsS025 % low. - Decoder with two noise widths (0.17.0): a pair of equal widths gives
the one-width likelihood (1e-14), Viterbi path and posteriors; the
exact gradient equals finite differences of the likelihood (1e-5;
measured 3e-9); the batched decoder returns the
viterbipaths exactly; over 16 traces with widths 0.2 and 0.45 the errors oftau,fand the two widths in units of their error bars have means between -0.16 and 0.39 and spreads between 0.65 and 1.05 (over 60 other traces,tau: mean -0.03, spread 1.03), while the one-width model putstau37 % short. - Correlation of successive stays (0.17.0): the statistic equals a hand count on a short path (1e-12); on a trace whose stays are exactly geometric in each state but linked from one stay to the next, the dispersion test gives p = 1.0 and the correlation test 0.00995 (its smallest possible value with 200 simulated traces); on 10 Markov traces the correlation p-values have mean 0.55 and are all above 0.05.
Planning
- Planned Ic(T) error bars equal the fit's within 5 %; 250 simulated
cooldowns scatter in
Tcwithin 20 % of the plan; a run below 0.3Tcis flagged and itsTcerror is more than 10 times larger; the greedy design is never worse than 20 random choices. - Planned spectrum-fit error bars equal the fit's within 0.1 %, also
for non-integer
n_avg(1.5, 2.5, 7.3; 0.12.0); thesqrt(psi'(n_avg))scaling holds to 1e-9;averages_for_taureturns the smallest sufficient number; 300 simulated spectra scatter intauwithin 20 % of the plan; a band frompsd_band_for_tauis accepted by the fit and returnstauwithin 1e-4. - Exhaustive design (0.17.0): the returned subset equals a brute-force
loop over all 330 subsets of 4 among 11 temperatures, its
log_detthat loop's largest value (1e-12), never below the greedy one.
Corrections in earlier versions
0.17.0 (this release) corrects inputs that gave silent nonsense or
a confusing error in 0.16.0. Each was found by a test that fails on
0.16.0 and passes now (tests/test_v017.py). None of them changes the
output of Examples 1 to 15 or of the tutorials, and results for valid
inputs are unchanged.
- A window that is not a whole number of samples.
allan_variance(x, dt, m_list=[2.5])usedm = 2and reported it at2 dt, without notice (NumPy cut the value to an integer). It is refused now. - Parameters out of range that returned NaN.
ic_modelwithtau = 1.2,tau = 0or a negative temperature,gap_bcswith a negative temperature andsteady_temperaturewith a negative bath temperature returned NaN (with aRuntimeWarningat most).noneq_penalty(0.0, 0.3)returned 4.6e149 (a division by its floor of 1e-300) andnoneq_penalty(0.2, 1.3)returned 0.tau_activatedatT = 0raisedZeroDivisionError,channel_generatorbuilt a rate matrix with negative rates from a negative rate, andavar_whitereturned NaN for a NaN input. All are refused now. - Decoder parameters.
TelegraphHMM(..., sigma=nan)was accepted, and every later call failed with "the trace contains non-finite samples", which pointed at the data instead of the model. A NaN noise width or level is refused when the model is built. - Time grids of the click functions.
click_templatewith a negativedtskipped its first stage without notice (it returned 361 points from the second stage only, in the test case), anddt = 0raisedZeroDivisionError;two_temperature_clickraisedZeroDivisionErrorfordt = 0and "negative dimensions are not allowed" for a negativedt;click_monte_carlowith one trial returnedsnr = inf. All are refused with a plain message. - Other inputs.
matched_Tc(0.05, ratio=20)stopped with SciPy's "f(a) and f(b) must have different signs"; it now names the range of ratios its search can reach (0.3068 to 10.58 at 50 mK).telegraph_tracescut 2.7 steps to 2.save_trace_csvwrotenanandsave_ic_csvwrote decreasing temperatures, files that their own loaders refuse.SensorBudget.freq_noise_spectrumraisedTypeErrorfor a list of frequencies (it multiplied the list by a float); it now takes a list and refuses negative or non-finite frequencies, asnep_spectrumdoes.
0.16.0 corrects five problems of 0.15.0. Each was
found by a test that fails on 0.15.0 and passes now
(tests/test_v016.py). None of them changes the output of Examples 1
to 14 or of the tutorials.
- Heat capacities and shares at a phase off the grid.
occupation_heat_capacities(recipe, T, phi0)andcontinuum_share(recipe, T, phi0=...)computed the free energy on a grid ofn_phiphases (default 81, spacing 0.039 rad) and returned the value at the grid phase nearest tophi0, up to 0.020 rad away. For Ti/Al/Au at 0.3Tcandphi0 = 1.0,C_boundwas 1.28775e-21 J/K (its value at 0.982 rad) instead of 1.30354e-21 J/K, 1.2 % off the level sumC_AofFiniteLJunctionat the same phase;share_CAwas 0.026745 instead of 0.026097. For Ti/Al/Au narrowed to 0.3 um at 0.225 K andphi0 = 1.0,continuum_sharegaveshare_I-0.25436 instead of -0.25109 andshare_dIdT-0.10794 instead of -0.10481. Both now evaluate atphi0itself (continuum_sharewith the same difference step as before). At a grid phase, including the defaultpi/2, the results are unchanged. nanandinfin data files. Python reads them as numbers, and the loaders passed them on. Anantemperature passed the "strictly increasing" check (every comparison withnanis false), and anantime madeload_trace_csvreturndt = nan. Both loaders now refuse the file and name the line.- Unknown readout in
ShortJunction.andreev_sumstook anywhichother than"I"as"L":which="i"returned the inductance-readout responsivity (-2.788e-7 instead of -3.311e-7 for the current readout of Ti/Al/Au atphi = 1and 0.225 K).temperature_boundused the opposite rule for the phase. A temperature at or aboveTcraisedZeroDivisionError, a negative one returned NaN, and a negativetauANaN. All are refused now (SensorBudgetalready refused them). two_temperature_clickwithout checks ontauAandT0. WithtauA = -1e-7it ran and returned an occupation that left its equilibrium (1.0012 after 2 ns in the test case, above its largest possible value 1); a NaN deposit or phonon parameter gave NaN trajectories. It now checks its inputs asclick_templatedoes.- Sample intervals.
psd_single_sided(x, -1.0)returned a negative spectrum at negative frequencies,allan_varianceaccepted an infinite or NaNdt(infinite or NaN averaging times), andTelegraphHMM.rates(-1.0)returned a negative correlation time (-32.83 for flip probabilities 0.01 and 0.02). All three refuse such adtnow.
0.15.0 corrects the default calibration. Up to
0.14.0, JunctionModel.calibrate and junction_properties set the
scale so that the level-based Ic, the largest value of
current_phase on its phase grid, equals the measured Ic20. For MoRe
that value lies 1.7 % above the exact maximum of the same model, so
the exact critical current of a calibrated MoRe model at 20 mK was
1.7 % below the measured value it was calibrated to (0.98344 Ic20).
Both now use the exact maximum (Ic_matsubara) by default, and the
exact critical current equals Ic20 (1e-9 in the test). The scales
of the shipped recipes, before and after:
| Recipe | 0.14.0 (method="levels") |
0.15.0 (default) | Change |
|---|---|---|---|
| Ta(10)/Ti(60)/Au(5) | 0.383553 | 0.382872 | -0.18 % |
| Ti(6)/Al(60)/Au(5) | 0.517814 | 0.517578 | -0.05 % |
| Ti(6)/Al(70) | 0.554064 | 0.553802 | -0.05 % |
| Ti(6)/Al(200) | 0.658375 | 0.658100 | -0.04 % |
| Ti(6)/Nb(5)/NbN(50) | 0.133312 | 0.133331 | +0.01 % |
| MoRe(50) | 0.492841 | 0.501142 | +1.68 % |
Every quantity of a calibrated JunctionModel scales with it. Of the
README examples only Example 11 changes, in the last digit of L_J
(0.2195 to 0.2196 nH and 0.2219 to 0.2220 nH). Pass
method="levels" to reproduce 0.14.0. The calibration of MoRe now
takes about 27 s instead of 4 s (the cost of the exact maximum grows
as 1/T); for the other recipes it took 1 to 10 s either way.
ShortJunction.calibrate was always exact and is unchanged. Tests:
tests/test_v015.py.
0.14.0 corrects one result of 0.13.0. It was found
by a test that fails on 0.13.0 and passes now (tests/test_v014.py).
It does not change the output of Examples 1 to 12.
- Finite-length sums near zero phase.
FiniteLJunctiontakes the slopes and curvatures of the levels by central differences with a step of 1e-3 rad, and matched the levels at the three phases by their order in energy. Atphi = 0the two levels of an Andreev doublet cross. For|phi|below the step, the stencil therefore switched from one level to the other in the middle: the slope of a doublet level came out as-alpha phi / dphiinstead of-alpha, and its curvature as about-2 alpha / dphi(alphais the slope of the doublet splitting). For Ti/Al(thick) at 0.3Tcandphi = 1e-4,saturation_ratio(..., "L")was 853.79 instead of 1.00747 (the value just outside the step). Each level is now followed along its own branch there.C_Awas not affected, and from|phi| = 1e-3on nothing changed.
Also: the module docstring of absnoise.levels said that the junction
current counts bound states only; the code has included the continuum
since 0.1.0, and the docstring now says so.
0.13.0 corrects six results of 0.12.1. Each was
found by a test that fails on 0.12.1 and passes now
(tests/test_v013.py). None of them changes the output of Examples 1
to 10.
- The slope of the full model at zero phase.
JunctionModel.dIdphi0fitted a cubic to the first 8 points ofcurrent_phase. The first point is a one-sided difference, about 14 times too large, and the next points scatter by up to 17 % because bound levels leave the gap there and the bound and continuum parts nearly cancel. For a junction of zero length, where the exact slope is known in closed form, the result was 44 % low; for Ti/Al/Au at 0.3Tcit was 1.229e-6 instead of 2.865e-6 A/rad (before the calibration scale).junction_propertiesused a two-term fit over 0 to 0.76 rad (cpr_coeffs) instead: its slope was within 5e-4, but its cubic terma3was 2.3 % off for zero length and 6.1 % for Ti/Al/Au at 0.3Tc(-1.0077e-7 instead of -9.495e-8 A/rad^3; slope 1.484052e-6 instead of 1.483368e-6 A/rad). Both now come from the exact Matsubara sum (cpr_series).cpr_coeffsitself is unchanged. - Levels at zero phase. At
phi = 0the two levels of each Andreev pair coincide, andabs_energiesreturned them once. The same happened for every phase below about2e-8 / sqrt(tau), because the anglearccos(1 - tau + tau cos(phi))was taken of a number already rounded to 1.FiniteLJunctionatphi = 0then counted half of the occupation heat capacity (Ti/Al(thick) at 0.3Tc: 1.7417e-21 instead of 3.4835e-21 J/K). The angle now comes from2 asin(sqrt(tau) sin(phi/2))near zero phase (and from a matching form nearpi, which also finds the level near zero energy of a transparent channel close tophi = pi), and equal levels are kept. Away from those points the levels are identical to 0.12.1. - Log slopes of the short junction.
ShortJunction.dlnIc_dTanddlnI1_dTused a fixed step of 2e-3Tc. Below that temperature the lower point was negative (MoRe at 10 mK: inf and NaN instead of 0); within 2e-3TcofTcthe upper point had no supercurrent (Ti/Al/Au at 0.999Tc: -inf instead of -1320 1/K). The step is now at mostT/2and(Tc - T)/10; between 0.004 and 0.98Tcit is unchanged. Between 0.98 and 0.998Tcthe values change because the old step was too coarse there (at 0.997Tc: -532.6 before, -443.6 now, against -442.1 from a fine derivative ofic_model; the new step leaves a difference error below 0.4 % up toTc). - Master equation with tiny occupations or slow rates.
sigma_spectrumdivided by the square root of the stationary probabilities, which underflows forfbelow about 1e-162, and stopped with anAssertionErrorthere and atf = 0or 1. It also dropped every mode with a rate below 1e-14 in the chosen unit, so withGs = Gp = 1e-15it returnedS0 = 0andtau_eff = 0(instead of0.75 / Gs). It now builds the symmetrized rate matrix from its closed-form entries and removes only the stationary mode. continuum_shareat low temperature. Below about 0.03TcdI/dTis below rounding, and the share ofdI/dTwas 0/0: 0.12.1 stopped withZeroDivisionError(Ti/Al/Au at 20 mK, for example). Below 0.002Tcits temperature step reached negative temperatures. It now returns NaN for that share, and the step is limited as for the log slopes.- Negative readout floor in
nep_spectrum. It was accepted and gave a NaN readout channel and a total below the other channels; it is refused now, as inenergy_resolution.
0.12.0 corrects five results of 0.11.0. Each was
found by a test that fails on 0.11.0 and passes now
(tests/test_v012.py). None of them changes the output of an example
in this README.
- The gap just below
Tc.gap_bcsread the gap from a cubic spline inT/Tcthat ended at 0.9995Tcand returned 0 above it. The gap closes as a square root, which such a spline cannot follow. Between 0.9995TcandTcthe result was 0 instead of 0.039 to 0.006Delta0(at 0.9997Tc: 0 instead of 0.0307Delta0), andSensorBudgetrefused those temperatures as "at or above Tc". Below, the spline was off from the solution of its own gap equation by +0.13 % at 0.998Tc(0.077956 instead of 0.077854Delta0) and by -0.67 % at 0.999Tc(0.054884 instead of 0.055252; see Limits for how this equation differs from exact BCS theory this close toTc). From 0.99Tcon, the gap now comes from a table ofu / sqrt(1 - t/t1), built from the Matsubara-sum form of the same gap equation. It agrees with direct solutions to better than 1e-9. Below 0.99Tcnothing changed. - Allan variance for short averaging times. The four terms of the
closed form of
avar_exponentialcancel to order(T/tau)^3, so forTmuch shorter thantauthe result was mostly rounding error. Withvar = tau = 1: atT = 1e-46.66578e-5 instead of 6.66617e-5, atT = 1e-57.77e-6 instead of 6.67e-6 (17 % high), and atT = 1e-6-1.1e-4 (negative) instead of 6.67e-7. BelowT = tau/2the bracket is now summed as its Taylor series; the tests compare it with the defining integral, rewritten so that it does not cancel, to 1e-9. - Critical current above
Tc.ic_modelandShortJunction.Icreturned NaN at and aboveTc(0/0 with a closed gap); the supercurrent there is 0. Through NaN sensitivities,plan_ic_measurementthen called any plan with one temperature aboveTc"not identifiable" (identifiable False, no error bars). Now such a point adds no information, and the plan equals the plan without it. - Sign of the continuum free energy. The function
absnoise.levels.continuum_free_energyreturned the opposite sign of the continuum free energy thatJunctionModel(and so the current,continuum_shareandoccupation_heat_capacities) uses. Its docstring said the sign was fixed by continuity of the total free energy where a bound level leaves for the continuum. With the old sign the total jumped there by twice the free energy of the departing level (2.013Deltainstead of 0.007Deltaacross 0.06 rad, in the test case).JunctionModelwas right and is unchanged. - Planned spectrum error bars for a non-integer
n_avg.plan_psd_measurementtruncatedn_avgto an integer, although the fit accepts an effective number of averages. For the band of Example 4 withn_avg = 1.5, it plannedsigma(tau)= 159.0 us (the value forn_avg = 1) while the fit reports 119.9 us. It now usesn_avgas given.
0.11.0 corrects five results of 0.10.1. Each change below alters numbers that earlier versions printed.
- Energy resolution.
SensorBudget.energy_resolutionintegrated numerically between two cut-off frequencies. Above the upper cut-off the integrand still carries weight (it falls only as1/f^2while occupation noise dominates, and stays flat where phonon noise dominates), so the result was too large: by 3.3 % in Example 1 (1.810e-22 J before, 1.752e-22 J now), by 10.7 % for Ti/Al/Au at 0.3TcwithtauA= 1 ns, and by 18 % withwhich="I"there. The integral now has a closed form.method="grid"gives the old numbers. - Correlation time from sampled traces.
TelegraphHMM.ratesturned the per-sample flip probabilitys = p_up + p_dnintotau = dt / s, which is right only for samples much closer thantau. For a process running in continuous time and read everydt, the exact relation istau = -dt / ln(1 - s). The old value was too long by 2.5 % atdt = 0.05 tauand by 27 % atdt = 0.5 tau.fwas not affected. The simulatortelegraph_tracesused the matching first-order flip probabilities, so the package agreed with itself but not with a real, continuously running process. It now samples the continuous process exactly, and any time step is allowed. Examples 5 and 6 therefore print slightly different numbers (Example 6 printedf = 0.297, tau = 0.977 msbefore). - Spectrum fit with
n_avg. The fit treated the logarithm of an averaged periodogram as unbiased with variance1/n_avg. Its mean is in fact low bypsi(n) - ln nand its variance ispsi'(n), soS0and the floor were low by a factor 0.56 (n = 1), 0.76 (n = 2), 0.88 (n = 4) or 0.992 (n = 64), andchi2high by 64 % (n = 1) or 0.8 % (n = 64).tauis unchanged. The planner now uses the same scatter: Example 4 prints 15.56 us and 1709 averages (15.50 us and 1708 before). - Matched design.
matched_Tcsolved the gap equation withDelta0 = 1.7639 kB Tc, whileRecipe(and so the budget ofmatched_recipe) uses 1.764. The budget then sawDelta(T0)/(kB T0) = 2.39954instead of the stated 2.3994;matched_Tc(0.05)moves from 0.0776088 K to 0.0776059 K. - Periodogram.
psd_single_sideddoubled the Nyquist bin (the highest frequency, for an even number of samples), so the spectrum held slightly more than the variance of the data.
Also: SensorBudget methods refuse temperatures at or above Tc
(they raised ZeroDivisionError), zero or negative temperatures, and
non-positive tauA (a negative value gave NaN); and the decode module
docstring promised likelihood-based error bars that did not exist
until uncertainties.
0.10.1 fixes four problems in 0.10.0.
- NumPy 1.x. The package allows NumPy 1.24 and newer, but four
integrals called
numpy.trapezoid, which exists only from NumPy 2.0. On NumPy 1.x,energy_resolution, the current and free-energy methods ofJunctionModel(Ic,calibrate, ...),junction_properties,continuum_shareandoccupation_heat_capacitiesstopped with anAttributeError. They now work on both, and NumPy 1.24.0 with SciPy 1.10.0 is tested. - Current readout in
energy_resolution. Withwhich="I"it used the phase 1e-4 rad instead of the phase of maximum current thatfreq_noise_spectrum,nep_spectrumandenergy_resolution_analytic_Ause. Its result disagreed with the NEP-based value (it was 66 % larger without a readout floor in the example setup of the tests). The defaultwhich="L"was not affected. - Full transparency.
ic_modelreturned NaN attau = 1, which the fit's bounds and the planner allow;plan_ic_measurementthen reported such a junction as not identifiable. It now uses the correct limit,Delta0/2. n_avgbelow 1.fit_telegraph_psdacceptedn_avg = 0or a negative value and returned infinite or NaN error bars. It now refuses, as the planner already did.
Also: TelegraphHMM and fit_hmm were importable from absnoise but
missing from __all__; they are now listed. Docstrings that described
tests that do not exist (a Monte Carlo check of the pair-process
model, a convergence-order check of the two-temperature integrator, a
continuity check of the continuum sign, a comparison of the telegraph
simulation with the occupation sums) now say what is and is not
tested, and the spectrum-fit notes now give the floor's real test
tolerance (1e-4, not 1e-6).
What the 0.10.0 README overstated. It said the checks run on
Python 3.9-3.14 (Python 3.10 was not in the CI matrix), gave "every
spectrum" a Monte-Carlo check (the master-equation spectrum has none),
called the Ic(T) covariance "exact" (it is the linearized estimate),
said the tests lock "every recipe number" (they lock Tc, tau,
Ic20, Rn and the label, not the geometry and gate voltage), said
no check uses a stored number (the recipe table and one gap value do),
described a machine-precision "energy conservation of the click
integrator" (the check covers the starting temperature only), and
said the file loaders flag unit mix-ups (that is validate_ic_data).
No earlier release records a correction. The full history is in CHANGELOG.md.
Limits
- The correlation time
tauAis an input, not a prediction. - The device budget (
SensorBudget) uses the short-junction model and converts the signal to resonator frequency through the Josephson inductance at zero phase.which="I"is accepted and evaluated at the phase of maximum current, but the frequency conversion is still that inductance. - The finite-length occupation sums (
FiniteLJunction) count bound levels only;occupation_heat_capacitiesgives the size of the continuum part at one phase (the tests check its sign and size only for Ti/Al/Au). JunctionModel.current_phase(and soIc,calibrateand theIcofjunction_properties) still uses bound levels plus the continuum on an energy grid, differentiated on the phase grid. It differs from the exact Matsubara sum (cpr_matsubara) by about 5e-4 ofIcaway from zero phase, and its two end points (phi = 1e-3andpi - 1e-3, one-sided differences) are off by 1 to 2 % ofIc(zero-length test case). Its maximum lies inside the grid for the shipped recipes. Usecpr_matsubarawhere these errors matter. At 20 mKIclies 4.2e-4 to 1.8e-3 below the exact maximum (Ic_matsubara) for four recipes and 1.5e-4 above it for Ti/Nb/NbN. For MoRe (the largestL/xi, 0.43) the level-based current scatters by up to 3 % between neighboring grid phases near its maximum, andIclies 1.7 % above the exact maximum. Since 0.15.0calibrateandjunction_propertiesuse the exact maximum by default, so this error no longer enters the calibration; withmethod="levels"it does.- The Matsubara sums still add their terms one by one up to 20 times
the gap, and that part grows as
1/T: about 2100 terms per mode for MoRe at 20 mK (the full sum of 0.16.0 had 2.1e5); the rest costs at most 112 points at any temperature (since 0.17.0).Ic_matsubaraat 20 mK took 0.05 s for Ti/Al/Au and 0.19 s for MoRe on a shared machine (0.83 s and 7.5 s with 0.16.0). FiniteLJunctiondifferentiates the levels with a phase step of 1e-3 rad. Nearphi = pifor a fully transparent channel (tau = 1, where a level touches zero energy) the levels have a kink, and the derivatives there are not meaningful; none of the shipped recipes hastau = 1.JunctionModel.cpr_coeffsis a two-term fit over 0 to 0.76 rad and keeps the bias of the neglected higher terms (2 to 6 % ina3);cpr_seriesgives the exact coefficients.- The Matsubara sum runs to 2000 times the gap and adds the rest of its leading term in closed form; the remainder is about 1e-10 relative. Since 0.17.0 the part above 20 times the gap is integrated instead of summed term by term; the two agree to about 1e-12 in the tests.
fit_ep_couplingfits one power law with one bath temperature. It takes each absorbed power as exact apart from a calibration factor common to all points (power_scale_error, 0.17.0). A scatter of the powers from point to point is not handled: it would need an errors-in-variables fit, which this release does not add. The error bars are first order: inspectcovwhendeltais poorly determined.- The continuum occupation noise is not modeled: it would need a correlation-time model with material parameters this package does not invent (its thermodynamic weight is computed).
- The phonons are one lumped temperature; a non-thermal phonon model has no cited parameters at these scales. The two-temperature model needs your measured phonon parameters.
click_monte_carloresults are statistics-limited. Since 0.17.0 it reports their standard errors (binomial for the two fractions, first order for the SNR); the tests compare them with the scatter over 24 seeds, within 35 %.fit_hmmmodels Gaussian readout noise, with one width for both states or (since 0.17.0,equal_noise=False) one width per state, and assumes the upper readout level means "filled". Its error bars (uncertainties) are the large-sample estimate: the tests check their calibration on traces with a few hundred flips; with only a handful of flips they are rough. A far outlier no longer breaks the computation, but the Gaussian model widens its fitted noise to absorb it (one 200-sigma sample in 4000 raised the fitted noise from 0.20 to 0.70 in a test trace): remove glitches first.fit_telegraph_psdcan remove the periodogram offset only when you given_avg(one number, or since 0.17.0 one per point; without it,S0and the floor are low byexp(psi(n) - ln n)fornaverages). Even with it, the fitted floor kept a bias of about -5 % atn_avg = 2in the tests (-1 % at 8). With onen_avgper point for bins that average neighboring frequencies, the model is evaluated at the given frequency, not averaged over the bin; keep such bins narrow compared with the knee. Withoutdtthe fit uses the continuous-time Lorentzian and does not model the noise folded back from above the Nyquist frequency. Withdtit does, for samples that are values of the signal at single instants (0.16.0) or means over each sample interval (sampling="average", 0.17.0). A readout that filters the signal in another way before sampling (an anti-aliasing filter with a gradual roll-off, for example) has a spectrum neither model describes, because the shape of that filter belongs to the device; fit only the band where the filter is flat, or model it yourself.n_record(0.17.0) gives the expected periodogram of rectangular segments aspsd_single_sidedmakes them; tapered or overlapping segments (Welch's method with a window) have a different leakage, which is not modeled. The fit treats neighboring bins as independent; for records of a few tens oftauthey are not quite, and the tests found the error bars about 30 % too large there (128 samples, 15tau).avar_exponential(..., dt)(0.16.0) is the expected value ofallan_variancefor instantaneous samples of an exponentially correlated process, and withsampling="average"(0.17.0) for samples averaged over each interval. The package gives no error bar for a measured Allan variance; the scatter grows for windows close to the record length (see Example 5). Not done, because an exact error bar needs the fourth moments of the process: a formula for Gaussian noise exists, but the telegraph signal of a few channels is far from Gaussian, and that formula would then give error bars of unknown quality.SensorBudget.energy_resolutionassumes an ideal matched filter over all frequencies, or (f_max, 0.14.0) over the frequencies up tof_maxwith nothing above: an ideal low-pass readout. A real readout attenuates gradually and may add noise of its own shape; model that withS_ro_yonly where its noise is white.gap_bcssolves the gap equation withDelta0 / (kB Tc) = 1.7639, the BCS valuepi e^-gamma = 1.76388rounded. Its solution would close at 1.000013Tcinstead of atTc.gap_bcsreturns 0 fromTcon, so the gap steps from 0.0063Delta0to 0 there. Close toTcthis small shift matters: the gap lies above the curve of the exact constant by 0.65 % at 0.999Tc, 1.3 % at 0.9995Tcand 6 % at 0.9999Tc(and by less than 3e-6 below 0.5Tc). The constant is kept so that every result below 0.99Tcstays as in earlier releases.IcFit.propagateis first order. It carries only the uncertainty ofIc0,Tcandtau; your geometry, the phonon parameters and the readout settings enter as exact numbers.markov_dwell_testlooks at two properties of the stays: their spread (the dispersion index,p_value) and, since 0.17.0, the rank correlation of each stay with the next (p_correlation). It detects several time scales, dead times and stays linked to the one before, but not, for example, a link that skips a stay. The simulated reference uses the fitted model as it is (the model is not refitted to each simulated trace), and the first and last stay of a trace are left out. Withn_bootsimulated traces the smallest p-value it can report is4 / (n_boot + 1)for the dispersion and2 / (n_boot + 1)for the correlation. The two p-values are reported separately; combine them yourself if you use both.- The greedy temperature design is a good heuristic, not a proof of
the best subset;
method="exhaustive"(0.17.0) gives the best subset, but only up to 2 000 000 subsets. Both maximize the determinant of the information matrix, which is not the same as the smallest error bar of one chosen parameter (Example 19).
Where it comes from
Methodological basis:
T. M. Mahim, A. S. M. Mohsin and M. M. Rahman, "Andreev occupation noise sets the sensitivity limit of proximity Josephson thermal detectors"; code for the paper: https://github.com/Tanvir-Mahmud-Mahim/andreev-occupation-noise
This package is the general-purpose engine; the paper repository reproduces the specific study.
Six junction recipes ship with full provenance (Table I of W. Jung et
al., Phys. Rev. Applied 26, 014078 (2026), arXiv:2503.06850);
graphene electron-phonon cooling follows G.-H. Lee et al., Nature
586, 42 (2020); physical constants are CODATA 2018. The phonon NEP is
compared with J. C. Mather, Appl. Opt. 21, 1125 (1982). The
matched-filter energy resolution is the frequency-domain optimal-filter
result (int_0^inf 4 df / NEP^2)^(-1/2) of S. H. Moseley, J. C. Mather
and D. McCammon, J. Appl. Phys. 56, 1257 (1984); its band-limited form
(0.14.0) stops the integral at the readout bandwidth. The Allan
variance follows D. W. Allan, Proc. IEEE 54, 221 (1966) and W. J.
Riley, Handbook of Frequency Stability Analysis, NIST Special
Publication 1065 (2008). The temperature design follows F. Pukelsheim,
Optimal Design of Experiments, SIAM (2006). The Matsubara-sum free
energy of cpr_series and cpr_matsubara follows from Eqs. (6) and (8) of P. W. Brouwer
and C. W. J. Beenakker, Chaos, Solitons & Fractals 8, 1249 (1997); the
tests check it against the closed-form short-junction current. The
heating-curve fit of fit_ep_coupling is the analysis of Lee et al.
(their Fig. 4c and Table I: delta = 3, Sigma = 2.04 to 3.30
W m^-2 K^-3). Near Tc the gap equation
is solved in its Matsubara-sum form, which follows from the integral
form through the partial-fraction expansion
tanh(x/2) / x = sum_n 4 / (x^2 + (2n+1)^2 pi^2); the tests check the
two forms against each other. The spectrum and the Allan variance of
sampled data (0.16.0) follow from summing the sampled autocovariance
var e^(-|k| dt/tau); the tests check both against that sum, done
term by term. The spectrum of averaged samples and the expected
periodogram of a finite record (0.17.0) follow in the same way, from
the autocovariance of the averaged samples (obtained by integrating
var e^(-|t-s|/tau) over two sample intervals) and from the finite
sum sum_{|h|<N} (N - |h|) C(h) e^(-2 pi i j h / N); the tests check
them against the Lorentzian times sinc^2 summed over its aliases,
numerical integration and the quadratic form of the full covariance
matrix. The tail of the Matsubara sums (0.17.0) uses the midpoint form
of the Euler-Maclaurin formula, checked against the full sum. A
replacement recipe number
must arrive with a new source. No phonon-stack parameters are shipped
at all -- they are measurements of a real device, and calls without
them raise.
Citing, support and license
If absnoise helps your work, please cite it with the concept DOI
10.5281/zenodo.22048608,
which always resolves to the latest version; every release is archived
on Zenodo. CITATION.cff has the details.
Written and maintained by Tanvir Mahmud Mahim (Department of Electrical and Electronic Engineering, BRAC University), who reviews every change and takes the final decision on scope and releases. Design questions are discussed in the open in issues and pull requests, and the standing rule of CONTRIBUTING.md binds the maintainer exactly as it binds contributors: a change that touches physics arrives with a test, and a constant arrives with its source.
Support runs through the issue tracker. Usage questions are welcome alongside bug reports; a docstring that left a unit or a sign convention unclear is treated as a documentation bug, not user error. While the version is below 1.0 the API may still move between minor versions; such changes are called out in the release notes.
Licensed under Apache-2.0.
Metadata
Release files for absnoise 0.17.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| absnoise-0.17.0.tar.gz | 322.2 kB | With provenance | Details for absnoise-0.17.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| absnoise-0.17.0-py3-none-any.whl | Python 3 | none | any | Details for absnoise-0.17.0-py3-none-any.whl |
Total release size: 469.2 kB
Release files / absnoise-0.17.0.tar.gz
| Download URL | absnoise-0.17.0.tar.gz |
|---|---|
| Size | 322.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8d7d271cea13c4d4a241abaadacd8ff40cd056210a79beb12036f23adba8b691
|
|
BLAKE2b-256 checksum How to use checksums |
6c31ced909a8cb1464866bb699402668ef774640bedbc22139c15ea0dfecedea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / absnoise-0.17.0-py3-none-any.whl
| Download URL | absnoise-0.17.0-py3-none-any.whl |
|---|---|
| Size | 147.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca957be708fcc83c5a325e5f56c7c18843db93826a1441f317a28d49b04f000c
|
|
BLAKE2b-256 checksum How to use checksums |
e6be4e589cfcc20d05e6c52d4d0cc5400b3f25aba5f3f898c9d83c36ff976cf1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for absnoise 0.17.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for absnoise-0.17.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA 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.