Re: [Numpy-discussion] Array indexing and repeated indices

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 08:30 +0100, Nicolas Rougier wrote: Hi, I'm trying to increment an array using indexing and a second array for increment values (since it might be a little tedious to explain, see below for a short example). Using direct indexing, the values in the example are

Re: [Numpy-discussion] Array indexing and repeated indices

2013-03-01 Thread Nicolas Rougier
bincount takes a weights argument which should do exactly what you are looking for. Fantastic ! Thanks ! Nicolas ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
Hi, there has been a request on the issue tracker for a step parameter to linspace. This is of course tricky with the imprecision of floating point numbers. As a trade off, I was thinking of a step parameter that is used to calculate the integer number of steps. However to be certain that it

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Henry Gomersall
On Fri, 2013-03-01 at 13:25 +0100, Sebastian Berg wrote: there has been a request on the issue tracker for a step parameter to linspace. This is of course tricky with the imprecision of floating point numbers. How is that different to arange? Either you specify the number of points with

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 12:33 +, Henry Gomersall wrote: On Fri, 2013-03-01 at 13:25 +0100, Sebastian Berg wrote: there has been a request on the issue tracker for a step parameter to linspace. This is of course tricky with the imprecision of floating point numbers. How is that

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Nathaniel Smith
On Fri, Mar 1, 2013 at 12:33 PM, Henry Gomersall h...@cantab.net wrote: On Fri, 2013-03-01 at 13:25 +0100, Sebastian Berg wrote: there has been a request on the issue tracker for a step parameter to linspace. This is of course tricky with the imprecision of floating point numbers. How is

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Henry Gomersall
On Fri, 2013-03-01 at 13:34 +, Nathaniel Smith wrote: My usual hack to deal with the numerical bounds issue is to add/subtract half the step. Right. Which is exactly the sort of annoying, content-free code that a library is supposed to handle for you, so you can save mental energy

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Warren Weckesser
On 3/1/13, Henry Gomersall h...@cantab.net wrote: On Fri, 2013-03-01 at 13:34 +, Nathaniel Smith wrote: My usual hack to deal with the numerical bounds issue is to add/subtract half the step. Right. Which is exactly the sort of annoying, content-free code that a library is supposed to

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Henry Gomersall
On Fri, 2013-03-01 at 09:24 -0500, Warren Weckesser wrote: In my jet-lag addled state, i can't see when this out[-1] stop case will occur, but I can take it as true. It does seem to be problematic though. Here you go: In [32]: end = 2.2 In [33]: x = arange(0.1, end, 0.3)

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 13:34 +, Nathaniel Smith wrote: On Fri, Mar 1, 2013 at 12:33 PM, Henry Gomersall h...@cantab.net wrote: On Fri, 2013-03-01 at 13:25 +0100, Sebastian Berg wrote: there has been a request on the issue tracker for a step parameter to linspace. This is of course tricky

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Alan G Isaac
On 3/1/2013 9:32 AM, Henry Gomersall wrote: there should be an equivalent for floats that unambiguously returns a range for the half open interval If I've understood you: start + stepsize*np.arange(nsteps) fwiw, Alan Isaac ___ NumPy-Discussion

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Henry Gomersall
On Fri, 2013-03-01 at 10:01 -0500, Alan G Isaac wrote: On 3/1/2013 9:32 AM, Henry Gomersall wrote: there should be an equivalent for floats that unambiguously returns a range for the half open interval If I've understood you: start + stepsize*np.arange(nsteps) yes, except that nsteps

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 15:07 +, Henry Gomersall wrote: On Fri, 2013-03-01 at 10:01 -0500, Alan G Isaac wrote: On 3/1/2013 9:32 AM, Henry Gomersall wrote: there should be an equivalent for floats that unambiguously returns a range for the half open interval If I've understood

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Alan G Isaac
One motivation of this thread was that adding a step parameter to linspace might make things easier for beginners. I claim this thread has put the lie to that, starting with the initial post. So what is the persuasive case for the change? Imo, the current situation is good: use arange if you

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Sebastian Berg
On Fri, 2013-03-01 at 10:49 -0500, Alan G Isaac wrote: One motivation of this thread was that adding a step parameter to linspace might make things easier for beginners. I claim this thread has put the lie to that, starting with the initial post. So what is the persuasive case for the

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Henry Gomersall
On Fri, 2013-03-01 at 17:29 +0100, Sebastian Berg wrote: At this time it seems there is more sentiment against it and that is fine with me. I thought it might be useful for some who normally want the linspace behavior, but do not want to worry about the right num in some cases. Someone who