[SciPy-dev] [BUG] scipy.interpolate.splprep

Martin Lüthi answer at tnoo.net
Wed Aug 2 08:41:40 EDT 2006


Hi

The function scipy.interpolate.splprep only returns a tuple of length 2
instead of three. Therefore the splines cannot be evaluated with splev:

---------------
import scipy as S
import scipy.interpolate

x = S.array([[0.,0.,0.],
            [1.,1.,0.],
            [1.5,0.9,0.5],
            [2.,0.,1.],]
            )

sp = scipy.interpolate.splprep(x.transpose())
print scipy.interpolate.splev([0.], sp)
---------------

yields

---------------

exceptions.ValueError                                Traceback (most recent call last)

/home/tinu/projects/lbie/python/<ipython console> 

/tmp/python-5096nEG.py 
      7             [2.,0.,1.],]
      8             )
      9 
     10 sp = scipy.interpolate.splprep(x.transpose())
---> 11 print scipy.interpolate.splev([0.], sp)

/usr/lib/python2.4/site-packages/scipy/interpolate/fitpack.py in splev(x, tck, der)
    406            representing the curve in N-dimensional space.
    407     """
--> 408     t,c,k=tck
    409     try:
    410         c[0][0]

ValueError: need more than 2 values to unpack
---------------

Thanks, Martin

-- 
Martin Lüthi                 answer at tnoo.net




More information about the SciPy-Dev mailing list