Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-20 Thread A. M. Archibald
On 18/10/06, Travis Oliphant [EMAIL PROTECTED] wrote: If there are any cases satisfying these rules where a copy does not have to occur then let me know. For example, zeros((4,4))[:,1].reshape((2,2)) need not be copied. I filed a bug in trac and supplied a patch to multiarray.c that avoids

[Numpy-discussion] Numpy-scalars vs Numpy 0-d arrays: copy or not copy?

2006-10-20 Thread Sebastien Bardeau
Hi! I am confused with Numpy behavior with its scalar or 0-d arrays objects: numpy.__version__ '1.0rc2' a = numpy.array((1,2,3)) b = a[:2] b += 1 b array([2, 3]) a array([2, 3, 3]) type(b) type 'numpy.ndarray' To this point all is ok for me: subarrays share (by default) memory

[Numpy-discussion] いつでもどこで もイカす出会い天国

2006-10-20 Thread EAGF
中だし体験記!携帯番号ゲットで中だし・・・最高です! http://carmastorra.com/ika/ - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM

Re: [Numpy-discussion] Numpy-scalars vs Numpy 0-d arrays: copy or not copy?

2006-10-20 Thread Francesc Altet
A Divendres 20 Octubre 2006 11:42, Sebastien Bardeau va escriure: [snip] I can understand that numpy.scalars do not provide inplace operations (like Python standard scalars, they are immutable), so I'd like to use 0-d Numpy.ndarrays. But: d = numpy.array(a[2],copy=False) d += 1 d

Re: [Numpy-discussion] Can' compile numpy 1.02rc3 on OSX 10.3.9

2006-10-20 Thread Markus Rosenstihl
Am 20.10.2006 um 02:53 schrieb Jay Parlar: Hi! I try to compile numpy rc3 on Panther and get following errors. (I start build with python2.3 setup.py build to be sure to use the python shipped with OS X. I din't manage to compile Python2.5 either yet with similar errors) Does anynbody has

[Numpy-discussion] Helper function to unroll a array

2006-10-20 Thread Gael Varoquaux
Hi, There is an operation I do a lot, I would call it unrolling a array. The best way to describe it is probably to give the code: def unroll(M): Flattens the array M and returns a 2D array with the first columns being the indices of M, and the last column the flatten M.

Re: [Numpy-discussion] Numpy-scalars vs Numpy 0-d arrays: copy or not copy?

2006-10-20 Thread Stefan van der Walt
On Fri, Oct 20, 2006 at 11:42:26AM +0200, Sebastien Bardeau wrote: a = numpy.array((1,2,3)) b = a[:2] Here you index by a slice. c = a[2] Whereas here you index by a scalar. So you want to do b = a[[2]] b += 1 or in the general case b = a[slice(2,3)] b += 1 Regards Stéfan

Re: [Numpy-discussion] Numpy-scalars vs Numpy 0-d arrays: copy or not copy?

2006-10-20 Thread Tim Hochberg
Francesc Altet wrote: A Divendres 20 Octubre 2006 11:42, Sebastien Bardeau va escriure: [snip] I can understand that numpy.scalars do not provide inplace operations (like Python standard scalars, they are immutable), so I'd like to use 0-d Numpy.ndarrays. But: d =

Re: [Numpy-discussion] Numpy-scalars vs Numpy 0-d arrays: copy or not copy?

2006-10-20 Thread Sebastien Bardeau
Ooops sorry there was two mistakes with the 'hasslice' flag. This seems now to work for me. def __getitem__(self,index): # Index may be either an int or a tuple # Index length: if type(index) == int: # A single element through first dimension ilen = 1 index =

Re: [Numpy-discussion] histogram complete makeover

2006-10-20 Thread David Huard
Thanks for the comments, Here is the code for the new histogram, tests included. I'll wait for comments or suggestions before submitting a patch (numpy / scipy) ?CheersDavid 2006/10/18, Tim Hochberg [EMAIL PROTECTED]: My $0.02:If histogram is going to get a makeover, particularly one that makes

[Numpy-discussion] slicing suggestion

2006-10-20 Thread JJ
Hello. I have a suggestion that might make slicing using matrices more user-friendly. I often have a matrix of row or column numbers that I wish to use as a slice. If K was a matrix of row numbers (nx1) and M was a nxm matrix, then I would use ans = M[K.A.ravel(),:] to obtain the matrix I want.

[Numpy-discussion] Model and experiment fitting.

2006-10-20 Thread Sebastian Żurek
Hi! This is probably a silly question but I'm getting confused with a certain problem: a comparison between experimental data points (2D points set) and a model (2D points set - no analytical form). The physical model produces (by a sophisticated simulations done by an external program) some

Re: [Numpy-discussion] Model and experiment fitting.

2006-10-20 Thread Robert Kern
Sebastian Żurek wrote: Hi! This is probably a silly question but I'm getting confused with a certain problem: a comparison between experimental data points (2D points set) and a model (2D points set - no analytical form). The physical model produces (by a sophisticated simulations done

Re: [Numpy-discussion] Model and experiment fitting.

2006-10-20 Thread A. M. Archibald
On 20/10/06, Sebastian Żurek [EMAIL PROTECTED] wrote: Is there something like that in any numerical python modules (numpy, pylab) I could use? In scipy there are some very convenient spline fitting tools which will allow you to fit a nice smooth spline through the simulation data points (or

[Numpy-discussion] Problem introduced after 1.0rc2 on AIX with xlc

2006-10-20 Thread Brian Granger
Hi, i am running numpy on aix compiling with xlc. Revision 1.0rc2 works fine and passes all tests. But 1.0rc3 and more recent give the following on import: Warning: invalid value encountered in multiply Warning: invalid value encountered in multiply Warning: invalid value encountered in

Re: [Numpy-discussion] Problem introduced after 1.0rc2 on AIX with xlc

2006-10-20 Thread Tim Hochberg
Brian Granger wrote: Hi, i am running numpy on aix compiling with xlc. Revision 1.0rc2 works fine and passes all tests. But 1.0rc3 and more recent give the following on import: Warning: invalid value encountered in multiply Warning: invalid value encountered in multiply Warning: invalid

Re: [Numpy-discussion] Problem introduced after 1.0rc2 on AIX with xlc

2006-10-20 Thread Brian Granger
Also, when I use seterr(all='ignore') the the tests fail: == FAIL: Ticket #112 -- Traceback (most recent call last): File

Re: [Numpy-discussion] Problem introduced after 1.0rc2 on AIX with xlc

2006-10-20 Thread Brian Granger
When I set seterr(all='warn') I see the following: In [1]: import numpy /usr/common/homes/g/granger/usr/local/lib/python/numpy/lib/ufunclike.py:46: RuntimeWarning: invalid value encountered in log _log2 = umath.log(2) /usr/common/homes/g/granger/usr/local/lib/python/numpy/lib/scimath.py:19:

Re: [Numpy-discussion] Problem introduced after 1.0rc2 on AIX with xlc

2006-10-20 Thread Tim Hochberg
Brian Granger wrote: Also, when I use seterr(all='ignore') the the tests fail: == FAIL: Ticket #112 -- Traceback (most recent call last): File

Re: [Numpy-discussion] Problem introduced after 1.0rc2 on AIX with xlc

2006-10-20 Thread Brian Granger
I have been doing these recent tests with 1.0rc3. I am building from trunk right now and we will see how that goes. Thanks for your help. Brian On 10/20/06, Tim Hochberg [EMAIL PROTECTED] wrote: Brian Granger wrote: Also, when I use seterr(all='ignore') the the tests fail:

Re: [Numpy-discussion] Problem introduced after 1.0rc2 on AIX with xlc

2006-10-20 Thread Tim Hochberg
Brian Granger wrote: When I set seterr(all='warn') I see the following: In [1]: import numpy /usr/common/homes/g/granger/usr/local/lib/python/numpy/lib/ufunclike.py:46: RuntimeWarning: invalid value encountered in log _log2 = umath.log(2)

Re: [Numpy-discussion] Problem introduced after 1.0rc2 on AIX with xlc

2006-10-20 Thread Tim Hochberg
Brian Granger wrote: Tim, I just tried everything with r3375. I set seterr(all='warn') and the tests passed. But all the floating point warning are still there. With seterr(all='ignore') the warnings go away and all the tests pass. should I worry about the warnings? Maybe. I just sent

Re: [Numpy-discussion] Problem introduced after 1.0rc2 on AIX with xlc

2006-10-20 Thread Brian Granger
Thanks, I will investigate more on these things and get back to you early in the week. But for now numpy seems to be functioning pretty normally (log(2) gives the correct answer). thanks again. It would be great to figure this stuff out before 1.0, but we might not have time. Brian On