[SciPy-User] Replace duplicates in a monotonically increasing array with linearly interpolated values.
Fri Sep 10 15:53:03 CDT 2010
Could you give one example with a pseudo irregular data? Are the data-points
irregular or the x-locations of each-data point?
On Fri, Sep 10, 2010 at 3:32 PM, Dharhas Pothina <
> I may be missing something but I'm not seeing how that would work if the
> spacing was fairly irregular unlike my example array. I don't mind the
> interpolation not going through the switching points exactly but the points
> should not shift to the next interval which it seems would happen if the
> array was irregularly spaced.
> > from scipy.interpolate import interp1d
> > x =
> > f = interp1d(range(len(np.unique(x))), np.unique(x))
> > xnew = np.linspace(0,len(np.unique(x))-1,len(x)); f(xnew)
> > plt.figure(); plt.plot(range(len(x)), x, 'o', range(len(x)), f(xnew),
> - d
> SciPy-User mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User