Repository navigation
fix: PSF sizing (radius cap, centering, normalization), add max_psf_radius_aus="auto" - #158
Merged
Merged
Conversation
…adius_aus="auto" - `max_psf_radius_aus` never applied: `_pick_nx` got a wavelength in nm where it expected um. - PSFs are now always odd-sized (rounded up) and centered on a pixel. Even sizes (widefield added 1 to nz/nx, confocal used them as-is) shifted images by 0.5-1 voxel. `make_psf(nz=49)` now returns 49 planes. - Emission PSF normalization uses the in-focus plane summed over >= 64 AU, so it no longer depends on the lateral size (truncated PSFs were brightened to compensate). - New default `max_psf_radius_aus="auto"`: widefield 14 AU + half the radius of the out-of-focus cone at half the volume depth; confocal 8 AU. Calibrated to ~1% RMSE vs an untruncated PSF. - PSF disk cache key bumped to v3. - Remove a stray `breakpoint()` in `Spectrum` validation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #158 +/- ##
==========================================
+ Coverage 88.01% 88.15% +0.13%
==========================================
Files 48 48
Lines 3279 3292 +13
==========================================
+ Hits 2886 2902 +16
+ Misses 393 390 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tlambert03
added a commit
that referenced
this pull request
Oct 11, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This started as a one-liner (
max_psf_radius_ausnever actually did anything:_pick_nxwas getting the wavelength in nm where it expects µm, so the cap was always ~1000x too big). But fixing it meant figuring out what the default should be, and measuring that turned up two more PSF bugs:nz + 1, nx + 1and confocal used sizes as-is, so depending on the inputs you'd get even-sized PSFs, which (inmode="same") shift the image by 0.5-1 voxel... and can misregister channels relative to each other. PSFs are now always odd (rounded up) and centered on a pixel. This also meansmake_psf(nz=49)now gives you 49 planes, not 50.Then the new default,
max_psf_radius_aus="auto". This is our opinionated balance between speed and accuracy, aiming for ~1% RMSE vs an untruncated PSF (which is below shot noise unless you're collecting well over ~10^4 photons/pixel):Calibrated against
Noneon 1024² volumes, 1-8 µm deep (EGFP, NA 1.4, 20 nm pixels):Noneit's a bigger deal for larger volumes: at 2048²,
Nonewas 2-4x slower per sample (and up to ~7x slower to build a new confocal PSF). For small volumes (<= ~256²)autojust hits the FOV and nothing changes. Since the old cap never applied, everyone has effectively been runningNoneall along... so for big volumes, results now move by up to ~1% RMSE, and all results move a little from the centering/normalization fixes. Bumped the PSF disk cache key to v3 so nothing stale gets reused.fwiw, the old intended default (6 AU) would have been pretty bad for thick widefield volumes: in a 5 µm deep volume it loses ~30% of the light.
Also removes a stray
breakpoint()inSpectrumvalidation that snuck into main.🤖 Generated with Claude Code