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, 3],

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 nu...@mspacek.mm.st 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

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 nu...@mspacek.mm.st 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

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

2010-08-06 Thread Vincent Davis
On Thu, Aug 5, 2010 at 2:55 PM, josef.p...@gmail.com wrote: On Thu, Aug 5, 2010 at 3:43 PM, Gökhan Sever gokhanse...@gmail.com 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

[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)

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

2010-08-06 Thread josef . pktd
On Fri, Aug 6, 2010 at 11:13 AM, Vincent Davis vinc...@vincentdavis.net wrote: On Thu, Aug 5, 2010 at 2:55 PM, josef.p...@gmail.com wrote: On Thu, Aug 5, 2010 at 3:43 PM, Gökhan Sever gokhanse...@gmail.com wrote: Hello, There is a nice e-mailing trend tool for Gmail users at 

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 n.bec...@amolf.nl 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,

Re: [Numpy-discussion] Installing numpy with MKL

2010-08-06 Thread Francesc Alted
2010/8/5, David Warde-Farley d...@cs.toronto.edu: 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

[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/numpy https://admin.fedoraproject.org/pkgdb/acls/name/scipy Thanks.

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

2010-08-06 Thread Vincent Davis
On Fri, Aug 6, 2010 at 10:16 AM, josef.p...@gmail.com wrote: On Fri, Aug 6, 2010 at 11:13 AM, Vincent Davis vinc...@vincentdavis.net wrote: On Thu, Aug 5, 2010 at 2:55 PM, josef.p...@gmail.com wrote: On Thu, Aug 5, 2010 at 3:43 PM, Gökhan Sever gokhanse...@gmail.com wrote: Hello,

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 missing; it

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 I just

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 n.bec...@amolf.nl 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] 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, if I try and