Philip-Leron / internship

0 stars 0 forks source link

Fourier Transform examples #5

Open philusnarh opened 6 years ago

philusnarh commented 6 years ago

http://nbviewer.jupyter.org/urls/dl.dropbox.com/s/l2x7px5fmzdxt79/PlayingWithFFTs.ipynb

philusnarh commented 6 years ago

https://docs.scipy.org/doc/numpy-1.13.0/reference/routines.fft.html

philusnarh commented 6 years ago

from scipy import interpolate

def rescale_data_size(data, newsizex, newsizey):

++++++++++ interpolating to have same size ++++++++

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)