Re: [Numpy-discussion] np.histogram on arrays.

2011-03-30 Thread Éric Depagne
Hi. Sorry for not having been clearer. I'll explain a little bit. I have 4k x 4k images that I want to analyse. I turn them into numpy arrays so I have 4k x 4k np.array. My analysis starts with determining the bias level. To do that, I compute for each line, and then for each row, an

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-30 Thread Thouis (Ray) Jones
How about something like this: # numpy 1.6 def rowhist(A, bins=100): assert (bins 0) assert isinstance(bins, int) rownum = np.arange(A.shape[0]).reshape((-1, 1)).astype(int) * bins intA = (bins * (A - A.min()) / float(A.max() - A.min())).astype(int) intA[intA == bins] = bins

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-30 Thread eat
Hi, On Wed, Mar 30, 2011 at 10:04 AM, Éric Depagne e...@depagne.org wrote: Hi. Sorry for not having been clearer. I'll explain a little bit. I have 4k x 4k images that I want to analyse. I turn them into numpy arrays so I have 4k x 4k np.array. My analysis starts with determining the

[Numpy-discussion] Question regarding concatenate/vstack.

2011-03-30 Thread andrew nelson
Dear List, I have a quick question regarding vstack and concatenate. In the docs for vstack it says that: np.concatenate(tup, axis=0) should be equivalent to: np.vstack(tup) However, I tried this out and it doesn't seem to be case, i.e. np.vstack((np.arange(5.), np.arange(5.))) array([[ 0.,

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-30 Thread Éric Depagne
Well I guess, for a slight performance improvement, you could create your own streamlined histogrammer. But, in order to better grasp your situation it would be beneficial to know how the counts and bounds are used later on. Just wondering if this kind massive histogramming could be

Re: [Numpy-discussion] Question regarding concatenate/vstack.

2011-03-30 Thread gary ruben
You're right, they are not equivalent. vstack will happily create an array of higher rank than the parts it is stacking, whereas concatenate requires the arrays it is working with to already be at least 2d, so the equivalent is np.concatenate((np.arange(5.)[newaxis],np.arange(5.)[newaxis]),

Re: [Numpy-discussion] Question regarding concatenate/vstack.

2011-03-30 Thread Ralf Gommers
On Wed, Mar 30, 2011 at 1:42 PM, gary ruben gru...@bigpond.net.au wrote: You're right, they are not equivalent. vstack will happily create an array of higher rank than the parts it is stacking, whereas concatenate requires the arrays it is working with to already be at least 2d, so the

Re: [Numpy-discussion] bug in genfromtxt for python 3.2

2011-03-30 Thread Ralf Gommers
On Wed, Mar 30, 2011 at 3:39 AM, Matthew Brett matthew.br...@gmail.com wrote: Hi, On Mon, Mar 28, 2011 at 11:29 PM,  josef.p...@gmail.com wrote: numpy/lib/test_io.py    only uses StringIO in the test, no actual csv file If I give the filename than I get a  TypeError: Can't convert 'bytes'

[Numpy-discussion] Warning: invalid value encountered in true_divide?

2011-03-30 Thread Joon Ro
Hi,After numpy upgrade, I started to get "Warning: invalid value encountered in true_divide," when I run a code which did now show any warningpreviously.What does it mean and where should I look to fix this? It does not stop my debugger so I could not identify where the message was from.Thank

Re: [Numpy-discussion] Warning: invalid value encountered in true_divide?

2011-03-30 Thread Robert Kern
On Wed, Mar 30, 2011 at 12:12, Joon Ro joonp...@gmail.com wrote: Hi, After numpy upgrade, I started to get Warning: invalid value encountered in true_divide, when I run a code which did now show any warning previously. What does it mean and where should I look to fix this? It means that a NaN

Re: [Numpy-discussion] bug in genfromtxt for python 3.2

2011-03-30 Thread Matthew Brett
Hi, On Wed, Mar 30, 2011 at 10:02 AM, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Wed, Mar 30, 2011 at 3:39 AM, Matthew Brett matthew.br...@gmail.com wrote: Hi, On Mon, Mar 28, 2011 at 11:29 PM,  josef.p...@gmail.com wrote: numpy/lib/test_io.py    only uses StringIO in the test, no

Re: [Numpy-discussion] bug in genfromtxt for python 3.2

2011-03-30 Thread Ralf Gommers
On Wed, Mar 30, 2011 at 7:37 PM, Matthew Brett matthew.br...@gmail.com wrote: Hi, On Wed, Mar 30, 2011 at 10:02 AM, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Wed, Mar 30, 2011 at 3:39 AM, Matthew Brett matthew.br...@gmail.com wrote: Hi, On Mon, Mar 28, 2011 at 11:29 PM,  

Re: [Numpy-discussion] bug in genfromtxt for python 3.2

2011-03-30 Thread Pauli Virtanen
On Wed, 30 Mar 2011 10:37:45 -0700, Matthew Brett wrote: [clip] imagine I'm working with a non-latin default encoding, and I've opened a file: fobj = open('my_nonlatin.txt', 'rt') in python 3.2. That might contain numbers and non-latin text. I can't pass that into 'genfromtxt' because

[Numpy-discussion] Old tickets

2011-03-30 Thread Bruce Southey
Hi, This followup on tickets that I had previously indicated. So I want to thank Mark, Ralph and any people for going over those! For those that I followed I generally agreed with the outcome. Ticket 301: 'Make power and divide return floats from int inputs (like true_divide)'

Re: [Numpy-discussion] bug in genfromtxt for python 3.2

2011-03-30 Thread Matthew Brett
Hi, On Wed, Mar 30, 2011 at 11:32 AM, Pauli Virtanen p...@iki.fi wrote: On Wed, 30 Mar 2011 10:37:45 -0700, Matthew Brett wrote: [clip] imagine I'm working with a non-latin default encoding, and I've opened a file: fobj = open('my_nonlatin.txt', 'rt') in python 3.2.  That might contain

Re: [Numpy-discussion] should get rid of the annoying numpy STDERR output

2011-03-30 Thread Ralf Gommers
On Thu, Mar 24, 2011 at 5:25 PM, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Thu, Mar 24, 2011 at 5:11 PM, Robert Kern robert.k...@gmail.com wrote: 2011/3/24 Dmitrey tm...@ukr.net: from numpy import inf, array inf*0 nan (ok) array(inf) * 0.0 StdErr: Warning: invalid value

Re: [Numpy-discussion] Old tickets

2011-03-30 Thread Benjamin Root
On Wed, Mar 30, 2011 at 2:37 PM, Bruce Southey bsout...@gmail.com wrote: Hi, This followup on tickets that I had previously indicated. So I want to thank Mark, Ralph and any people for going over those! For those that I followed I generally agreed with the outcome. Ticket 301: 'Make power

Re: [Numpy-discussion] Old tickets

2011-03-30 Thread Derek Homeier
On 30 Mar 2011, at 23:26, Benjamin Root wrote: Ticket 301: 'Make power and divide return floats from int inputs (like true_divide)' http://projects.scipy.org/numpy/ticket/301 Invalid because the output dtype is the same as the input dtype unless you override using the dtype argument:

Re: [Numpy-discussion] Old tickets

2011-03-30 Thread Derek Homeier
Hi, On 30 Mar 2011, at 21:37, Bruce Southey wrote: Ticket 1071: 'loadtxt fails if the last column contains empty value' http://projects.scipy.org/numpy/ticket/1071 Invalid mainly because loadtxt states that 'Each row in the text file must have the same number of values.' So of cause loadtxt

Re: [Numpy-discussion] should get rid of the annoying numpy STDERR output

2011-03-30 Thread Robert Kern
On Wed, Mar 30, 2011 at 16:03, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Thu, Mar 24, 2011 at 5:25 PM, Ralf Gommers ralf.gomm...@googlemail.com wrote: On Thu, Mar 24, 2011 at 5:11 PM, Robert Kern robert.k...@gmail.com wrote: We really should change the default to 'warn' for numpy

Re: [Numpy-discussion] 1.6.0b1 half float buffer bug?

2011-03-30 Thread Eli Stevens (Gmail)
On Fri, Mar 25, 2011 at 10:00 AM, Eli Stevens (Gmail) wickedg...@gmail.com wrote: Can anyone please give me some suggestions on how to go about writing a unit test for this?  Or should I just submit a pull request? I've gotten a bit of positive feedback to adding the 'e' type to the struct

Re: [Numpy-discussion] loadtxt/savetxt tickets

2011-03-30 Thread Charles R Harris
On Sun, Mar 27, 2011 at 4:09 AM, Paul Anton Letnes paul.anton.let...@gmail.com wrote: On 26. mars 2011, at 21.44, Derek Homeier wrote: Hi Paul, having had a look at the other tickets you dug up, My opinions are my own, and in detail, they are: 1752: I attach a possible patch.