Memory error with quadratic interpolation

Isaac Won winefrog at gmail.com
Wed Jan 23 15:24:02 CET 2013


On Tuesday, January 22, 2013 10:06:41 PM UTC-6, Isaac Won wrote:
> Hi all,
> 
> 
> 
> I have tried to use different interpolation methods with Scipy. My code seems just fine with linear interpolation, but shows memory error with quadratic. I am a novice for python. I will appreciate any help.
> 
> 
> 
> #code
> 
> f = open(filin, "r")
> 
> for columns in ( raw.strip().split() for raw in f ):
> 
>         a.append(columns[5])
> 
>         x = np.array(a, float)
> 
> 
> 
> 
> 
> not_nan = np.logical_not(np.isnan(x))
> 
> indices = np.arange(len(x))
> 
> interp = interp1d(indices[not_nan], x[not_nan], kind = 'quadratic')
> 
> 
> 
> p = interp(indices)
> 
> 
> 
> ------------------------------------------------------------------------
> 
> The number of data is 31747.
> 
> 
> 
> Thank you,
> 
> 
> 
> Isaac

I really appreciate to both Ulich and Oscar.

To Oscar
My actual error message is:
File "/lustre/work/apps/python-2.7.1/lib/python2.7/site-packages/scipy/interpolate/interpolate.py", line 311, in __init__
    self._spline = splmake(x,oriented_y,order=order)
  File "/lustre/work/apps/python-2.7.1/lib/python2.7/site-packages/scipy/interpolate/interpolate.py", line 809, in splmake
    coefs = func(xk, yk, order, conds, B)
  File "/lustre/work/apps/python-2.7.1/lib/python2.7/site-packages/scipy/interpolate/interpolate.py", line 530, in _find_smoothest
    u,s,vh = np.dual.svd(B)
  File "/lustre/work/apps/python-2.7.1/lib/python2.7/site-packages/scipy/linalg/decomp_svd.py", line 91, in svd
    full_matrices=full_matrices, overwrite_a = overwrite_a)
MemoryError
--------------------------------------------------------------------------
Thank you,

Hoonill



More information about the Python-list mailing list