Re: [Numpy-discussion] adding an attribute to an nd-array

2006-10-18 Thread Pierre GM
On Wednesday 18 October 2006 20:29, Stefan van der Walt wrote: > A quick question on extending numpy arrays: is it possible to easily > add an attribute to an ndarray? It might be easier to create a subclass: pleasehave a look here: http://projects.scipy.org/scipy/numpy/attachment/wiki/MaskedArray

Re: [Numpy-discussion] sort(axis=-1)

2006-10-18 Thread Christian Kristukat
Travis Oliphant ieee.org> writes: > > Christian Kristukat wrote: > > Hi, > > > > it seems that -1 as axis parameter is interpreted like in array indexing, > > -1 means the last axis rather than meaning the only axis of the flattened > > representation, like for example with take(). > > Is that

[Numpy-discussion] adding an attribute to an nd-array

2006-10-18 Thread Stefan van der Walt
A quick question on extending numpy arrays: is it possible to easily add an attribute to an ndarray? With Python-defined classes one can do class X(object): pass x = X() x.foo = 'bar' but with ndarrays you get x = N.array([1,2,3]) x.foo = 'bar' AttributeError: 'numpy.ndarray' object has n

Re: [Numpy-discussion] Question about indexing arrays with boolean arrays

2006-10-18 Thread Michael Sorich
On 10/18/06, Daniel Arbuckle <[EMAIL PROTECTED]> wrote: > Why does a[b1, b2] not mean the same thing as a[b1][:, b2], when "a" > is an array and "b1" and "b2" are appropriately sized arrays of > booleans? >From my previous experience with R I am used to a[b1, b2] being equivalent to a[b1][:, b2],

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

2006-10-18 Thread Charles R Harris
On 10/18/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: Charles R Harris wrote:>>> On 10/18/06, *Travis Oliphant* <[EMAIL PROTECTED]> [EMAIL PROTECTED] >> wrote:>> Charles R Harris wrote:>> > Well, I knew that for numeric, but it was a good deal less> obvious in> > combo with the or

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

2006-10-18 Thread Travis Oliphant
Charles R Harris wrote: > > > On 10/18/06, *Travis Oliphant* <[EMAIL PROTECTED] > > wrote: > > Charles R Harris wrote: > > > Well, I knew that for numeric, but it was a good deal less > obvious in > > combo with the order keyword. For instance, contiguou

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

2006-10-18 Thread Charles R Harris
On 10/18/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: Charles R Harris wrote:> Well, I knew that for numeric, but it was a good deal less obvious in> combo with the order keyword.  For instance, contiguous could change> its meaning to match up with FORTRAN, so that FORTRAN=True and > CONTIGUOUS=T

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

2006-10-18 Thread Travis Oliphant
Charles R Harris wrote: > Well, I knew that for numeric, but it was a good deal less obvious in > combo with the order keyword. For instance, contiguous could change > its meaning to match up with FORTRAN, so that FORTRAN=True and > CONTIGUOUS=True meant Fortran contiguous, which was sort of w

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

2006-10-18 Thread George Nurser
On 18/10/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > On 10/18/06, George Nurser <[EMAIL PROTECTED]> wrote: > > > > None of the LaPack stuff seems to use the Fortran stuff, they just > > > > transpose and copy. > > > > You've got me worried here. I have assumed that when you start with a >

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

2006-10-18 Thread Charles R Harris
On 10/18/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: Charles R Harris wrote:>> Could we make a few changes ;)>> For printing the flags I would suggest using C-Contiguous and> F-Contiguous so folks don't have to read the book. And at the c level > define alternates, i.e, #define c-contiguous cont

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

2006-10-18 Thread Travis Oliphant
Charles R Harris wrote: > > Could we make a few changes ;) > > For printing the flags I would suggest using C-Contiguous and > F-Contiguous so folks don't have to read the book. And at the c level > define alternates, i.e, #define c-contiguous contiguous or whatever. > That way backward compati

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

2006-10-18 Thread Charles R Harris
On 10/18/06, George Nurser <[EMAIL PROTECTED]> wrote: > > None of the LaPack stuff seems to use the Fortran stuff, they just> > transpose and copy.You've got me worried here. I have assumed that when you start with ac-contiguous array, a, with say, a.shape = (m,n), if you use thetranspose as an arg

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

2006-10-18 Thread George Nurser
> > None of the LaPack stuff seems to use the Fortran stuff, they just > > transpose and copy. You've got me worried here. I have assumed that when you start with a c-contiguous array, a, with say,a.shape = (m,n), if you use the transpose as an argument to a fortran routine which requires an mxn s

Re: [Numpy-discussion] scalar object bug or feature?

2006-10-18 Thread Charles R Harris
On 10/18/06, Alan G Isaac <[EMAIL PROTECTED]> wrote: On Wed, 18 Oct 2006, Keith Goodman apparently wrote: Here's a simpler (?) example:>>> x=numpy.random.rand(300,1)>0>>> x.sum()300>>> sum(x)array([44], dtype=int8)>>> x=numpy.random.rand(300)>0>>> sum(x) 300Alan IsaacHmmm, I think sum(x) and x.sum

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

2006-10-18 Thread Charles R Harris
Travis,On 10/18/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: Tim Hochberg wrote:> One thing that may be confusing the issue is that, as I understand it,> FORTRAN and CONTIGUOUS together represent three states which I'll call> FORTRAN_ORDER, C_ORDER and DISCONTIGUOUS. Yep,  that's what they mean. 

Re: [Numpy-discussion] scalar object bug or feature?

2006-10-18 Thread Alan G Isaac
On Wed, 18 Oct 2006, Keith Goodman apparently wrote: > Here's an example: >>> x = zeros((300, 300)) >>> x = x > 1 # False >>> x = 1 - x# ones >>> y = x.T * x >>> y[0,0] > 44 Here's a simpler (?) example: >>> x=numpy.random.rand(300,1)>0 >>> x.sum() 300 >>> sum(x) array([44], dtype=i

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

2006-10-18 Thread Travis Oliphant
Tim Hochberg wrote: > One thing that may be confusing the issue is that, as I understand it, > FORTRAN and CONTIGUOUS together represent three states which I'll call > FORTRAN_ORDER, C_ORDER and DISCONTIGUOUS. Yep, that's what they mean. CONTIGUOUS is the name Numeric gave it and it meant C-

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

2006-10-18 Thread Travis Oliphant
> > I'm not talking about the keyword in the ravel call, I'm talking about > the flag in a. Ah. Yes, I see. I misunderstood. Of course ravel ignores the FORTRAN flag (actually it doesn't because if a copy is not necessary it doesn't make one).The key is that the Python user doesn't need

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

2006-10-18 Thread Travis Oliphant
> > I'm not talking about the keyword in the ravel call, I'm talking about > the flag in a. Ah. Yes, I see. I misunderstood. Of course ravel ignores the FORTRAN flag (actually it doesn't because if a copy is not necessary it doesn't make one).The key is that the Python user doesn't need

Re: [Numpy-discussion] scalar object bug or feature?

2006-10-18 Thread Keith Goodman
On 10/18/06, Christopher Hanley <[EMAIL PROTECTED]> wrote: > I can't decide if the following is a bug or feature. Numpy scalars are > allowed to overflow silently while numarray upcasts to a larger python > type. I guess my biggest problem is that the overflow occurs silently. I had that problem

[Numpy-discussion] scalar object bug or feature?

2006-10-18 Thread Christopher Hanley
Greetings, I can't decide if the following is a bug or feature. Numpy scalars are allowed to overflow silently while numarray upcasts to a larger python type. I guess my biggest problem is that the overflow occurs silently. In any case, is this known and expected behavior? Thanks, Chris N

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

2006-10-18 Thread Charles R Harris
On 10/18/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: Charles R Harris wrote:>>> On 10/18/06, *Tim Hochberg* <[EMAIL PROTECTED]> [EMAIL PROTECTED] >> wrote:>> Charles R Harris wrote:>> [SNIP]> >> > I'm not talking about the keyword in the ravel call, I'm talking> about> > the

Re: [Numpy-discussion] histogram complete makeover

2006-10-18 Thread Tim Hochberg
My $0.02: If histogram is going to get a makeover, particularly one that makes it more complex than at present, it should probably be moved to SciPy. Failing that, it should be moved to a submodule of numpy with similar statistical tools. Preferably with consistent interfaces for all of the f

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

2006-10-18 Thread Tim Hochberg
Charles R Harris wrote: > > > On 10/18/06, *Tim Hochberg* <[EMAIL PROTECTED] > > wrote: > > Charles R Harris wrote: > > [SNIP] > > > > I'm not talking about the keyword in the ravel call, I'm talking > about > > the flag in a. The question is: do w

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

2006-10-18 Thread Charles R Harris
On 10/18/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: Charles R Harris wrote:[SNIP]>> I'm not talking about the keyword in the ravel call, I'm talking about> the flag in a. The question is: do we *need* a fortran flag. I am> argueing not, because the only need is for fortran contiguous arrays > to p

Re: [Numpy-discussion] histogram complete makeover

2006-10-18 Thread Erin Sheldon
On 10/17/06, David Huard <[EMAIL PROTECTED]> wrote: > Hi all, > > I'd like to poll the list to see what people want from numpy.histogram(), > since I'm currently writing a contender. > > My main complaints with the current version are: > 1. upper outliers are stored in the last bin, while lower out

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

2006-10-18 Thread Tim Hochberg
Charles R Harris wrote: [SNIP] > > I'm not talking about the keyword in the ravel call, I'm talking about > the flag in a. The question is: do we *need* a fortran flag. I am > argueing not, because the only need is for fortran contiguous arrays > to pass to fortran function, or translation from

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

2006-10-18 Thread Tim Hochberg
One thing that may be confusing the issue is that, as I understand it, FORTRAN and CONTIGUOUS together represent three states which I'll call FORTRAN_ORDER, C_ORDER and DISCONTIGUOUS. I periodically wonder if it would be valuable to have a way to query the order directly: the result would be "

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

2006-10-18 Thread Charles R Harris
On 10/18/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: >> Currently, the key operation is reshape, which only needs to return a> view in fortran order and doesn't even need to mark the resulting> array as fortran order because, well, because it works just fine in > numpy as is, it just isn't conti

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

2006-10-18 Thread Travis Oliphant
> > Currently, the key operation is reshape, which only needs to return a > view in fortran order and doesn't even need to mark the resulting > array as fortran order because, well, because it works just fine in > numpy as is, it just isn't contiguous. If the other functions took > shape and o

Re: [Numpy-discussion] No forums found for Numerical Python

2006-10-18 Thread Robert Kern
Ray Schumacher wrote: > FYI: > at http://numpy.org/, the link "Forums" ( > http://sourceforge.net/forum/?group_id=1369) gives > > *No forums found for Numerical Python* > > ! Yes, I closed them since people would go there for help, but the people that *could* help don't read the forums.

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

2006-10-18 Thread Travis Oliphant
Charles R Harris wrote: > > > On 10/17/06, *Charles R Harris* <[EMAIL PROTECTED] > > wrote: > > > > On 10/17/06, *A. M. Archibald* < [EMAIL PROTECTED] > > wrote: > > On 17/10/06, Charles R Harris <[EMAIL PROTECTED] >

Re: [Numpy-discussion] questions regarding assignement and copy

2006-10-18 Thread Travis Oliphant
David Cournapeau wrote: > Sven Schreiber wrote: > >> Yes it's intended; as far as I understand the python/numpy syntax, <+> >> is an operator, and that triggers assignment by copy (even if you do >> something trivial as bar = +foo, you get a copy, if I'm not mistaken), >> >> > So basical

Re: [Numpy-discussion] questions regarding assignement and copy

2006-10-18 Thread Robert Kern
David Cournapeau wrote: > bar += 1 > print bar is foo > > prints True > > But if I do bar = bar + 1, then bar is not a copy of foo anymore. Is > this intended ? Yes, very much so! If it were otherwise Guido would never have added the augmented assignment operators. From the

Re: [Numpy-discussion] sort(axis=-1)

2006-10-18 Thread Travis Oliphant
Christian Kristukat wrote: > Hi, > > it seems that -1 as axis parameter is interpreted like in array indexing, i.e. > -1 means the last axis rather than meaning the only axis of the flattened > representation, like for example with take(). > Is that intendend? > > I don't understand the questio

Re: [Numpy-discussion] sort(axis=-1)

2006-10-18 Thread Robert Kern
Christian Kristukat wrote: > Hi, > > it seems that -1 as axis parameter is interpreted like in array indexing, i.e. > -1 means the last axis rather than meaning the only axis of the flattened > representation, like for example with take(). > Is that intendend? take(axis=-1) also goes over the las

Re: [Numpy-discussion] questions regarding assignement and copy

2006-10-18 Thread Charles R Harris
On 10/18/06, David Cournapeau <[EMAIL PROTECTED]> wrote: Sven Schreiber wrote:>> Yes it's intended; as far as I understand the python/numpy syntax, <+>> is an operator, and that triggers assignment by copy (even if you do> something trivial as bar = +foo, you get a copy, if I'm not mistaken), >So b

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

2006-10-18 Thread Charles R Harris
On 10/17/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: Stefan van der Walt wrote:> One last case, which confuses me still (probably because it is> 04:16am):Please continue to question.  All the code needs as much review as itcan get. I am really starting to wonder why we need an order keyword at a

[Numpy-discussion] No forums found for Numerical Python

2006-10-18 Thread Ray Schumacher
FYI: at http://numpy.org/, the link "Forums" ( http://sourceforge.net/forum/?group_id=1369) gives No forums found for Numerical Python! - Using Tomcat but need to do more? Need to support web services, security? Get stuff d

Re: [Numpy-discussion] questions regarding assignement and copy

2006-10-18 Thread A. M. Archibald
On 18/10/06, David Cournapeau <[EMAIL PROTECTED]> wrote: > Sven Schreiber wrote: > > > > Yes it's intended; as far as I understand the python/numpy syntax, <+> > > is an operator, and that triggers assignment by copy (even if you do > > something trivial as bar = +foo, you get a copy, if I'm not mi

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

2006-10-18 Thread A. M. Archibald
On 18/10/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > I just committed a change to the check-for-copy code to SVN. A copy > will occur if an actual reshaping is taking place that involves more > than just adding or deleting ones from the old shape and if > > 1) self is not "single-segment".

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

2006-10-18 Thread A. M. Archibald
On 18/10/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > On 10/17/06, A. M. Archibald <[EMAIL PROTECTED]> wrote: > > On 17/10/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > > > > > > > On 10/17/06, Travis Oliphant <[EMAIL PROTECTED] > wrote: > > > > > > Thus, reshape does the equivalen

Re: [Numpy-discussion] questions regarding assignement and copy

2006-10-18 Thread Sven Schreiber
David Cournapeau schrieb: > Sven Schreiber wrote: >> Yes it's intended; as far as I understand the python/numpy syntax, <+> >> is an operator, and that triggers assignment by copy (even if you do >> something trivial as bar = +foo, you get a copy, if I'm not mistaken), >> > So basically, wheneve

Re: [Numpy-discussion] questions regarding assignement and copy

2006-10-18 Thread David Cournapeau
Sven Schreiber wrote: > > Yes it's intended; as far as I understand the python/numpy syntax, <+> > is an operator, and that triggers assignment by copy (even if you do > something trivial as bar = +foo, you get a copy, if I'm not mistaken), > So basically, whenever you have foo = expr with exp

[Numpy-discussion] Question about boolean types comparisons

2006-10-18 Thread Francesc Altet
Hi, I've seen that bool type in numpy seems to work more consistently than its python counterpart: In [28]:True+True Out[28]:2 In [29]:numpy.bool_(True)+numpy.bool_(True) Out[29]:True Good! but... In [30]:True > False Out[30]:True In [31]:numpy.bool_(True) > numpy.bool_(False) Out[31]:True Per

Re: [Numpy-discussion] questions regarding assignement and copy

2006-10-18 Thread Sven Schreiber
David Cournapeau schrieb: > Hi there, > > I've just managed to nail down a bug which took me nearly two whole > days to find: this is coming from an unexpected (at least from me) > behaviour of numpy. You have all my sympathy, I tripped over something similar not too long ago, so welcome to

[Numpy-discussion] questions regarding assignement and copy

2006-10-18 Thread David Cournapeau
Hi there, I've just managed to nail down a bug which took me nearly two whole days to find: this is coming from an unexpected (at least from me) behaviour of numpy. I understand that if foo is a numpy array, doing bar = foo makes no copy, and whenever you change the value of foo, you ch

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

2006-10-18 Thread Charles R Harris
On 10/17/06, A. M. Archibald <[EMAIL PROTECTED]> wrote: On 17/10/06, Charles R Harris <[EMAIL PROTECTED]> wrote:>>> On 10/17/06, Travis Oliphant <[EMAIL PROTECTED] > wrote:> > Thus, reshape does the equivalent of a Fortran ravel to [1,4,2,5,3,6]> > and then a Fortran-order based fill of an empty (3

[Numpy-discussion] 笑顔の素敵な女 の子

2006-10-18 Thread GRGE
完全無料サイト大特集【秋の旬】 http://hlgliu.jeeran.com/egao - 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 WebSphere A

[Numpy-discussion] NumPy 1.0rc3 will be out in a few hours

2006-10-18 Thread Travis Oliphant
I'm going to release NumPy 1.0rc3 in a few hours. It requires a re-build of extension modules from 1.0rc2. This gives us a chance to start fresh with NumPy 1.0 and also test the non-dying version of the version_checking code. So, it's not all bad. Official NumPy 1.0 will be released on Oct

[Numpy-discussion] Italy

2006-10-18 Thread enough
Decides pull century achieve sets finding someone bankroll is enterprise person Coward big am syndicate boss still running a.Sorted shutup no talks anymore meeting leader threatens is kill pulloff responds will making a grave.Movies past yearsi give stars acting of driving stunts fiction lif

Re: [Numpy-discussion] recent ubuntu package

2006-10-18 Thread Andrew Straw
Sven Schreiber wrote: > Hi, > as suggested on the website I use the kindly provided pre-built > (unofficial) ubuntu debs. Recently there is a new one available with > version numbe 1.0+~dev3336-0ads1. > > Apart from the slightly strange +~ thing in there, it very much seems to > be based on trac ch

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

2006-10-18 Thread A. M. Archibald
On 17/10/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: Charles R Harris wrote: > > In [3]: array([[1,2,3,4,5,6]]).reshape((3,2),order='F') > Out[3]: > array([[1, 4], >[2, 5], >[3, 6]]) > > I also don't understand why a copy is returned if 'F' just fiddles > with the indices and s

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

2006-10-18 Thread Charles R Harris
On 10/17/06, Charles R Harris <[EMAIL PROTECTED]> wrote: On 10/17/06, A. M. Archibald < [EMAIL PROTECTED]> wrote: On 17/10/06, Charles R Harris <[EMAIL PROTECTED]> wrote:>>> On 10/17/06, Travis Oliphant < [EMAIL PROTECTED] > wrote: Which doesn't seem to be the case here. I am beginning to wonder i

[Numpy-discussion] sort(axis=-1)

2006-10-18 Thread Christian Kristukat
Hi, it seems that -1 as axis parameter is interpreted like in array indexing, i.e. -1 means the last axis rather than meaning the only axis of the flattened representation, like for example with take(). Is that intendend? Christian --

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

2006-10-18 Thread Travis Oliphant
> > You are right, it doesn't need to. My check is not general > enough. > > It can be challenging to come up with a general way to > differentiate the > view-vs-copy situation and I struggled with it. In this case, > it's the > fact that

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

2006-10-18 Thread Travis Oliphant
Stefan van der Walt wrote: > One last case, which confuses me still (probably because it is > 04:16am): > > In [41]: x = N.array([[0,1,2],[3,4,5]],order='F') > > In [42]: x > Out[42]: > array([[0, 1, 2], >[3, 4, 5]]) > > I assume the data is now stored in memory as > > [0 3 1 4 2 5] (colum