How to specify the number of node nodes when using scipy.splprep

I have the following code snippet. It generates a three-dimensional cubic spline of a given three-dimensional function specified in a parametric form. I pretty much adapted this to my case using the online documentation for splprep and splev .

But I have some things that I do not understand. Here is the code:

%matplotlib inline
from numpy import arange, cos, linspace, pi, sin, random
from scipy.interpolate import splprep, splev
import matplotlib.pyplot as plt

# make ascending spiral in 3-space
t=linspace(0,1.75*2*pi,100)

x = sin(t)
y = cos(t)
z = t


# spline parameters
s=3.0 # smoothness parameter
k=3 # spline order
nest=-1 # estimate of number of knots needed (-1 = maximal)

# find the knot points
tck,u = splprep([x,y,z],s=s,k=k,nest=-1)

# evaluate spline, including interpolated points
xnew,ynew,znew = splev(linspace(0,1,400),tck)

I have a few questions regarding this implementation.

  • (t,c,k) ?. , , , . (x, y, z)?. "number of knots". , . length 11.

  • u? ( , . ?. t?

  • nest = -1 ( ), ( 11 ). , , 50 80 ..

. - , , ?

+4
1

, u

, [x, y, z] , - t . t , . u ( u=t). , ( 0 1). u, , . u = t , u .

u . , [x, y, z] , u splev. u: , splev [x,y,z], , - .

tck

t , . [0,1], , t . , . 0 1 , .

c. , .

:

  • , ( task=-1 t ). : t t, [x, y, z]. , .
  • , .

s, . , 11 s = 3, 12 s = 1 14 s = 0.1.

+3

Source: https://habr.com/ru/post/1666825/


All Articles