Skip to content

Switch DBE's regression-surface upsample to bilinear - #26

Merged
hd152 merged 1 commit into
mainfrom
dbe-bilinear-upsample
Sep 22, 2026
Merged

hd152 merged 1 commit into
mainfrom
dbe-bilinear-upsample

Conversation

@hd152

@hd152 hd152 commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Summary

Re-profiling after #22/#25's Phase 4 work found zoom(order=3) still costing real time: _fit_background_surface (the standard DBE path, exercised by dynamic_background_extraction) upsamples its coarse regression grid with cubic interpolation, then blurs the result again immediately after (sigma=patch_size*0.5) -- same situation gaussian_filter_ds's own upsample was already fixed for earlier this session.

  • Switched to order=1. Validated directly against real _dbe_regression_coarse_grid output: post-blur mean diff <0.1, max <1.0 ADU.
  • Found a sibling zoom(order=3) call in wavelet_background_extraction with no follow-up blur -- the same argument doesn't automatically carry over, and it has no real quality test (only a mocked one in test_sky_model.py). A synthetic check was inconclusive. Left it as order=3, unchanged rather than ship an unvalidated change.
  • Measured on a real Omega Nebula session subset: Post-process 18.5s -> 17.8s.

Test plan

  • Full test suite passes (1651 tests)
  • ruff check . clean
  • New pinning test (test_fit_background_surface_bilinear_upsample_matches_cubic) measures the actual post-blur difference on real regression-grid machinery, not a synthetic stand-in

🤖 Generated with Claude Code

Re-profiling after the last two perf PRs found zoom(order=3) still
showing up: _fit_background_surface upsamples its coarse regression
grid with cubic interpolation, then immediately blurs the result again
(sigma=patch_size*0.5, typically >=32px) -- the same "nothing left for
cubic's curvature term to recover" situation gaussian_filter_ds's own
upsample was already fixed for.

Switched to order=1. Validated directly against real
_dbe_regression_coarse_grid output (not assumed): post-blur mean diff
<0.1, max <1.0 ADU. New pinning test in test_dbe_gradient.py.

Found and left alone: wavelet_background_extraction has a sibling
zoom(order=3) call with no follow-up blur, so the same argument
doesn't automatically carry over -- and it has no real quality test to
validate a change against (test_sky_model.py only mocks it). A
synthetic check was inconclusive (near-zero field variance in the
test data, not representative). Reverted that half of the change
rather than ship it unvalidated.

Measured on a real Omega Nebula session subset: Post-process
18.5s -> 17.8s. Full suite (1651 tests) passes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@hd152
hd152 merged commit 143f860 into main Sep 22, 2026
7 checks passed
@hd152
hd152 deleted the dbe-bilinear-upsample branch September 22, 2026 21:08
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