Re: [Numpy-discussion] how to pipe into numpy arrays?

2012-10-24 Thread Dag Sverre Seljebotn
On 10/25/2012 08:17 AM, Dag Sverre Seljebotn wrote: > On 10/24/2012 09:00 PM, Michael Aye wrote: >> As numpy.fromfile seems to require full file object functionalities >> like seek, I can not use it with the sys.stdin pipe. >> So how could I stream a binary pipe directly into numpy? >> I can imagin

Re: [Numpy-discussion] how to pipe into numpy arrays?

2012-10-24 Thread Dag Sverre Seljebotn
On 10/24/2012 09:00 PM, Michael Aye wrote: > As numpy.fromfile seems to require full file object functionalities > like seek, I can not use it with the sys.stdin pipe. > So how could I stream a binary pipe directly into numpy? > I can imagine storing the data in a string and use StringIO but the >

Re: [Numpy-discussion] error of install numpy on linux redhat.

2012-10-24 Thread Ralf Gommers
On Thu, Oct 25, 2012 at 6:01 AM, Jack Bryan wrote: > Hi, All, > > I am trying to install numpy from http://www.scipy.org/Download . > > by > > git clone git://github.com/numpy/numpy.git numpy > > > But, when I ran > > python setup.py install > > I got: > > SystemError: Cannot compile 'Python.h'

[Numpy-discussion] error of install numpy on linux redhat.

2012-10-24 Thread Jack Bryan
Hi, All, I am trying to install numpy from http://www.scipy.org/Download . by git clone git://github.com/numpy/numpy.git numpy But, when I ran python setup.py install I got: SystemError: Cannot compile 'Python.h'. Perhaps you need to install python-dev|python-devel Where to get python-dev ?

Re: [Numpy-discussion] Is there a way to reset an accumulate function?

2012-10-24 Thread Cera, Tim
On Wed, Oct 24, 2012 at 4:47 AM, Robert Kern wrote: > How about this? > > > def nancumsum(x): > nans = np.isnan(x) > x = np.array(x) > x[nans] = 0 > reset_idx = np.zeros(len(x), dtype=int) > reset_idx[nans] = np.arange(len(x))[nans] > reset_idx = np.maximum.accumulate(rese

Re: [Numpy-discussion] how to pipe into numpy arrays?

2012-10-24 Thread Benjamin Root
On Wed, Oct 24, 2012 at 3:00 PM, Michael Aye wrote: > As numpy.fromfile seems to require full file object functionalities > like seek, I can not use it with the sys.stdin pipe. > So how could I stream a binary pipe directly into numpy? > I can imagine storing the data in a string and use StringIO

[Numpy-discussion] how to pipe into numpy arrays?

2012-10-24 Thread Michael Aye
As numpy.fromfile seems to require full file object functionalities like seek, I can not use it with the sys.stdin pipe. So how could I stream a binary pipe directly into numpy? I can imagine storing the data in a string and use StringIO but the files are 3.6 GB large, just the binary, and that w

Re: [Numpy-discussion] np.linalg.lstsq with several columns all 0 => huge x ?

2012-10-24 Thread josef . pktd
On Wed, Oct 24, 2012 at 1:33 PM, denis wrote: > Folks, >np.linalg.lstsq of a random-uniform A 50 x 32 with 3 columns all 0 > returns x[:3] 0 as expected, > but 4 columns all 0 => huge x: > lstsq (50, 32) with 4 columns all 0: > [ -3.7e+09 -3.6e+13 -1.9e+13 -2.9e+12 7.3e-01 ... > > Thi

[Numpy-discussion] np.linalg.lstsq with several columns all 0 => huge x ?

2012-10-24 Thread denis
Folks, np.linalg.lstsq of a random-uniform A 50 x 32 with 3 columns all 0 returns x[:3] 0 as expected, but 4 columns all 0 => huge x: lstsq (50, 32) with 4 columns all 0: [ -3.7e+09 -3.6e+13 -1.9e+13 -2.9e+12 7.3e-01 ... This may be a roundoff problem, or even a Mac Altivec lapack bug,

[Numpy-discussion] einsum slow vs (tensor)dot

2012-10-24 Thread George Nurser
Hi, I was just looking at the einsum function. To me, it's a really elegant and clear way of doing array operations, which is the core of what numpy is about. It removes the need to remember a range of functions, some of which I find tricky (e.g. tile). Unfortunately the present implementation se

Re: [Numpy-discussion] Is there a way to reset an accumulate function?

2012-10-24 Thread Robert Kern
On Tue, Oct 23, 2012 at 6:11 PM, Cera, Tim wrote: > I have an array that is peppered throughout in random spots with 'nan'. I > would like to use 'cumsum', but I want it to reset the accumulation to 0 > whenever a 'nan' is encountered. Is there a way to do this? Aside from a > loop - which is w