Thank you all for your suggestions. I ended up multiplying by 10 and rounding, while casting the array to an int. Certainly not the most universal solution, but it worked for my data.
code, for anyone searching for examples: np.array(np.round((hlspec[:,0]-offset)*10),dtype=np.int) -Mike On Sun, Mar 28, 2010 at 12:44 PM, Friedrich Romstedt <[email protected]> wrote: > 2010/3/28 Mike Sarahan <[email protected]>: >> 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 don't know your problem well enough, so the suggestion to use > numpy.interp() is maybe not more than a useless shot in the dark? > > http://docs.scipy.org/doc/numpy/reference/generated/numpy.interp.html#numpy.interp > > Friedrich > _______________________________________________ > NumPy-Discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion > _______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
