Skip to content

Commit

Permalink
Merge pull request #637 from nghia-vo/master
Browse files Browse the repository at this point in the history
Replace interp2d deprecated
  • Loading branch information
carterbox committed Feb 6, 2024
2 parents d413267 + 0a959e8 commit a7bd9a0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions source/tomopy/prep/stripe.py
Expand Up @@ -823,10 +823,14 @@ def _rs_dead(sinogram, snr, size, matindex, norm=True):
listx = np.where(listmask < 1.0)[0]
listy = np.arange(nrow)
matz = sinogram[:, listx]
finter = interpolate.interp2d(listx, listy, matz, kind='linear')
finter = interpolate.RectBivariateSpline(listy, listx, matz,
kx=1, ky=1)
listxmiss = np.where(listmask > 0.0)[0]
if len(listxmiss) > 0:
sinogram[:, listxmiss] = finter(listxmiss, listy)
matxmiss, maty = np.meshgrid(listxmiss, listy)
output = finter.ev(np.ndarray.flatten(maty),
np.ndarray.flatten(matxmiss))
sinogram[:, listxmiss] = output.reshape(matxmiss.shape)
# Remove residual stripes
if norm is True:
sinogram = _rs_large(sinogram, snr, size, matindex)
Expand Down Expand Up @@ -963,10 +967,14 @@ def _rs_interpolation(sinogram, snr, size, drop_ratio=0.1, norm=True):
listx = np.where(listmask < 1.0)[0]
listy = np.arange(nrow)
matz = sinogram[:, listx]
finter = interpolate.interp2d(listx, listy, matz, kind='linear')
finter = interpolate.RectBivariateSpline(listy, listx, matz,
kx=1, ky=1)
listxmiss = np.where(listmask > 0.0)[0]
if len(listxmiss) > 0:
sinogram[:, listxmiss] = finter(listxmiss, listy)
matxmiss, maty = np.meshgrid(listxmiss, listy)
output = finter.ev(np.ndarray.flatten(maty),
np.ndarray.flatten(matxmiss))
sinogram[:, listxmiss] = output.reshape(matxmiss.shape)
return sinogram


Expand Down

0 comments on commit a7bd9a0

Please sign in to comment.