Re: [Numpy-discussion] ndarray**maskedArray with broadcasting bug

2010-09-07 Thread Benjamin Root
On Fri, Sep 3, 2010 at 3:50 PM, Benjamin Root wrote: > Here is a fun one... > > import numpy as np > > a_2d = np.random.random((3, 5)) > b_1d = np.random.random(5) > b_2d = np.vstack((b_1d, b_1d, b_1d)) > > a_ma_2d = np.ma.masked_array(a_2d, mask=(numpy.random.random((3, 5)) < > 0.25)) > b_ma_1d

Re: [Numpy-discussion] clip() with None as argument

2010-09-07 Thread Robert Kern
On Tue, Sep 7, 2010 at 15:12, Friedrich Romstedt wrote: > Ah, no need to answer, I do this myself: > > Friedrich, would you please use numpy.inf and -numpy.inf. But if you have an integer array, you will run into the same problem. The result will be upcast to float. I think we would accept a patc

Re: [Numpy-discussion] Help with the tensordot function?

2010-09-07 Thread Rick Muller
Ondrej, I was confused an unclear in my original question. I subsequently posted a followup, titled "Simplified question on tensordot' where I explained myself a lot better, and got some really good help. So, thank you very much for looking into this issue, but I believe that this has been resolve

Re: [Numpy-discussion] clip() with None as argument

2010-09-07 Thread Friedrich Romstedt
Ah, no need to answer, I do this myself: Friedrich, would you please use numpy.inf and -numpy.inf. Thanks, and sorry for the noise, Friedrich ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discu

Re: [Numpy-discussion] Help with the tensordot function?

2010-09-07 Thread Ondrej Certik
On Tue, Sep 7, 2010 at 12:23 PM, Ondrej Certik wrote: > Hi Rick! > > On Fri, Sep 3, 2010 at 4:02 AM, Rick Muller wrote: >> Can someone help me replace a slow expression with a faster one based on >> tensordot? I've read the documentation and I'm still confused. >> >> I have two matrices b and d.

[Numpy-discussion] clip() with None as argument

2010-09-07 Thread Friedrich Romstedt
I just came across a problem with the intention to specify unset boundaries given to numpy.clip() or array.clip(): a.clip(1e-10, None) a.clip(None, -1e-10) When doing this, the returned array is dtype=numpy.object, seemingly None gets converted to a numpy.asarray(None, dtype=numpy.object), and th

Re: [Numpy-discussion] Inverting argsort(a, axis=0) to obtain column-wise ranks

2010-09-07 Thread Zachary Pincus
> indices = argsort(a1) > ranks = zeros_like(indices) > ranks[indices] = arange(len(indices)) Doesn't answer your original question directly, but I only recently learned from this list that the following does the same as the above: ranks = a1.argsort().argsort() Will wonders never cease... So d

[Numpy-discussion] Inverting argsort(a, axis=0) to obtain column-wise ranks

2010-09-07 Thread Alexander Michael
Calculating ranks by inverting the results of an argsort is straightforward and fast for 1D arrays: indices = argsort(a1) ranks = zeros_like(indices) ranks[indices] = arange(len(indices)) I was wondering if there was an equally pithy way to do this for multiple data samples stored column-wise in

Re: [Numpy-discussion] Help with the tensordot function?

2010-09-07 Thread Ondrej Certik
Hi Rick! On Fri, Sep 3, 2010 at 4:02 AM, Rick Muller wrote: > Can someone help me replace a slow expression with a faster one based on > tensordot? I've read the documentation and I'm still confused. > > I have two matrices b and d. b is n x m and d is m x m. I want to replace > the expression >

[Numpy-discussion] distutils

2010-09-07 Thread Charles Doutriaux
Hi, I'm using distutils to build extensions written in C. I noticed that lately (it seems to be python 2.7 related) whenever I touch 1 C file, ALL the C files are rebuilt. Since I have a lot of C code, it takes a lot of time for nothing. Any idea why this is happening? Do I need to set somethi

[Numpy-discussion] EPD Webinar: How to solve ODEs with SciPy

2010-09-07 Thread Amenity Applewhite
Enthought Python Distribution Webinar September 10 This Friday,Warren Weckesser will host the first of three webinars in a series on solving differential equations in Python. We will take a close look at the two tools available for solving ordinary differential equations in SciPy: the "odeint

Re: [Numpy-discussion] Pthreads ATLAS

2010-09-07 Thread Pauli Virtanen
Mon, 06 Sep 2010 15:03:50 -0400, Andreas Kloeckner wrote: [clip] > I gather that "pt" in the symbol name means that this is a > pthreads-accelerated version of dsyrk. How do I convey to numpy that I > don't have (nor want) Pthreads-accelerated ATLAS bits? Failing that, how > do I tell it to just no

Re: [Numpy-discussion] saving masked array to a text file

2010-09-07 Thread Guillaume Chérel
It works only if I can find a value belonging to the dtype of the array that is meaningless in the context of my data. For example, if it is only composed of positive integers, then I can fill the missing values with -1. But in my case, I would like to write a string (empty string, actually)