[SciPy-User] Replace duplicates in a monotonically increasing array with linearly interpolated values.
Gökhan Sever
gokhansever@gmail....
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 <
Dharhas.Pothina@twdb.state.tx.us> wrote:
>
> 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 =
> np.array([1.0,1.0,1.0,2.0,2.0,3.0,3.0,3.0,4.0,4.0,5.0,5.0,5.0,5.0,6.0])
> > 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
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
--
Gökhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100910/b013e9a9/attachment.html
More information about the SciPy-User
mailing list