Open philusnarh opened 6 years ago
from scipy import interpolate
def rescale_data_size(data, newsizex, newsizey):
dshape = data.shape
# define new size
outKSize_x = newsizex
outKSize_y = newsizey
# Rescale Data Size
x_old = np.linspace(-dshape[0]/2., dshape[0]/2., dshape[0])
y_old = np.linspace(-dshape[-1]/2., dshape[-1]/2., dshape[-1])
xnew = np.linspace(x_old.min(), x_old.max(), outKSize_x)
ynew = np.linspace(y_old.min(), y_old.max(), outKSize_y)
# Perform Interpolation
interp_Fxn = interpolate.RectBivariateSpline(np.sort(x_old),
np.sort(y_old),data, kx=3,ky=3)
return interp_Fxn(xnew,ynew)
http://nbviewer.jupyter.org/urls/dl.dropbox.com/s/l2x7px5fmzdxt79/PlayingWithFFTs.ipynb