Skip to content

Commit c4fd8cc

Browse files
committed
Remove unnecessary copy by using in-place multiplication
1 parent ce1c15f commit c4fd8cc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

httomolibgpu/prep/phase.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,11 @@ def paganin_filter_tomopy(
317317
phase_filter = fftshift(_paganin_filter_factor2(energy, dist, alpha, w2))
318318
phase_filter = phase_filter / phase_filter.max() # normalisation
319319

320+
# Filter projections
321+
fft_tomo *= phase_filter
322+
320323
# Apply filter and take inverse FFT
321-
ifft_filtered_tomo = (
322-
ifft2(phase_filter * fft_tomo, axes=(-2, -1), overwrite_x=True)
323-
).real
324+
ifft_filtered_tomo = ifft2(fft_tomo, axes=(-2, -1), overwrite_x=True).real
324325

325326
# slicing indices for cropping
326327
slc_indices = (

0 commit comments

Comments
 (0)