Skip to content

refactor(cadecon): convergence UI improvements and kernel estimation groundwork#94

Merged
daharoni merged 11 commits intomainfrom
fix/cadecon-rise-time-collapse
Mar 6, 2026
Merged

refactor(cadecon): convergence UI improvements and kernel estimation groundwork#94
daharoni merged 11 commits intomainfrom
fix/cadecon-rise-time-collapse

Conversation

@daharoni
Copy link
Contributor

@daharoni daharoni commented Feb 28, 2026

Summary

  • Refactor visualization layout to CSS grid (raster + kernel 1col, convergence + trace inspector 2col)
  • Replace bottom distribution panels with PVE and Event Rate trend tabs
  • Add ground truth reference lines to kernel convergence charts
  • Add Nyquist floor (2/fs) to bi-exponential fitter grid search and golden-section refinement — prevents fitting rise times shorter than 2 samples
  • Use conservative initial kernel defaults (200ms rise, 1s decay) so the optimizer converges downward through the optimum
  • Skip iteration 0 from convergence charts, integer-only x-axis ticks
  • Increase IQR band visibility in per-cell trend charts
  • Disable residual-patience early stopping (was firing too aggressively; needs a better stopping metric)

Known issue

The rise time constant still tends to collapse toward faster values across iterations. The Nyquist floor prevents it from going below 2/fs but doesn't fully solve the positive feedback loop. Addressing this properly likely requires either damped tau updates, peak-location anchoring, or a trace-reconstruction-based stopping criterion — deferred to a follow-up.

Test plan

  • Run CaDecon on default demo data (100ms rise, 600ms decay) — verify UI layout and convergence charts
  • Confirm ground truth lines appear on kernel convergence plots
  • Verify PVE and Event Rate trend tabs render correctly
  • Check that the Nyquist floor prevents sub-2-sample rise times (e.g., at 30Hz, tau_rise >= 67ms)

🤖 Generated with Claude Code

daharoni and others added 6 commits February 28, 2026 12:07
The iterative kernel solver was driving tau_rise toward 0 because
sharper kernels reduce reconstruction error, even past the true rise
time. The bi-exponential fit residual has a U-shape — it reaches a
minimum at the correct kernel then increases as tau_rise overshoots.

Track the best residual across iterations and early-stop (patience=3)
when the residual rises consecutively. Finalization always uses the
best-residual kernel parameters regardless of how the loop exits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Draw horizontal dashed lines at the true tau_rise and tau_decay values
on the kernel iteration plot when "Show Ground Truth" is enabled.
Uses the same pink/magenta color as the kernel shape overlay.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… tabs

- Remove Row 3 (Alpha/PVE/Event Rate distributions + Subset Variance)
- Add PVE and Event Rate tabs to the convergence panel (now 5 tabs:
  Kernel | Alpha | Threshold | PVE | Event Rate)
- Fix ground truth overlay lines to use color-matched dashes (blue for
  tau_rise, red for tau_decay) instead of uniform pink
- Remove unused distribution/drilldown CSS and imports from layout

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… 1s decay)

The iterative solver can only refine time constants downward — a
too-fast kernel is compensated by extra spikes, so there is no error
signal to push it slower. Starting conservatively slow ensures the
optimizer passes through the optimum on the way down.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Iteration 0 contains placeholder values (alpha=1, threshold=0, pve=0,
empty sCounts) before any computation runs. Filter it out by default
in PerCellTrendsChart so Alpha, Threshold, PVE, and Event Rate tabs
all start from iteration 1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Iteration 0 contains placeholder values before any computation runs.
Filter it from all charts — Kernel convergence (tau lines, residual,
subset scatter) and all per-cell trends (Alpha, Threshold, PVE,
Event Rate) now start at iteration 1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@daharoni daharoni force-pushed the fix/cadecon-rise-time-collapse branch from a7ee284 to 39f64f7 Compare February 28, 2026 20:29
daharoni and others added 5 commits February 28, 2026 12:31
Bump IQR fill opacity from 0.08 to 0.18 and Q-line opacity from 0.3
to 0.4. Show Q25/Q75 dashed boundary lines (previously hidden).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… iter 0

The iteration 0 filter caused the chart to initialize with empty data
before iteration 1 completed, breaking uPlot rendering. Restore full
convergenceHistory for the kernel chart (initial tau values are
meaningful) and only null out the residual at iteration 0.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…icks

Defer rendering the kernel convergence chart until iteration 1
completes (avoids uPlot initializing with empty data). Filter
iteration 0 from chart data since it's just initial params.

Show only integer tick labels on the x-axis (Iteration) for all
convergence tabs — suppresses fractional ticks like 1.5.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The kernel fit residual (bi-exponential shape mismatch) doesn't always
produce a reliable stopping signal. Note that trace-reconstruction
residual would be a more robust alternative.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Data-driven tabs in ConvergencePanel, extract drawHLine helper in
KernelConvergence, remove redundant early-stop revert in iteration
manager, fix PerCellTrendsChart Show guard, and correct stale CSS comment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@daharoni daharoni changed the title fix(cadecon): prevent rise time collapse via best-residual tracking refactor(cadecon): convergence UI improvements and kernel estimation groundwork Mar 6, 2026
@daharoni daharoni merged commit bdc1a6a into main Mar 6, 2026
2 checks passed
@daharoni daharoni deleted the fix/cadecon-rise-time-collapse branch March 6, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant