Thanks Casey, I will try this and see how I get on.
Ashley
Announcement
Collapse
No announcement yet.
Python code for Cublic Spline interpolation for kinematic/kinetic time series data
Collapse
X
-
Hi Ashley,
In case you are still looking for help, below should do the trick.
Code:import numpy as np from scipy.interpolate import CubicSpline # t : original index or time values (here its just 0-1 at 0.001 intervals) t = np.arange(0, 1, 0.001) # y : original data (here its just a sine wave) y = np.sin(2 * np.pi * t) # create spline spl = CubicSpline(t, y) # create index for new time series # the first and second arguements (0 & 1 here) should match the first and last indexes of the original one (or at least within those boundaries) # the third argument is how many samples there will be t_new = np.linspace(0, 1, 101) # create new data y_new = spl(t_new)
Casey
Leave a comment:
-
Python code for Cublic Spline interpolation for kinematic/kinetic time series data
Hi All,
I am looking to present some kinematic and kinetic data time normalised to 101 points to show 0-100%. Does anyone have any experience of completing this on Python or have access to code to do so? I have been attempting this with the Scipy Cubic Spline function but am having no luck in replicating the data series to 101 points. I've seen some MATLAB code on this forum but don't have experience with that particular software.
Thanks
AshleyTags: None
Leave a comment: