Guest User

Untitled

a guest
Jan 21st, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. from scipy import interpolate
  2. from pylab import *
  3. box = zeros((20,20))
  4. box[5:15, 5:15] = ones((10,10))
  5. L = shape(box)[1]
  6. hann = hanning(L) # 1D window
  7. M = (L-1)/2.0
  8. xx = linspace(-M,M,L)
  9. x, y = meshgrid(xx, xx.T)
  10. r = sqrt( x**2 + y**2 )
  11. rot_hann2D = zeros((shape(box)))
  12. f = interpolate.interp1d(xx, hann)
  13. rot_hann2D[nonzero(r<=M)] = f(r[r<=M])
  14.  
  15. a = shape(box[0])
  16. b = shape(box[1])
  17. r = x**2/a + y**2/b
Add Comment
Please, Sign In to add comment