Re: [Numpy-discussion] dtype.type for structured arrays

2010-08-06 Thread Travis Oliphant
On Jul 24, 2010, at 2:42 PM, Thomas Robitaille wrote: > Hi, > > If I create a structured array with vector columns: > array = np.array(zip([[1,2],[1,2],[1,3]]),dtype=[('a',float,2)]) > > then examine the type of the column, I get: > array.dtype[0] > dtype(('float64',(2,))) > > Then

Re: [Numpy-discussion] numpy histogram normed=True (bug / confusing behavior)

2010-08-06 Thread josef . pktd
On Fri, Aug 6, 2010 at 4:53 PM, Nils Becker wrote: > Hi again, > > first a correction: I posted > >> I believe np.histogram(data, bins, normed=True) effectively does : np.histogram(data, bins, normed=False) / (bins[-1] - bins[0]). However, it _should_ do np.histogram(data, bins

Re: [Numpy-discussion] use index array of len n to select columns of n x m array

2010-08-06 Thread Martin Spacek
On 2010-08-06 13:11, Martin Spacek wrote: > Josef, I'd forgotten you could use None to increase the dimensionality of an > array. Neat. And, somehow, it's almost twice as fast as the Cython version!: > > >>> timeit a[np.arange(a.shape[0])[:, None], i] > 10 loops, best of 3: 5.76 us per loop

Re: [Numpy-discussion] numpy histogram normed=True (bug / confusing behavior)

2010-08-06 Thread Nils Becker
Hi again, first a correction: I posted > I believe np.histogram(data, bins, normed=True) effectively does : >>> np.histogram(data, bins, normed=False) / (bins[-1] - bins[0]). >>> >>> However, it _should_ do >>> np.histogram(data, bins, normed=False) / bins_widths but there is a normalization mis

Re: [Numpy-discussion] use index array of len n to select columns of n x m array

2010-08-06 Thread Martin Spacek
On 2010-08-06 06:57, Keith Goodman wrote: > You can speed it up by getting rid of two copies: > > idx = np.arange(a.shape[0]) > idx *= a.shape[1] > idx += i Keith, you're right of course. I'd forgotten about your earlier suggestion about operating in-place. Here's my new version: def rowta

Re: [Numpy-discussion] {OT} Mailing trends

2010-08-06 Thread Vincent Davis
On Fri, Aug 6, 2010 at 10:16 AM, wrote: > On Fri, Aug 6, 2010 at 11:13 AM, Vincent Davis > wrote: > > > > On Thu, Aug 5, 2010 at 2:55 PM, wrote: > >> > >> On Thu, Aug 5, 2010 at 3:43 PM, Gökhan Sever > wrote: > >> > Hello, > >> > There is a nice e-mailing trend tool for Gmail users > >> > at h

[Numpy-discussion] Broken links on new.scipy

2010-08-06 Thread Gökhan Sever
Hi, @ http://new.scipy.org/download.html numpy and scipy links for Fedora is broken. Could you update the links with these? https://admin.fedoraproject.org/pkgdb/acls/name/numpy https://admin.fedoraproject.org/pkgdb/acls/name/scipy Thanks

Re: [Numpy-discussion] numpy histogram normed=True (bug / confusing behavior)

2010-08-06 Thread Bruce Southey
On 08/06/2010 11:37 AM, josef.p...@gmail.com wrote: On Fri, Aug 6, 2010 at 11:46 AM, Nils Becker wrote: Hi, I found what looks like a bug in histogram, when the option normed=True is used together with non-uniform bins. Consider this example: import numpy as np data = np.array([1, 2, 3, 4])

Re: [Numpy-discussion] Installing numpy with MKL

2010-08-06 Thread Francesc Alted
2010/8/5, David Warde-Farley : > I've been having a similar problem compiling NumPy with MKL on a cluster > with a site-wide license. Dag's site.cfg fails to config if I use 'iomp5' in > it, since (at least with this version, 11.1) libiomp5 is located in > > /scinet/gpc/intel/Compiler/11.1/07

Re: [Numpy-discussion] numpy histogram normed=True (bug / confusing behavior)

2010-08-06 Thread josef . pktd
On Fri, Aug 6, 2010 at 11:46 AM, Nils Becker wrote: > Hi, > > I found what looks like a bug in histogram, when the option normed=True > is used together with non-uniform bins. > > Consider this example: > > import numpy as np > data = np.array([1, 2, 3, 4]) > bins = np.array([.5, 1.5, 4.5]) > bin_

Re: [Numpy-discussion] {OT} Mailing trends

2010-08-06 Thread josef . pktd
On Fri, Aug 6, 2010 at 11:13 AM, Vincent Davis wrote: > > On Thu, Aug 5, 2010 at 2:55 PM, wrote: >> >> On Thu, Aug 5, 2010 at 3:43 PM, Gökhan Sever wrote: >> > Hello, >> > There is a nice e-mailing trend tool for Gmail users >> > at http://code.google.com/p/mail-trends/ >> > It is a command line

[Numpy-discussion] numpy histogram normed=True (bug / confusing behavior)

2010-08-06 Thread Nils Becker
Hi, I found what looks like a bug in histogram, when the option normed=True is used together with non-uniform bins. Consider this example: import numpy as np data = np.array([1, 2, 3, 4]) bins = np.array([.5, 1.5, 4.5]) bin_widths = np.diff(bins) (counts, dummy) = np.histogram(data, bins) (densi

Re: [Numpy-discussion] {OT} Mailing trends

2010-08-06 Thread Vincent Davis
On Thu, Aug 5, 2010 at 2:55 PM, wrote: > On Thu, Aug 5, 2010 at 3:43 PM, Gökhan Sever > wrote: > > Hello, > > There is a nice e-mailing trend tool for Gmail users > > at http://code.google.com/p/mail-trends/ > > It is a command line tool producing an html output showing your e-mailing > > statis

Re: [Numpy-discussion] use index array of len n to select columns of n x m array

2010-08-06 Thread Keith Goodman
On Fri, Aug 6, 2010 at 3:01 AM, Martin Spacek wrote: > Keith Goodman wrote: >  > Here's one way: >  > >  >>> a.flat[i + a.shape[1] * np.arange(a.shape[0])] >  >     array([0, 3, 5, 6, 9]) > > > I'm afraid I made my example a little too simple. In retrospect, what I really > want is to be able to u

Re: [Numpy-discussion] use index array of len n to select columns of n x m array

2010-08-06 Thread josef . pktd
On Fri, Aug 6, 2010 at 6:01 AM, Martin Spacek wrote: > Keith Goodman wrote: >  > Here's one way: >  > >  >>> a.flat[i + a.shape[1] * np.arange(a.shape[0])] >  >     array([0, 3, 5, 6, 9]) > > > I'm afraid I made my example a little too simple. In retrospect, what I really > want is to be able to u

Re: [Numpy-discussion] use index array of len n to select columns of n x m array

2010-08-06 Thread Martin Spacek
Keith Goodman wrote: > Here's one way: > >>> a.flat[i + a.shape[1] * np.arange(a.shape[0])] > array([0, 3, 5, 6, 9]) I'm afraid I made my example a little too simple. In retrospect, what I really want is to be able to use a 2D index array "i", like this: >>> a = np.array([[ 0, 1, 2,