Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. from scipy import interpolate
  2. yao = np.asarray(yo[0::10])
  3. xao = np.asarray(xo[0::10])
  4. #plt.plot(xao, yao)
  5. print(len(xao))
  6. okayo = np.where(np.abs(np.diff(xao)) + np.abs(np.diff(yao)) > 0)
  7. xpo = np.r_[xao[okayo], xao[-1]]
  8. print(len(xpo))
  9. ypo = np.r_[yao[okayo], yao[-1]]
  10.  
  11. tcko, uo = interpolate.splprep([xpo, ypo], s=3, k=1, per=False)
  12. xo, yo = interpolate.splev(np.linspace(0, 1, 100), tcko)
  13.  
  14. fig = plt.figure()
  15. ax = plt.subplot(111)
  16. ax.plot(xao, yao, '.', markersize=2)
  17. ax.plot(xo, yo, alpha=0.5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement