fix(autocorr,clt): NaN-safe guards and finite inputs (#46) - #47
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…undary (#46) var0 <= 0.0 and sigma2_g < 0.0 rejected only when an ordered comparison was True, so NaN passed and produced all-NaN results. Samples, c_window, mean and sigma2_g are now checked with positively formulated, finite conditions. Found by nan-gate-lint (Vero tools). Closes #46 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Review of #47 found that binning_error, obm_variance, jackknife_ratio, the precomputed-rho path, ar1_clt_variance(sigma_eps) and confidence_interval(n) still returned NaN silently, and an overflowing series was reported as 'constant'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…te (#46) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Delta round (Equalita, same family) at Precision of my body: in run 🤖 Generated with Claude Code |
Closes #46.
Guards of the form
if stat <= 0: raiserejected only when an ordered comparison was True, so NaN passed and produced silent NaN results. Found by the NaN-orientation lint (nan-gate-lint.py1.0.1, Vero tools).Correction (after the independent round on
4436c1e): the first version of this PR claimed that finiteness checked inautocorr_function_fftreachedbinning_error— that was wrong,binning_errornever calls it, and further public entries still returned NaN silently (obm_variance,jackknife_ratio,integrated_autocorr_time(..., rho=...),ar1_clt_variance(sigma_eps=nan),confidence_interval(n=nan)). The PR now checks every public entry.Changes
autocorr._require_finite(values, name): fail closed on NaN/inf, called at each public entry:autocorr_function_fft,integrated_autocorr_time(samples always, and a precomputedrho),binning_error,jackknife_ratio(numerator and denominator terms),clt.obm_variance.var0,c_window,sigma2_g(finite and ≥ 0),meanfinite,ar1_clt_variancesigma_epsfinite and > 0,confidence_intervalnNaN-safe.Evidence (Windows, py3.12) at
496747c6d445d5, 10 in706bfbf), all by assertiontest_autocorr+test_clt: 60 passed; indirect consumers (test_checkpoint,test_manifest,test_mcrg*,test_rbim_nishimori,test_snis,test_wolff2d+ the two): 181 passed, exit 0python -m adaptiverg_qec.cli --selftest --json results/selftest-ci.json: 45/45 PASS, exit 0 (exit measured directly, not through a pipe)ruff check+ruff format --checkcleandiskriminierung.py:DK-20260926T102148-f647563dbe6a(first four guards) andDK-20260926T112239-2956ffa7d19a(8/8 new guards: binning, rho-path x, rho finite, jackknife, overflow message, obm, sigma_eps, n); positive control on a normal-path test collapsed as required (DK-20260926T112337-292c42f43469)Pre-existing, not changed here: callers in
mcrg_matrix.py/mcrg_multirg.pypre-checknp.var(x) > 0, so a NaN series never reaches autocorr there and tau silently becomes 0.5 — tracked as follow-up.🤖 Generated with Claude Code