fix: apply apodization when delay is zero in scan_line#743
Merged
waltsims merged 1 commit intoMay 18, 2026
Merged
Conversation
The scan_line method only applied apodization weights when delay was non-zero, silently skipping elements with delay==0. Added else branch to apply apodization for all active elements regardless of delay.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #743 +/- ##
==========================================
- Coverage 75.55% 75.54% -0.01%
==========================================
Files 57 57
Lines 8187 8188 +1
Branches 1598 1598
==========================================
Hits 6186 6186
- Misses 1380 1381 +1
Partials 621 621
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
waltsims
approved these changes
May 18, 2026
Owner
waltsims
left a comment
There was a problem hiding this comment.
Thanks for the PR!
A passing test case would have made the test coverage pass.
thanks!
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 #627
The
scan_linemethod inNotATransduceronly applied apodization weights whendelay != 0, silently skipping elements withdelay == 0. This meant those elements contributed to the summed line without their receive apodization weight.Added an
elsebranch to apply apodization for all active elements regardless of delay value.Greptile Summary
This PR fixes a silent beamforming bug in
NotATransducer.scan_linewhere elements whose delay rounded to exactly zero were summed into the output line without having their receive apodization weight applied. The fix is a minimal, correctelsebranch that mirrors the apodization multiply already present in the> 0and< 0branches.steering_angle == 0andfocus_distance == inf, where every element's delay is zero — meaning the old code applied no apodization at all for that common B-mode configuration.Confidence Score: 5/5
Safe to merge — the change closes a well-defined gap where zero-delay elements skipped apodization entirely.
The three-line addition completes a pattern that is already correct in the adjacent branches, and the failure scenario (unweighted elements contributing to the summed line) is clearly reproduced whenever all delays are zero, which is the default no-steering/no-focus case.
No files require special attention.
Important Files Changed
elsebranch toscan_lineso apodization is applied to elements whose beamforming delay rounds to zero, fixing a silent bug where those elements contributed unweighted signal to the summed line.Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[scan_line called] --> B[get_receive_apodization] B --> C[delays = -beamforming_delays] C --> D{for each element_index} D --> E{delays value?} E -- "> 0" --> F[Pad right, shift forward\n× apodization] E -- "< 0" --> G[Pad left, shift backward\n× apodization] E -- "== 0\n(NEW: else branch)" --> H[No shift\n× apodization] E -- "== 0\n(OLD: no branch)" --> I[❌ No apodization applied] F --> J[np.sum across elements] G --> J H --> J J --> K[Return scan line]Reviews (1): Last reviewed commit: "fix: apply apodization when delay is zer..." | Re-trigger Greptile