Skip to content

Commit

Permalink
Remove unnecessary copy by using in-place multiplication
Browse files Browse the repository at this point in the history
  • Loading branch information
yousefmoazzam committed Sep 20, 2024
1 parent ce1c15f commit c4fd8cc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions httomolibgpu/prep/phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,11 @@ def paganin_filter_tomopy(
phase_filter = fftshift(_paganin_filter_factor2(energy, dist, alpha, w2))
phase_filter = phase_filter / phase_filter.max() # normalisation

# Filter projections
fft_tomo *= phase_filter

# Apply filter and take inverse FFT
ifft_filtered_tomo = (
ifft2(phase_filter * fft_tomo, axes=(-2, -1), overwrite_x=True)
).real
ifft_filtered_tomo = ifft2(fft_tomo, axes=(-2, -1), overwrite_x=True).real

# slicing indices for cropping
slc_indices = (
Expand Down

0 comments on commit c4fd8cc

Please sign in to comment.