Joint dither calibration experiment#
exp_cal06_joint_dither.py places capacitor mismatch, gain error, one-sample
linear memory and memoryless nonlinearity in the same conversion path.
It tests observable background identification, inverse reconstruction, parameter
tracking, injection headroom and output spectra. It is an educational behavioral
model, not a public API or a reproduction of a published ADC circuit.
Run from a copied example tree (NumPy, SciPy and Matplotlib are required):
python 11_calibration/exp_cal06_joint_dither.py --output output/joint_dither
The default is 12 runs: two waveforms, constant/step parameters, three seeds. Each has 256 blocks of 32768 samples. No foreground training or truth-based initialization is used. At the nominal time scale of 100 MS/s this is 83.88608 ms; all four physical parameters change at 41.94304 ms in step cases. This is an artificial tracking stress, not a measured thermal drift rate.
Short CLI check (not a convergence qualification):
python 11_calibration/exp_cal06_joint_dither.py --blocks 16 --block-size 1024 --seeds 11 --waveforms sine --scenarios step --output output/joint_smoke
Observable joint identification#
Define c1=1/G, c3=beta/G and h=H/G. Before backend noise/quantization,
c1*r[n] + c3*r[n]^3 - h*a*p[n-1] - a*p[n] = u[n] + h*u[n-1].
Thus present PN, present cubic PN and delayed PN provide three moment conditions for three electronics coefficients:
Z = [p, p^3-(41/45)*p, p_previous]
A = Cov(Z, [r, r^3, -a*p_previous])
b = Cov(Z, a*p)
A @ [c1,c3,h] = b, approximately.
This requires exogeneity of the probe from current and previous business residues, not knowledge of the clean input. Capacitor switching is independent of the additive probe, so capacitor mismatch enters the nuisance residues u; it is not silently set to zero during electronics identification. The measured matrix retains finite-window cross-correlations among the probe observables.
By default, each column of Z is centered within each observed (q,q_previous)
pair before forming the moments. This removes constant within-code nuisance
terms and requires no waveform frequency or clean label. It does not remove
all business-signal correlation or guarantee a small estimation variance.
The unconditioned control uses the same joint model without that centering.
A and b are exponentially averaged at rate 0.04. A rank guard rejects binary PN, for which p^3=p, and missing probe excitation. The matrix condition limit is 1e5. Accepted coefficients require .35<c1<.75, -.08<c3<.3, |h|<.2 and a positive inverse slope over the backend range (minimum >.2).
The electronics inverse is stateful:
v_hat[n] = c1_hat*r[n] + c3_hat*r[n]^3 - h_hat*v_hat[n-1]
y[n] = q[n]/2 + v_hat[n] - a*p[n]
x_hat[n] = y[n] + delta_hat*s[n]*(q[n]-y[n])
After this deembedding, delta uses the exact two-capacitor correction relation and the code-conditioned instrument zc=(s-mean(s within q))*q:
delta_hat = -EW_mean(zc*y) / EW_mean(zc*s*(q-y)).
Its moment averaging rate is also 0.04; |denominator|>=.01, instrument power
=.05 and |delta_hat|<.05 are required. An outer code is needed for this chosen instrument; visiting one is not sufficient near the full-scale limit where q-y is small. No claim is made that every capacitor mismatch scheme has the same excitation requirement.
All corrections and capacitor deembedding use estimates available at the start of the block. Both electronics and capacitor updates prepare the next block. The first cap update is held because it used nominal electronics. An independent inverse-filter state is maintained for every comparison path. Rejected rail blocks still advance the filter state; clipping is not undone. The only capture fields are q, q_previous, r, p, p_previous, s and rail. Analog peaks, overload counts, true coefficients and clean input are evaluator data kept outside the tracker interface.
This is a newly derived triangular estimator combining the existing moment principles. It does not concatenate unmodified gain-4 helpers with a gain-2 capacitor model, and does not assume four independent calibrators can estimate their own parameters directly from the same uncorrected backend stream.
Comparisons and convergence reporting#
All probe-on methods use identical captures:
nominal reconstruction;
joint background calibration, with/without coarse-code conditioning;
gain-only, no-memory, no-capacitor and no-nonlinearity correction ablations using the same learned joint coefficients, not separately trained methods;
the same background estimate frozen at the midpoint (not a foreground fit);
exact device coefficients (oracle, evaluation only).
A paired probe-off plant retains capacitor switching and identical noise draws. Nominal and oracle probe-off paths show injection cost. Probe-off does not mean zero capacitor mismatch or removal of the independent switching sequence.
Parameter reporting uses estimates actually applied, not just the final update. Fixed evaluation bands are 1% relative error for G and 10% for H, delta and beta. The summary reports final-quarter parameter means/RMSE, the fraction of blocks in which all four meet these bands, and the end of the first eight consecutive in-band blocks in each half. One successful streak is not proof of permanent convergence; the final fraction must also be inspected. Truth is used only to calculate these diagnostics, never to accept updates or choose rates.
FFT SNDR/SFDR are computed on coherent single-tone blocks with DC excluded, and correct one-sided power weights. For two-tone inputs the names are total desired-tone/noise+distortion and strongest desired-tone/largest unwanted-bin ratios, not single-tone SNDR/SFDR. SFDR near a random noise floor depends on record length. Error-SNR additionally includes gain, phase and DC error against the evaluator’s clean input. Window averages are means of per-block dB values.
Headroom and failure controls#
headroom.csv scans three input peaks (0.1,0.8,0.95), six injection amplitudes
(0,0.02,0.05,0.1,0.2,0.4) and both physical parameter settings. It records the
ideal cap residue peak, normalized injected-v peak, mathematical linear drive,
actual backend-input peak including noise, 1-peak|backend|, overload counts,
rail-code count and estimator status. The mathematical linear drive is not a
separately constrained physical node in this behavioral compression model.
diagnostics.json checks binary-probe rank loss, missing outer coarse codes,
actual clipping, incorrect PN delay and a 10% injection-scale error. The delay
control deliberately circularly shifts each block; it is not a physical
pipeline alignment model. The scale/delay controls use short records and
demonstrate failure risk, not a statistical qualification. Whole-block rail
rejection protects identification but cannot restore clipped output samples.
Increasing a improves the weak cubic moment while consuming headroom. The default 0.2 was selected after development runs found 0.1 too weak in this joint plant; neither amplitude guarantees convergence for arbitrary inputs. The final report retains lower-amplitude controls rather than hiding this dependence. The fixed parameter bands above are not relaxed to match results.
Artifacts, provenance and limitations#
Each run writes trajectory.csv and summary.json. Top-level outputs include aggregate.csv, configuration.json, summary.json, diagnostics.json, headroom.csv, joint_convergence.png (if sine/step was selected), and joint_headroom.png. Nonempty destinations are rejected. Configuration includes actual source hashes, git HEAD when available, Python/NumPy/SciPy/Matplotlib versions and all main parameters; HEAD alone does not identify uncommitted source files.
The model assumes an exact cubic inverse, exactly known additive injection, ideal two-capacitor charge redistribution and a stable two-tap residue path. It does not cover fifth-order/model mismatch, nonlinear memory, multi-stage coupling, input sampling noise, jitter, imperfect references, fixed-point implementation or chip area/power. Backend quantization and post-nonlinearity noise make the instrumental moments approximate. Passing algebraic identities or numerical rank checks does not establish practical convergence.
The physical principles and their literature relationships are documented in DITHER_COVERAGE.md. This joint composition and estimator are independently derived for this example. In particular, they are not the CFCS selection logic of Sun/Lee/Ham, the physical memory correction network of Keane/Hurst/Lewis, or the asymmetric-window nonlinear calibration in PCE.