I need to extrapolate a given 2D array to a larger domain, keeping the spatial frequency. This is the original field:
(the data file in numpy npz format and a Jupyter notebook to plot it can be found here)
The horizontal size here is 14.864408108 (critical wavelength), and the vertical size is 14.864408108/sqrt(3)
I would like to extrapolate it to a square domain of size, let's say, ten times bigger than the original horizontal size, but fixing the number of grid points to a given number (256x256 for example).
Currently I use
numpy.tile to do that:
import numpy as np from scipy import interpolate def enlarge(field,mult_x=5,mult_y=8): y = np.linspace(2*mult_y*Y.min(),2*mult_y*Y.max(),int(np.round(2*mult_y*field.shape/mult_x))) field2 = np.concatenate((field, field[::-1, :])) field4 = np.concatenate((field2, field2[:,::-1]), axis=1) large = np.tile(field4,(mult_y, mult_x)) # 17 just because it gives a number close to 256*10 less = large[::mult_x, ::mult_x] # skip every 10 rows/columns #print(less.shape) f = interpolate.interp1d(y, less,axis=0) y_new = np.linspace(2*mult_y*Y.min(),2*mult_y*Y.max(),less.shape) field = f(y_new) return field
Can I use Fourier transform to do that?