Hi all, I have run into some roundoff problems trying to line up some experimental spectra. The x coordinates are given in intervals of 0.1 units. I read the data in from a text file using np.loadtxt().
I think Robert's post here explains why the problem exists: http://mail.scipy.org/pipermail/numpy-discussion/2007-June/028133.html However, even linspace shows roundoff error: a=np.linspace(0.0,10.0,endpoint=False) b=np.linspace(0.1,10.1,endpoint=False) np.sum(a[1:]==b[:-1]) # Gives me 72, no 100 What is the best way to deal with it? Multiply the intervals by 10, then convert them to ints? Thanks, Mike _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
