[Numpy-discussion] somewhat less stupid problem with 0-d arrays

2013-05-10 Thread Neal Becker
It would be convenient if in arithmetic 0-d arrays were just ignored - it would seem to me to be convenient in generic code where a degenerate array is treated as "nothing" np.zeros ((0,0)) + np.ones ((2,2)) --- ValueError

Re: [Numpy-discussion] 0-dim arrays inconsistency

2013-05-10 Thread Neal Becker
Neal Becker wrote: > np.array ((0,0)) > Out[10]: array([0, 0]) <<< ok, it's 2 dimensional > > In [11]: np.array ((0,0)).shape > Out[11]: (2,) <<< except, it isn't Sorry for the stupid question - please ignore ___ NumPy-Discussion mailing list NumPy-

Re: [Numpy-discussion] 0-dim arrays inconsistency

2013-05-10 Thread Nathaniel Smith
Hi Neal, On Fri, May 10, 2013 at 7:36 PM, Neal Becker wrote: > np.array ((0,0)) > Out[10]: array([0, 0]) <<< ok, it's 2 dimensional Think you may have confused yourself :-). It's 1 dimensional with 2 elements... > In [11]: np.array ((0,0)).shape > Out[11]: (2,) <<< except, it isn't ...as per

[Numpy-discussion] 0-dim arrays inconsistency

2013-05-10 Thread Neal Becker
np.array ((0,0)) Out[10]: array([0, 0]) <<< ok, it's 2 dimensional In [11]: np.array ((0,0)).shape Out[11]: (2,) <<< except, it isn't ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] tests not running

2013-05-10 Thread Ralf Gommers
On Fri, May 10, 2013 at 9:41 PM, KACVINSKY Tom wrote: > Here is my set up: > > Mac OS 10.7.5 > Xcode 4.5.1 > Intel Fortran 12.1 > Python 2.7.3 built from source > Numpy 1.6.2 built from source, using MKL 11.0 > nose 0.11.4 installed > > I run the numpy tests as documented (python -c 'import numpy;

Re: [Numpy-discussion] __array_priority__ don't work for gt, lt, ... operator

2013-05-10 Thread Frédéric Bastien
thanks, I'll look at it. I made a PR: https://github.com/numpy/numpy/pull/3324 Where should I put the tests about this? thanks Fred On Fri, May 10, 2013 at 4:03 PM, Sebastian Berg wrote: > On Fri, 2013-05-10 at 15:35 -0400, Frédéric Bastien wrote: > > I'm trying to do it, but each time I wan

Re: [Numpy-discussion] __array_priority__ don't work for gt, lt, ... operator

2013-05-10 Thread Sebastian Berg
On Fri, 2013-05-10 at 15:35 -0400, Frédéric Bastien wrote: > I'm trying to do it, but each time I want to test something, it takes > a long time to rebuild numpy to test it. Is there a way to don't > recompile everything for each test? > Are you using current master? It defaults to use ENABLE_SEPA

[Numpy-discussion] tests not running

2013-05-10 Thread KACVINSKY Tom
Here is my set up: Mac OS 10.7.5 Xcode 4.5.1 Intel Fortran 12.1 Python 2.7.3 built from source Numpy 1.6.2 built from source, using MKL 11.0 nose 0.11.4 installed I run the numpy tests as documented (python -c 'import numpy; numpy.test()'), but get this output: tkacvins@macomsim> python -c 'imp

Re: [Numpy-discussion] __array_priority__ don't work for gt, lt, ... operator

2013-05-10 Thread Frédéric Bastien
I'm trying to do it, but each time I want to test something, it takes a long time to rebuild numpy to test it. Is there a way to don't recompile everything for each test? thanks Fred On Fri, May 10, 2013 at 1:34 PM, Charles R Harris wrote: > > > On Fri, May 10, 2013 at 10:08 AM, Frédéric Bast

Re: [Numpy-discussion] __array_priority__ don't work for gt, lt, ... operator

2013-05-10 Thread Charles R Harris
On Fri, May 10, 2013 at 10:08 AM, Frédéric Bastien wrote: > Hi, > > it popped again on the Theano mailing list that this don't work: > > np.arange(10) <= a_theano_vector. > > The reason is that __array_priority__ isn't respected for that class of > operation. > > This page explain the problem and

Re: [Numpy-discussion] pyhdf packaging

2013-05-10 Thread Arnaldo Russo
Hi Andreas, This packaging would be much useful! How can I help with this? pyhdf is very important because HDF4-EOS does not open with another packages, only with pyhdf and gdal. best, Arnaldo --- *Arnaldo D'Amaral Pereira Granja Russo* Lab. de Estudos dos Oceanos e Clima Instituto de Oceanograf

[Numpy-discussion] __array_priority__ don't work for gt, lt, ... operator

2013-05-10 Thread Frédéric Bastien
Hi, it popped again on the Theano mailing list that this don't work: np.arange(10) <= a_theano_vector. The reason is that __array_priority__ isn't respected for that class of operation. This page explain the problem and give a work around: http://stackoverflow.com/questions/14619449/how-can-i-

Re: [Numpy-discussion] Name change of the ptp() function

2013-05-10 Thread Daπid
On May 10, 2013 3:18 PM, "Robert Kern" wrote: > Sure, it's probably more readable I am not sure of it. I would have to check the docs to see what it means. The mathematical term is range, but it already has a meaning in Python, so it is not a good way to go, being perhaps valuerange the compromi

Re: [Numpy-discussion] Name change of the ptp() function

2013-05-10 Thread David Cournapeau
On Fri, May 10, 2013 at 2:27 PM, Ralf Gommers wrote: > > > > On Fri, May 10, 2013 at 3:17 PM, Robert Kern wrote: >> >> On Fri, May 10, 2013 at 2:04 PM, Eli Bressert wrote: >> > That's a good point regarding the range function names. But, I think >> > the issue still stands on the readability of

Re: [Numpy-discussion] printing array in tabular form

2013-05-10 Thread Derek Homeier
On 10.05.2013, at 2:51PM, Daniele Nicolodi wrote: > If you wish to format numpy arrays preceding them with a variable name, > the following is a possible solution that gives the same formatting as > in your example: > > import numpy as np > import sys > > def format(out, v, name): >header =

Re: [Numpy-discussion] Name change of the ptp() function

2013-05-10 Thread Ralf Gommers
On Fri, May 10, 2013 at 3:17 PM, Robert Kern wrote: > On Fri, May 10, 2013 at 2:04 PM, Eli Bressert wrote: > > That's a good point regarding the range function names. But, I think > > the issue still stands on the readability of the ptp function. > > Regarding PEP20 it's stated that "readability

Re: [Numpy-discussion] Name change of the ptp() function

2013-05-10 Thread Robert Kern
On Fri, May 10, 2013 at 2:04 PM, Eli Bressert wrote: > That's a good point regarding the range function names. But, I think > the issue still stands on the readability of the ptp function. > Regarding PEP20 it's stated that "readability counts." > > If you regard what ptp is supposed to replace, a

Re: [Numpy-discussion] Name change of the ptp() function

2013-05-10 Thread Pauli Virtanen
10.05.2013 16:04, Eli Bressert kirjoitti: > That's a good point regarding the range function names. But, I think > the issue still stands on the readability of the ptp function. > Regarding PEP20 it's stated that "readability counts." I think here it has to be kept in mind that this function has b

Re: [Numpy-discussion] Name change of the ptp() function

2013-05-10 Thread Eli Bressert
That's a good point regarding the range function names. But, I think the issue still stands on the readability of the ptp function. Regarding PEP20 it's stated that "readability counts." If you regard what ptp is supposed to replace, array.max() - array.min(), the aforementioned follows the PEP20

Re: [Numpy-discussion] printing array in tabular form

2013-05-10 Thread Daniele Nicolodi
On 10/05/2013 13:20, Sudheer Joseph wrote: > Hi, > I am trying to learn Python after feeling its utility in coding and > also reading a bit aboutits potential only, please do not put words > in to my mouth like below. I didn't put words in your mouth, I simply quoted emails you sent to the list a

Re: [Numpy-discussion] printing array in tabular form

2013-05-10 Thread Jonathan Slavin
Sudheer, This is not really numpy specific. There are many options for output formatting in python. For the specific question you have, you could do: print '{0}{1:8.3f}{2:8.3f}{3:8.3f}{4:8.3f}{5:8.3f}'.format(s,x1,x2,x3,x4,x5) format is a built-in python string method (see python docs). The on

Re: [Numpy-discussion] Name change of the ptp() function

2013-05-10 Thread Pauli Virtanen
10.05.2013 08:47, Eli Bressert kirjoitti: [clip: renaming ptp] > valuerange() appears to the best most favored one. range(), arange(), valuerange() I'm not really a big fan of changing the name of this function at this stage, as it seems to me that whether it's a gain or not is somewhat a matter

Re: [Numpy-discussion] printing array in tabular form

2013-05-10 Thread Derek Homeier
On 10.05.2013, at 1:20PM, Sudheer Joseph wrote: > If some one has a quick way I would like to learn from them or get a > referecence > where the formatting part is described which was > my intention while posting here. As I have been using fortran I just tried > to use it to explain my requir

Re: [Numpy-discussion] printing array in tabular form

2013-05-10 Thread Henry Gomersall
On Fri, 2013-05-10 at 17:14 +0800, Sudheer Joseph wrote: > Thank you, > But I was looking for a format statement likw > write(*,"(A,5F8.3)") > with best regards, > Sudheer How about the following: print('IL = ' + (('%d,' * 5)[:-1] + '\n ') * 5 % tuple(IL)) If instead of a list

Re: [Numpy-discussion] printing array in tabular form

2013-05-10 Thread Sudheer Joseph
Hi,    I am trying to learn Python after feeling its utility in coding  and also reading a bit about its potential only, please do not put words in to my mouth like below. >> Before denigrating a programming language If some one has a quick way I would like to learn from them or get a refer

[Numpy-discussion] Scalar output from sub-classed Numpy array

2013-05-10 Thread Thomas Robitaille
Hi everyone, I am currently trying to write a sub-class of Numpy ndarray, but am running into issues for functions that return scalar results rather than array results. For example, in the following case: import numpy as np class TestClass(np.ndarray): def __new__(cls, input_arr

Re: [Numpy-discussion] printing array in tabular form

2013-05-10 Thread Daniele Nicolodi
On 10/05/2013 11:14, Sudheer Joseph wrote: > However writing a formatted out put looks to be bit tricky with > python relative to other programing languages. ... > I was looking for a format statement likw write(*,"(A,5F8.3)") Before denigrating a programming language I would make sure to have

Re: [Numpy-discussion] printing array in tabular form

2013-05-10 Thread Sudheer Joseph
Thank you,   But I was looking for  a format statement likw write(*,"(A,5F8.3)") with best regards, Sudheer   *** Sudheer Joseph Indian National Centre for Ocean Information Services Ministry of Earth Sciences, Govt. of Indi

Re: [Numpy-discussion] printing array in tabular form

2013-05-10 Thread Sudheer Joseph
Thank you for the response, Infact the program which should read this file requires it in specified format which should look like IL = 1,2,3,4,5 1,2,3,4,5 1,2,3,4,5   JL = 1,2,3,4,5 1,2,3,4,5 1,2,3,4,5 so, what I followed from the mail was that np.savet