Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from scipy import interpolate
- from pylab import *
- box = zeros((20,20))
- box[5:15, 5:15] = ones((10,10))
- L = shape(box)[1]
- hann = hanning(L) # 1D window
- M = (L-1)/2.0
- xx = linspace(-M,M,L)
- x, y = meshgrid(xx, xx.T)
- r = sqrt( x**2 + y**2 )
- rot_hann2D = zeros((shape(box)))
- f = interpolate.interp1d(xx, hann)
- rot_hann2D[nonzero(r<=M)] = f(r[r<=M])
- a = shape(box[0])
- b = shape(box[1])
- r = x**2/a + y**2/b
Add Comment
Please, Sign In to add comment