[us-commits] [ehb54/ultrascan3] 014114: SAXS extrap-to-c0: penalized-slope fit with automa...

emre brookes noreply at github.com
Sun Jul 12 07:11:34 MDT 2026


  Branch: refs/heads/ehb54-issue-920
  Home:   https://github.com/ehb54/ultrascan3
  Commit: 014114a65ecb55c7392bfb9870871141366c20ef
      https://github.com/ehb54/ultrascan3/commit/014114a65ecb55c7392bfb9870871141366c20ef
  Author: ehb54 <brookes at uthscsa.edu>
  Date:   2026-07-12 (Sun, 12 Jul 2026)

  Changed paths:
    M us_somo/develop/include/us_hydrodyn_saxs_iqq_extrap_c0_conc.h
    M us_somo/develop/src/us_hydrodyn_saxs_iqq_extrap_c0.cpp
    M us_somo/develop/src/us_hydrodyn_saxs_iqq_extrap_c0_conc.cpp
    M us_somo/somo/doc/manual/somo/somo_saxs_extrap_c0.html

  Log Message:
  -----------
  SAXS extrap-to-c0: penalized-slope fit with automatic GCV regularization

Add a shared, physics-based extrapolation core used by both Zimm and
Primus modes. At each q the model is I_i = c_i*alpha(q) + Iex(q)
(inverse-variance weighted); a smoothness penalty is applied to ONLY the
concentration slope alpha(q) -- the interparticle/second-virial term,
smooth in q and decaying at high q -- leaving the intercept Iex(q) (the
form factor) untouched. The fit reduces to (diag(M)+lambda*D2'D2)alpha=R,
Iex=(Q-B*alpha)/C, solved via one symmetric eigendecomposition of the
whitened penalty (Eigen SelfAdjointEigenSolver); lambda is chosen
automatically by Generalized Cross-Validation (closed-form over the
eigenbasis). lambda=0 recovers the independent per-q weighted fit.

- New file-local helper us_extrap_c0_gcv_penalized(); guards degenerate
  and pathologically large (n>5000) grids by falling back to per-q OLS.
- Zimm: pre-pass feeds the penalized intercept/slope into the main loop
  (this also makes Zimm inverse-variance weighted). Primus: overwrites the
  noisy per-q Iex/slope before the merge test so both the crossover and
  the low-q output use the cleaner curve.
- Dialog: new "Automatic slope regularization (GCV) -- recommended"
  checkbox (default on, both modes); disables the manual boxcar q-window,
  which is kept for the classic GCV-off path.
- Manual updated.

Validated (Python prototype + exact re-implementation of this helper):
tracks the ground-truth-optimal lambda across simulated dilution series
(weak/strong, repulsive/attractive, 3-8 curves, uniform/log grids), and on
real asyn data gives a clean low-q Guinier (R^2=0.99, Rg=40.5 A) vs 0.44
for ATSAS almerge and 0.22 for per-q OLS. Review-only; not compiled here.

Co-Authored-By: Claude Opus 4.8 <noreply at anthropic.com>



To unsubscribe from these emails, change your notification settings at https://github.com/ehb54/ultrascan3/settings/notifications


More information about the us-commits mailing list