Repository navigation
Skip angles with no frames in calculate_mean_images - #73
Draft
Sarthak-Shreshtha01 wants to merge 1 commit into
Draft
Sarthak-Shreshtha01 wants to merge 1 commit into
Sarthak-Shreshtha01 wants to merge 1 commit into
Conversation
np.mean of an empty selection returns an all-NaN image with a RuntimeWarning, not an IndexError, so missing angles were added to the result as NaN images and the warning was never logged. Signed-off-by: Sarthak <sarthakshreshtha345@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #73 +/- ##
==========================================
+ Coverage 45.08% 45.43% +0.34%
==========================================
Files 14 14
Lines 1129 1127 -2
==========================================
+ Hits 509 512 +3
+ Misses 620 615 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
calculate_mean_imagesmakes one mean image for each of 10, 20, ..., 350 degrees. When no frame has a given angle, for example when a recording only covers 0 to 180 degrees,np.meanof the empty selection returns an all-NaN image with aRuntimeWarning. It does not raiseIndexError, so theexceptbranch never ran: the NaN images were added to the result and the "Angle not found" warning was never logged.With angles 0 to 180 in steps of 1 degree, 17 of the 35 returned images were all NaN. These images go on to blob detection when finding the center of rotation (
IncrementalPipeline) and in the Bayesian optimisation.This change skips angles with no frames and logs the warning for them. I added
tests/test_unit/test_mean_images.py, which fails before the change and passes after it. The full test suite and the pre-commit hooks pass locally.