[Numpy-discussion] Failure with 1.3

2009-05-27 Thread Matthieu Brucher
Hi, I've just tested the latest numpy with my new configuration (Opteron 2220, 64bits with RH5.2, compiled with ICC 10.1.018) and I got this failure. == FAIL: test_umath.TestLogAddExp2.test_logaddexp2_values [...]

Re: [Numpy-discussion] Failure with 1.3

2009-05-27 Thread Charles R Harris
On Wed, May 27, 2009 at 7:51 AM, Matthieu Brucher matthieu.bruc...@gmail.com wrote: Hi, I've just tested the latest numpy with my new configuration (Opteron 2220, 64bits with RH5.2, compiled with ICC 10.1.018) and I got this failure.

Re: [Numpy-discussion] casting bug

2009-05-27 Thread Charles سمير Doutriaux
Thanks Robert, I thought it was something like that but couldn't figure it out. C. On May 26, 2009, at 4:50 PM, Robert Kern wrote: 2009/5/26 Charles سمير Doutriaux doutria...@llnl.gov: Hi there, One of our users just found a bug in numpy that has to do with casting. Consider the

[Numpy-discussion] asarray() and PIL

2009-05-27 Thread cp
Hi, I'm using PIL for image processing, but lately I also try numpy for the flexibility and superior speed it offers. The first thing I noticed is that for an RGB image with height=1600 and width=1900 while img=Image.open('something.tif') img.size (1900,1600) then arr=asarray(img) arr.shape

Re: [Numpy-discussion] asarray() and PIL

2009-05-27 Thread Stéfan van der Walt
2009/5/27 cp lubensch.proletariat@gmail.com: img=Image.open('something.tif') img.size (1900,1600) then arr=asarray(img) arr.shape (1600,1900,3) This means that the array-image has 1600 color channels, 1900 image pixel rows and 3 image pixel columns. Why is that? No, it means that

Re: [Numpy-discussion] asarray() and PIL

2009-05-27 Thread Sebastian Haase
On Wed, May 27, 2009 at 5:12 PM, cp lubensch.proletariat@gmail.com wrote: Hi, I'm using PIL for image processing, but lately I also try numpy for the flexibility and superior speed it offers. The first thing I noticed is that for an RGB image with height=1600 and width=1900 while

Re: [Numpy-discussion] suggestion for generalizing numpy functions

2009-05-27 Thread Darren Dale
Now that numpy-1.3 has been released, I was hoping I could engage the numpy developers and community concerning my suggestion to improve the ufunc wrapping mechanism. Currently, ufuncs call, on the way out, the __array_wrap__ method of the input array with the highest __array_priority__. There

[Numpy-discussion] Benchmak on record arrays

2009-05-27 Thread Nicolas Rougier
Hi, I've written a very simple benchmark on recarrays: import numpy, time Z = numpy.zeros((100,100), dtype=numpy.float64) Z_fast = numpy.zeros((100,100), dtype=[('x',numpy.float64), ('y',numpy.int32)]) Z_slow = numpy.zeros((100,100), dtype=[('x',numpy.float64), ('y',numpy.bool)]) t =

[Numpy-discussion] Numpy vs PIL in image statistics

2009-05-27 Thread cp
Testing the PIL vs numpy in calculating the mean value of each color channel of an image I timed the following. impil = Image.open(10.tif) imnum = asarray(impil) #in PIL for i in range(1,10): stats = ImageStat.Stat(impil) stats.mean # for numpy for i in range(1,10):

Re: [Numpy-discussion] asarray() and PIL

2009-05-27 Thread cp
arr=asarray(img) arr.shape (1600,1900,3) No, it means that you have 1600 rows, 1900 columns and 3 colour channels. According to scipy documentation at http://pages.physics.cornell.edu/~myers/teaching/ComputationalMethods/python/arrays.html you are right. In this case I import numpy where

Re: [Numpy-discussion] Benchmak on record arrays

2009-05-27 Thread Charles R Harris
On Wed, May 27, 2009 at 9:31 AM, Nicolas Rougier nicolas.roug...@loria.frwrote: Hi, I've written a very simple benchmark on recarrays: import numpy, time Z = numpy.zeros((100,100), dtype=numpy.float64) Z_fast = numpy.zeros((100,100), dtype=[('x',numpy.float64), ('y',numpy.int32)])

Re: [Numpy-discussion] asarray() and PIL

2009-05-27 Thread Christopher Barker
cp wrote: arr=asarray(img) arr.shape (1600,1900,3) No, it means that you have 1600 rows, 1900 columns and 3 colour channels. According to scipy documentation at http://pages.physics.cornell.edu/~myers/teaching/ComputationalMethods/python/arrays.html you are right. In this case I

Re: [Numpy-discussion] Benchmak on record arrays

2009-05-27 Thread Nicolas Rougier
No, I don't have permission to edit. Nicolas On 27 May, 2009, at 18:01 , Charles R Harris wrote: On Wed, May 27, 2009 at 9:31 AM, Nicolas Rougier nicolas.roug...@loria.fr wrote: Hi, I've written a very simple benchmark on recarrays: import numpy, time Z = numpy.zeros((100,100),

[Numpy-discussion] arrray/matrix nonzero() type

2009-05-27 Thread Nicolas Rougier
Hi again, I have a problem with the nonzero() function for matrix. The following test program: import numpy, scipy.sparse Z = numpy.zeros((10,10)) Z[0,0] = Z[1,1] = 1 i = Z.nonzero() print i Zc = scipy.sparse.coo_matrix((Z[i],i)) Z = numpy.matrix(Z) i = Z.nonzero() print i Zc =

Re: [Numpy-discussion] arrray/matrix nonzero() type

2009-05-27 Thread Nathan Bell
On Wed, May 27, 2009 at 3:26 PM, Nicolas Rougier nicolas.roug...@loria.fr wrote: Hi again, I  have a problem with the nonzero() function for matrix. The following test program: import numpy, scipy.sparse Z = numpy.zeros((10,10)) i = Z.nonzero() print i Zc =

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Pierre GM
On May 27, 2009, at 5:53 PM, Fernando Perez wrote: Howdy, I'm wondering if the code below illustrates a bug in loadtxt, or just a 'live with it' limitation. Have you tried np.lib.io.genfromtxt ? dt = dtype(dict(names=['name','x','y','block'],

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Fernando Perez
Hi Pierre, On Wed, May 27, 2009 at 3:01 PM, Pierre GM pgmdevl...@gmail.com wrote: Have you tried np.lib.io.genfromtxt ? I didn't know about it, but it has the same problem as loadtxt: In [5]: rdata.block[0,1] # incorrect Out[5]: array([1, 1, 1]) In [6]: alt_data.block[0,1] # same thing,

Re: [Numpy-discussion] Numpy vs PIL in image statistics

2009-05-27 Thread Robert Kern
On Wed, May 27, 2009 at 10:33, cp lubensch.proletariat@gmail.com wrote: Testing the PIL vs numpy in calculating the mean value of each color channel of an image I timed the following. impil = Image.open(10.tif) imnum = asarray(impil) #in PIL for i in range(1,10):    stats =

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Stéfan van der Walt
Hi Fernando 2009/5/27 Fernando Perez fperez@gmail.com: I'm wondering if the code below illustrates a bug in loadtxt, or just a 'live with it' limitation. I'm not sure whether this is a bug or not. By specifying the dtype dt = dtype(dict(names=['name','x','y','block'],

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Pierre GM
On May 27, 2009, at 6:15 PM, Fernando Perez wrote: Hi Pierre, On Wed, May 27, 2009 at 3:01 PM, Pierre GM pgmdevl...@gmail.com wrote: Have you tried np.lib.io.genfromtxt ? I didn't know about it, but it has the same problem as loadtxt: Oh yes indeed. Yet another case of

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Fernando Perez
Hi Stefan, 2009/5/27 Stéfan van der Walt ste...@sun.ac.za: Hi Fernando 2009/5/27 Fernando Perez fperez@gmail.com: I'm wondering if the code below illustrates a bug in loadtxt, or just a 'live with it' limitation. I'm not sure whether this is a bug or not. By specifying the dtype dt

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Fernando Perez
Hi Pierre, On Wed, May 27, 2009 at 4:03 PM, Pierre GM pgmdevl...@gmail.com wrote: Oh yes indeed. Yet another case of I-opened-my-mouth-too-soon'... OK, so there's a trick. Kinda: * Define a specific converter: Thanks, that's an alternative, though I think I prefer my two-pass hack, though I

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Pierre GM
On May 27, 2009, at 7:10 PM, Fernando Perez wrote: Hi Pierre, On Wed, May 27, 2009 at 4:03 PM, Pierre GM pgmdevl...@gmail.com wrote: Oh yes indeed. Yet another case of I-opened-my-mouth-too-soon'... OK, so there's a trick. Kinda: * Define a specific converter: Thanks, that's an

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Stéfan van der Walt
Hi Fernando 2009/5/28 Fernando Perez fperez@gmail.com: Well, since dtypes allow for nesting full arrays in this fashion, where I can say that the 'block' field can have (2,3) shape, it seems like it would be nice to be able to express this nesting into loading of plain text files as well.

Re: [Numpy-discussion] Nested recarrays with subarrays and loadtxt: a bug in loadtxt?

2009-05-27 Thread Fernando Perez
2009/5/27 Stéfan van der Walt ste...@sun.ac.za: Hi Fernando 2009/5/28 Fernando Perez fperez@gmail.com: Well, since dtypes allow for nesting full arrays in this fashion, where I can say that the 'block' field can have (2,3) shape, it seems like it would be nice to be able to express this

Re: [Numpy-discussion] Benchmak on record arrays

2009-05-27 Thread Charles R Harris
On Wed, May 27, 2009 at 1:21 PM, Nicolas Rougier nicolas.roug...@loria.frwrote: No, I don't have permission to edit. Nicolas You should ask for it then. Email stephan at ste...@sun.ac.za. The docs are here http://docs.scipy.org/numpy/Front%20Page/. Chuck