Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash of interpolate.splprep(task=-1) #3847

Closed
ebw44 opened this issue Jul 31, 2014 · 0 comments · Fixed by #12562
Closed

Crash of interpolate.splprep(task=-1) #3847

ebw44 opened this issue Jul 31, 2014 · 0 comments · Fixed by #12562
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.interpolate
Milestone

Comments

@ebw44
Copy link

ebw44 commented Jul 31, 2014

Running the circle example but with task = -1 parameter for splprep
http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html#spline-interpolation-in-1-d-procedural-interpolate-splxxx

I got a crash in firpack.py at
t,c,o = _fitpack._parcur(ravel(transpose(x)),w,u,ub,ue,k,task,ipar,s,t, nest,wrk,iwrk,per)

Here is my code:

from scipy import interpolate
import numpy as np
import matplotlib.pyplot as plt

""" tutorial example """
t = np.arange(0, 1.1, .1)
x = np.sin(2*np.pi*t)
y = np.cos(2*np.pi*t)
tck,u = interpolate.splprep([x,y], s=0)
unew = np.arange(0, 1.01, 0.01)
out = interpolate.splev(unew, tck)
plt.figure()
plt.plot(x, y, 'x', out[0], out[1], np.sin(2*np.pi*unew), np.cos(2*np.pi*unew), x, y, 'b')
plt.legend(['Linear', 'Cubic Spline', 'True'])
plt.axis([-1.05, 1.05, -1.05, 1.05])
plt.title('Spline of parametrically-defined curve')
plt.show()

"""test with splprep(task=-1) """
uknots = tck[0]                                    # using the knots from the previous fitting
tck,u = interpolate.splprep([x,y], task=-1, t=uknots)               # here is the crash
plt.figure()
plt.plot(x, y, 'x', out[0], out[1], np.sin(2*np.pi*unew), np.cos(2*np.pi*unew), x, y, 'b')
plt.legend(['Linear', 'Cubic Spline', 'True'])
plt.axis([-1.05, 1.05, -1.05, 1.05])
plt.title('Spline of parametrically-defined curve')
plt.show()

Here are the parameters for _fitpack._parcur:

  1. in the first case
[  0.00000000e+00   1.00000000e+00   5.87785252e-01   8.09016994e-01
   9.51056516e-01   3.09016994e-01   9.51056516e-01  -3.09016994e-01
   5.87785252e-01  -8.09016994e-01   1.22464680e-16  -1.00000000e+00
  -5.87785252e-01  -8.09016994e-01  -9.51056516e-01  -3.09016994e-01
  -9.51056516e-01   3.09016994e-01  -5.87785252e-01   8.09016994e-01
  -2.44929360e-16   1.00000000e+00] [ 1.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.] [ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.] 0 1 3 0 False 0 [] 15 [] [] 0
  1. in the second case (task =-1)
[  0.00000000e+00   1.00000000e+00   5.87785252e-01   8.09016994e-01
   9.51056516e-01   3.09016994e-01   9.51056516e-01  -3.09016994e-01
   5.87785252e-01  -8.09016994e-01   1.22464680e-16  -1.00000000e+00
  -5.87785252e-01  -8.09016994e-01  -9.51056516e-01  -3.09016994e-01
  -9.51056516e-01   3.09016994e-01  -5.87785252e-01   8.09016994e-01
  -2.44929360e-16   1.00000000e+00] [ 1.  1.  1.  1.  1.  1.  1.  1.  1.  1.  1.] [ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.] 0 1 3 -1 False 6.30958424018 [ 0.   0.   0.   0.   0.2  0.3  0.4  0.5  0.6  0.7  0.8  1.   1.   1.   1. ] 17 [] [] 0

I'm, using scipy '0.14.0'.

ev-br added a commit to ev-br/scipy that referenced this issue Jun 9, 2020
splprep segfaults for fixed knots and task=-1
ev-br added a commit to ev-br/scipy that referenced this issue Jul 17, 2020
splprep segfaults for fixed knots and task=-1
ev-br added a commit to ev-br/scipy that referenced this issue Jul 17, 2020
splprep segfaults for fixed knots and task=-1
@ev-br ev-br added this to the 1.6.0 milestone Jul 18, 2020
@tylerjereddy tylerjereddy modified the milestones: 1.6.0, 1.5.2 Jul 18, 2020
tylerjereddy pushed a commit to tylerjereddy/scipy that referenced this issue Jul 18, 2020
splprep segfaults for fixed knots and task=-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.interpolate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants