Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calculate spectrum whitening filter only in the search region #81

Merged
merged 3 commits into from
Jan 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
calculate the whitening filter only in the user specified region of i…
…nterest
McHaillet committed Jan 24, 2024
commit 86a2d02c37fa6ac970d98685727219928a045410
10 changes: 9 additions & 1 deletion src/pytom_tm/tmjob.py
Original file line number Diff line number Diff line change
@@ -179,7 +179,15 @@ def __init__(
self.whitening_filter = self.output_dir.joinpath(f'{self.tomo_id}_whitening_filter.npy')
if self.whiten_spectrum and not self.whitening_filter.exists():
logging.info('Estimating whitening filter...')
weights = 1 / np.sqrt(power_spectrum_profile(read_mrc(self.tomogram)))
weights = 1 / np.sqrt(
power_spectrum_profile(
read_mrc(self.tomogram)[
self.search_origin[0]: self.search_origin[0] + self.search_size[0],
self.search_origin[1]: self.search_origin[1] + self.search_size[1],
self.search_origin[2]: self.search_origin[2] + self.search_size[2]
]
)
)
weights /= weights.max() # scale to 1
np.save(self.whitening_filter, weights)