@@ -97,13 +97,12 @@ def paganin_filter(
9797 fft_tomo = fft2 (padded_tomo , axes = (- 2 , - 1 ), overwrite_x = True )
9898
9999 # calculate alpha constant
100- micron = 10 ** (- 6 )
101- KeV = 1000.0
102- alpha = _calculate_alpha (energy * KeV , distance * micron , ratio_delta_beta )
100+ alpha = _calculate_alpha (energy , distance , ratio_delta_beta )
103101
104102 # Compute the reciprocal grid
105- indx = _reciprocal_coord (pixel_size , dy )
106- indy = _reciprocal_coord (pixel_size , dx )
103+ pixel_size *= 1e6 # rescaling to meters
104+ indx = _reciprocal_coord (pixel_size / (2 * math .pi ), dy )
105+ indy = _reciprocal_coord (pixel_size / (2 * math .pi ), dx )
107106
108107 # Build Lorentzian-type filter
109108 phase_filter = fftshift (
@@ -139,10 +138,8 @@ def paganin_filter(
139138 return _log_kernel (tomo )
140139
141140
142- def _calculate_alpha (energy , distance_micron , ratio_delta_beta ):
143- return (
144- _wavelength_micron (energy ) * distance_micron / (4 * math .pi )
145- ) * ratio_delta_beta
141+ def _calculate_alpha (energy , distance , ratio_delta_beta ):
142+ return (_wavelength_micron (energy ) * distance / (4 * math .pi )) * ratio_delta_beta
146143
147144
148145# the scaling is different here and doesn't follow the original formula
@@ -216,9 +213,8 @@ def _pad_projections_to_second_power(
216213
217214
218215def _wavelength_micron (energy : float ) -> float :
219- SPEED_OF_LIGHT = 299792458e2 * 10000.0 # [microns/s]
220- PLANCK_CONSTANT = 6.58211928e-19 # [keV*s]
221- return 2 * math .pi * PLANCK_CONSTANT * SPEED_OF_LIGHT / energy
216+ # for photons: E = 1keV -> 1.23984193 nm
217+ return (1.23984193e-9 ) / energy
222218
223219
224220def _reciprocal_coord (pixel_size : float , num_grid : int ) -> cp .ndarray :
0 commit comments