Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-12 Thread Pierre GM
On Monday 12 May 2008 12:04:24 Stéfan van der Walt wrote: > 2008/5/12 Pierre GM <[EMAIL PROTECTED]>: > > What should I do with oldnumeric.ma.power ? Try to fix it the same > > way, or leave the bug ? I'm not that enthusiastic to have to debug the > > old package, but if it's part of the job... > >

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-12 Thread Stéfan van der Walt
2008/5/12 Pierre GM <[EMAIL PROTECTED]>: > I fixed the power function in numpy.ma following Anne's suggestion: compute > first, mask the problems afterwards. It's a quick and dirty fix that crashes > if the user has set its error system to raise an exception on invalid > (np.seterr(invalid='rai

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-12 Thread Pierre GM
All, I fixed the power function in numpy.ma following Anne's suggestion: compute first, mask the problems afterwards. It's a quick and dirty fix that crashes if the user has set its error system to raise an exception on invalid (np.seterr(invalid='raise')), but it works otherwise and keeps subcl

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-09 Thread Eric Firing
Anne Archibald wrote: > 2008/5/9 Eric Firing <[EMAIL PROTECTED]>: >> Stefan, (and Jarrod and Pierre) >> >> (Context for anyone new to the thread: the subject is slightly >> misleading, because the bug is/was present in both oldnumeric.ma and >> numpy.ma; the discussion of fix pertains to the lat

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-09 Thread Anne Archibald
2008/5/9 Eric Firing <[EMAIL PROTECTED]>: > Stefan, (and Jarrod and Pierre) > > (Context for anyone new to the thread: the subject is slightly > misleading, because the bug is/was present in both oldnumeric.ma and > numpy.ma; the discussion of fix pertains to the latter only.) > > Regarding you

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-09 Thread Pierre GM
On Friday 09 May 2008 12:55:39 Eric Firing wrote: > Stefan, (and Jarrod and Pierre) > Regarding your objections to r5137: good point. I wondered about that. > I think the function should look like this (although it might be > possible to speed up the implementation for the most common case): O

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-09 Thread Eric Firing
Stefan, (and Jarrod and Pierre) (Context for anyone new to the thread: the subject is slightly misleading, because the bug is/was present in both oldnumeric.ma and numpy.ma; the discussion of fix pertains to the latter only.) Regarding your objections to r5137: good point. I wondered about tha

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-09 Thread Stéfan van der Walt
2008/5/9 Eric Firing <[EMAIL PROTECTED]>: > Pierre GM fixed this in r5137, so that the result is masked only if the > first argument is negative and the power is between -1 and 1. Why should the output be masked only when the power is between -1 and 1? Other powers also produce nan's. Either way

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-09 Thread Eric Firing
Jarrod Millman wrote: > On Wed, May 7, 2008 at 12:12 PM, Pierre GM <[EMAIL PROTECTED]> wrote: >> Yes, there is a problem with ma.power: masking negative data should be >> restricted to the case of an exponent between -1. and 1. only, don't you >> think ? > > Charles Doutriaux has suggested that 1.

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-09 Thread Jarrod Millman
On Wed, May 7, 2008 at 12:12 PM, Pierre GM <[EMAIL PROTECTED]> wrote: > Yes, there is a problem with ma.power: masking negative data should be > restricted to the case of an exponent between -1. and 1. only, don't you > think ? Charles Doutriaux has suggested that 1.1.0 shouldn't be released until

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-07 Thread Anne Archibald
2008/5/7 Pierre GM <[EMAIL PROTECTED]>: > On Wednesday 07 May 2008 20:38:22 Anne Archibald wrote: > > 2008/5/7 Pierre GM <[EMAIL PROTECTED]>: > > > All, > > > Yes, there is a problem with ma.power: masking negative data should be > > > restricted to the case of an exponent between -1. and 1.

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-07 Thread Anne Archibald
2008/5/7 Jonathan Wright <[EMAIL PROTECTED]>: > Is there a rule against squaring away the negatives? > > def not_your_normal_pow( x, y ): return exp( log( power( x, 2) ) * y / 2 ) > > Which still needs some work for x==0. Well, it means (-1.)**(3.) becomes 1., which is probably not what the us

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-07 Thread Jonathan Wright
Anne Archibald wrote: > 2008/5/7 Pierre GM <[EMAIL PROTECTED]>: > >> All, >> Yes, there is a problem with ma.power: masking negative data should be >> restricted to the case of an exponent between -1. and 1. only, don't you >> think ? >> > > No, there's a problem with any fractional expo

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-07 Thread Pierre GM
On Wednesday 07 May 2008 20:38:22 Anne Archibald wrote: > 2008/5/7 Pierre GM <[EMAIL PROTECTED]>: > > All, > > Yes, there is a problem with ma.power: masking negative data should be > > restricted to the case of an exponent between -1. and 1. only, don't you > > think ? > > No, there's a problem

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-07 Thread Anne Archibald
2008/5/7 Pierre GM <[EMAIL PROTECTED]>: > All, > Yes, there is a problem with ma.power: masking negative data should be > restricted to the case of an exponent between -1. and 1. only, don't you > think ? No, there's a problem with any fractional exponent (with even denominator): x**(3/2) == (x

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-07 Thread Pierre GM
All, Yes, there is a problem with ma.power: masking negative data should be restricted to the case of an exponent between -1. and 1. only, don't you think ? On Wednesday 07 May 2008 18:47:18 Anne Archibald wrote: > 2008/5/7 Eric Firing <[EMAIL PROTECTED]>: > > Charles Doutriaux wrote: > > > The

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-07 Thread Anne Archibald
2008/5/7 Eric Firing <[EMAIL PROTECTED]>: > Charles Doutriaux wrote: > > The following code works with numpy.ma but not numpy.oldnumeric.ma, > > No, this is a bug in numpy.ma also; power is broken: While it's tempting to just call power() and mask out any NaNs that result, that's going to be a p

Re: [Numpy-discussion] bug in oldnumeric.ma

2008-05-07 Thread Eric Firing
Charles Doutriaux wrote: > The following code works with numpy.ma but not numpy.oldnumeric.ma, No, this is a bug in numpy.ma also; power is broken: In [1]:import numpy as np In [2]:x = np.ma.array([-1.1]) In [3]:x**2.0 ### This works Out[3]: masked_array(data = [1.21],

[Numpy-discussion] bug in oldnumeric.ma

2008-05-07 Thread Charles Doutriaux
The following code works with numpy.ma but not numpy.oldnumeric.ma, obviously it shouldn't have missing values... Note that replacing 2. with 2 (int) works, dtype does not seem to matter import numpy.oldnumeric.ma as MA,numpy s = MA.array([ 12.16271591, 11.19478798, 10.27440453, 9.60334778, 9.