Repository navigation
fix: conjugate U and Vh in SVD-based inverse filters, expose decomposition choice - #600
Open
talonchandler wants to merge 2 commits into
Open
talonchandler wants to merge 2 commits into
talonchandler wants to merge 2 commits into
Conversation
…ition choice The Tikhonov inverse filters built from a singular system omitted the complex conjugates of U and Vh. For the forward model H = (U S Vh)^T the least-squares inverse needs conj(U) and conj(Vh). With real or purely imaginary transfer functions the conjugates are no-ops, which is why untilted reconstructions were unaffected. With complex transfer functions the unconjugated filter is wrong: - isotropic_thin_3d under tilted illumination reconstructed as if the azimuth were rotated by pi, so gradient fits of the tilt landed pi away from the forward model's azimuth (#598). - inplane_oriented_thick_pol3d_vector's transfer function is complex and not Hermitian-symmetric; its unconjugated filter was not the pseudoinverse (200% operator error vs torch.linalg.pinv) and returned the f00 phase channel with the sign flipped. - isotropic_fluorescent_thin_3d is conjugated for consistency (real TFs, no behavior change). reconstruct() also gains an explicit decomposition argument ('auto'/'svd'/'per_channel') so a gradient-based tilt fit and the final reconstruction can use the same estimator instead of switching on requires_grad; 'auto' preserves the previous behavior. BREAKING: tilt azimuths fitted through the old inverse are pi away from the forward-model convention. Reusing stored fits with this version requires adding pi to the stored azimuth (see #598). Fixes #598
…o its own PR Same root cause, different user base (birefringence reconstructions) and different validation needs, so it ships separately.
Collaborator
Author
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.
Fixes #598.
What
isotropic_thin_3d.apply_inverse_transfer_functionbuilds its Tikhonov filter fromconj(U)andconj(Vh)(shared and per-tile paths), with the same one-line change inisotropic_fluorescent_thin_3d(real transfer functions there, no behavior change). The least-squares inverse needs the conjugates; they are no-ops without tilt, which is why untilted reconstructions were unaffected. Under tilt the old filter reconstructed as if the azimuth were rotated by pi.isotropic_thin_3d.reconstructgainsdecomposition={"auto", "svd", "per_channel"}so a tilt fit and the final reconstruction can use the same estimator."auto"preserves the previous requires_grad switch, so existing callers are unchanged.Verification
test_tilted_round_trip; full suite passes including GPU tests on an L40S node.Migration
Azimuths fitted through the old inverse sit pi away from the forward-model convention: pipelines that refit each run are fine; replaying stored fits needs + pi. Suggest releasing as 3.1.0 with a breaking-change note. Companions: #601 (same conjugate fix for the vectorial model) and czbiohub-sf/ops_monorepo#452 (production).