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 India

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 a

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

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

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

2013-05-10 Thread Derek Homeier
On 10.05.2013, at 1:20PM, Sudheer Joseph sudheer.jos...@yahoo.com 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

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

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 and

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] 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 been

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 ebress...@gmail.com 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

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 robert.k...@gmail.com wrote: On Fri, May 10, 2013 at 2:04 PM, Eli Bressert ebress...@gmail.com 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

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

2013-05-10 Thread Derek Homeier
On 10.05.2013, at 2:51PM, Daniele Nicolodi dani...@grinta.net 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):

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 ralf.gomm...@gmail.com wrote: On Fri, May 10, 2013 at 3:17 PM, Robert Kern robert.k...@gmail.com wrote: On Fri, May 10, 2013 at 2:04 PM, Eli Bressert ebress...@gmail.com wrote: That's a good point regarding the range function names. But, 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 robert.k...@gmail.com 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

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

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 charlesr.har...@gmail.com wrote: On Fri, May 10, 2013 at

[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

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

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 sebast...@sipsolutions.netwrote: On Fri, 2013-05-10 at 15:35 -0400, Frédéric Bastien wrote: I'm trying to do

Re: [Numpy-discussion] tests not running

2013-05-10 Thread Ralf Gommers
On Fri, May 10, 2013 at 9:41 PM, KACVINSKY Tom tom.kacvin...@3ds.comwrote: 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

[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] 0-dim arrays inconsistency

2013-05-10 Thread Nathaniel Smith
Hi Neal, On Fri, May 10, 2013 at 7:36 PM, Neal Becker ndbeck...@gmail.com 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

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