[SciPy-user] Cookbook: Interpolation of an N-D curve error
Angus McMorland
a.mcmorland at auckland.ac.nz
Mon Jun 19 20:39:10 EDT 2006
Fernando Perez wrote:
>> ipdb> whatis s
>> <type 'float'>
>> ipdb> s
>> WARNING: Failure executing file: <spl.py>
>>
>> In [23]:
>>
>> Requesting s kicks me out of the debugger altogether.
>
> Not an answer to your question, but 's' is a pdb command:
Doh, of course! Thanks for that. Following on with the actual problem:
ipdb> print s
3.0
So no problems there in fact. Just while I was there I tried:
ipdb> print u
[ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.
0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
ipdb> u.shape
/home/amcmorl/tmp/spl.py
21 # find the knot points
---> 22 tckp,u = splprep([x,y,z],s=s,k=k,nest=-1)
23
ipdb> print w
[ 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.
1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
ipdb> w.shape
/home/amcmorl/tmp/spl.py
20
21 # find the knot points
---> 22 tckp,u = splprep([x,y,z],s=s,k=k,nest=-1)
23
24 # evaluate spline, including interpolated points
/usr/lib/python2.3/site-packages/scipy/interpolate/fitpack.py in splprep()
215 iwrk=_parcur_cache['iwrk']
216
t,c,o=_fitpack._parcur(ravel(transpose(x)),w,u,ub,ue,k,task,ipar,s,t,
--> 217 nest,wrk,iwrk,per)
218 _parcur_cache['u']=o['u']
219 _parcur_cache['ub']=o['ub']
I.E. I can see the values, but not get the shape returned. My
understanding is that u should be the incrementing parameter for the
spline (and checking on the i686 (where the routine works):
In [11]:u
Out[11]:
array([ 0. , 0.00660902, 0.0123891 , 0.02341715, 0.03388626,
0.05189959, 0.068629 , 0.08002793, 0.08344803, 0.09142408,
0.09939328, 0.10562672, 0.10838236, 0.11531264, 0.12881276,
0.13391073, 0.14557512, 0.1514497 , 0.16502928, 0.17323899,
0.18147124, 0.19263442, 0.20709241, 0.20862571, 0.21886334,
0.22479777, 0.23564814, 0.2451128 , 0.25976362, 0.26892058,
0.27990341, 0.28739167, 0.29471638, 0.3012055 , 0.31482816,
0.32418042, 0.34062476, 0.34403043, 0.35805071, 0.36502075,
0.37829313, 0.38401472, 0.3915394 , 0.39294913, 0.4043306 ,
0.4156923 , 0.42120011, 0.43522407, 0.44540497, 0.46210282,
0.47038053, 0.47715903, 0.49183298, 0.50998032, 0.51845474,
0.53809475, 0.5530424 , 0.56392821, 0.56784815, 0.57119358,
0.57531501, 0.58558322, 0.59262561, 0.60861044, 0.62329971,
0.63037712, 0.64413892, 0.65586238, 0.66734774, 0.68279714,
0.69122243, 0.70602072, 0.71882921, 0.72595286, 0.7387055 ,
0.74737882, 0.75263852, 0.76107314, 0.7737371 , 0.78308686,
0.78913781, 0.80321246, 0.81822862, 0.8354007 , 0.84295247,
0.84967894, 0.86107013, 0.87619586, 0.88717895, 0.89178471,
0.89884305, 0.90861747, 0.91663593, 0.92117768, 0.93464362,
0.95465968, 0.96749238, 0.97699623, 0.9824898 , 1. ])
So, it looks like the definition of u might be the problem. I see that
it looks like u is correctly defined as a float (from the "0."s,
although ipdb> u.dtype raises the same error as u.shape.
A.
--
Angus McMorland
email a.mcmorland at auckland.ac.nz
mobile +64-21-155-4906
PhD Student, Neurophysiology / Multiphoton & Confocal Imaging
Physiology, University of Auckland
phone +64-9-3737-599 x89707
Armourer, Auckland University Fencing
Secretary, Fencing North Inc.
More information about the SciPy-User
mailing list