Advertisement
Guest User

Scipy Interpolation Memory Exhaustion

a guest
Mar 19th, 2014
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.42 KB | None | 0 0
  1. from numpy import *
  2. from scipy import interpolate as irp
  3.  
  4. w = 61
  5.  
  6. t = linspace(-1,1,w)
  7. xx,yy = meshgrid(t,t)
  8. xx,yy = xx.flatten(), yy.flatten()
  9. P = c_[sign(xx)*abs(xx)**0.65, sign(yy)*abs(yy)**0.65]
  10. del t
  11.  
  12. x = random.randint( 0, 255, (2*w**2,w**2) ).astype(uint8)
  13. xo = zeros(x.shape,dtype=uint8)
  14. for i in range(x.shape[0]):
  15.     f = irp.LinearNDInterpolator( P, x[i,:] )
  16.     out = f( xx, yy )
  17.     xo[i,:] = out
  18.     del f, out
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement