Skip to content

Conversation

@garrettwrong
Copy link
Collaborator

This PR implements the legacy pre-whitening code from MATLAB.

Also includes two other cleanups. First, some of the Filter methods (_create_filter) are simplified/reconciled and enforced with abc. Second, the ImageAccessor image count attribute is changed from num_images to n_images. This allows an ImageAccessor to be passed in place of an Image stack in the static methods (epsdR, epsdS) I've ported in this PR, but is otherwise mostly an internal change.

@garrettwrong garrettwrong self-assigned this Jan 27, 2025
@garrettwrong garrettwrong added enhancement New feature or request cleanup labels Jan 27, 2025
@garrettwrong
Copy link
Collaborator Author

Cleanup and changed some random camel casing towards our more typical var names (bgRadius->bg_radius, batchSize->batch_size).

Need to finish the GPU interop and begin testing.

@codecov
Copy link

codecov bot commented Jan 27, 2025

Codecov Report

Attention: Patch coverage is 80.37736% with 52 lines in your changes missing coverage. Please review.

Project coverage is 90.43%. Comparing base (bb67480) to head (c48d1a4).
Report is 37 commits behind head on develop.

Files with missing lines Patch % Lines
src/aspire/noise/noise.py 89.36% 15 Missing ⚠️
src/aspire/numeric/mkl_fft.py 0.00% 15 Missing ⚠️
src/aspire/numeric/base_fft.py 50.00% 7 Missing ⚠️
src/aspire/numeric/pyfftw_fft.py 50.00% 5 Missing ⚠️
src/aspire/source/image.py 79.16% 5 Missing ⚠️
src/aspire/image/image.py 89.47% 4 Missing ⚠️
src/aspire/commands/cov3d.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1223      +/-   ##
===========================================
- Coverage    90.63%   90.43%   -0.21%     
===========================================
  Files          132      132              
  Lines        13705    13939     +234     
===========================================
+ Hits         12422    12606     +184     
- Misses        1283     1333      +50     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@garrettwrong garrettwrong force-pushed the iso_whtn branch 2 times, most recently from ba8690a to be97013 Compare January 27, 2025 20:24
@garrettwrong
Copy link
Collaborator Author

Initial tests of legacy_whiten reproduce MATLAB pretty closely for a small sample of real data at 129 and 128 pixels. Notebook including minimal scripts for both repos is attached.

CompareWhiten.pdf

I will start some larger runs in the background.

This just needs some self review and should be ready for further consideration.

Copy link
Collaborator

@j-c-c j-c-c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Just a couple small things.

j-c-c
j-c-c previously approved these changes Jan 31, 2025
Copy link
Collaborator

@j-c-c j-c-c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good!

@garrettwrong garrettwrong marked this pull request as ready for review January 31, 2025 19:27
@garrettwrong garrettwrong requested a review from janden as a code owner January 31, 2025 19:27
@garrettwrong
Copy link
Collaborator Author

garrettwrong commented Feb 4, 2025

During my optimization work I may have spotted a small bug in the python corr accumulation loop that duplicates accumlations (but the same bug applies to the denominator count accumulation, so I think it more/less cancels).(fixed) Once I finish testing the optimized code I might merge it into here... (this afternoon maybe).

* batch legacy_whiten 2d
* fft opts legacy_whitening
* profile and implement Yoels validdist opt
Copy link
Collaborator

@janden janden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! Some questions and remarks (mostly naming) here.

@garrettwrong
Copy link
Collaborator Author

I think I addressed the suggestions. This also makes the normalization optional.

I will begin retesting this against MATLAB and with the full size recon.

@garrettwrong
Copy link
Collaborator Author

Reproduced the test case in the notebook. Experimental data recon will finish tomorrow, but I don't anticipate any surprises given the test batches were good.

@garrettwrong
Copy link
Collaborator Author

Experimental recon was also good.

@garrettwrong garrettwrong requested a review from janden February 7, 2025 19:41
@janden
Copy link
Collaborator

janden commented Feb 10, 2025

Great! Just one name suggestion and we should be good to go.

@garrettwrong garrettwrong merged commit 1c633c8 into develop Feb 11, 2025
35 checks passed
@garrettwrong garrettwrong deleted the iso_whtn branch February 11, 2025 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants