Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-14 Thread Friedrich Romstedt
Ok, to come back to the original question I have pushed a branch "bugtracking.01.numpyops" to github.com/friedrichromstedt/upy. If you want to inspect the problem with some closer look, please pull from this repo, and run demo.py in the branch mentioned. Today's version is tagged 10-02-14_GMT-22-

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Dag Sverre Seljebotn
Friedrich Romstedt wrote: > 2010/2/11 Keith Goodman : >> The problem I have now is that I don't know where to place the line of >> code that changes the meaning of numpy's equal. I don't know when >> someone will do > > Well, I think a solution is as written before to put a test whether > the othe

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Friedrich Romstedt
2010/2/11 Keith Goodman : > The problem I have now is that I don't know where to place the line of > code that changes the meaning of numpy's equal. I don't know when > someone will do Well, I think a solution is as written before to put a test whether the other operand is in fact a myclass instan

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Friedrich Romstedt
2010/2/11 Robert Kern : > It turns certain specifically-written generators into full context managers. > >  http://docs.python.org/library/contextlib#contextlib.contextmanager Ok, thanks! I didn't know about before. (To the anonymous reader seeking for information as me: http://www.python.org/dev

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Robert Kern
On Thu, Feb 11, 2010 at 15:14, Friedrich Romstedt wrote: >> Did you omit the @contextmanager decorator? > > Oh, yes! I guessed it would mean: In module contextmanager you write > what follows after the colon? What does this decoration do? It turns certain specifically-written generators into full

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Keith Goodman
On Thu, Feb 11, 2010 at 12:47 PM, Robert Kern wrote: > On Thu, Feb 11, 2010 at 14:40, Keith Goodman wrote: >> On Thu, Feb 11, 2010 at 12:32 PM, Friedrich Romstedt >> wrote: Hey! You broke my numpy  :) >> def addbug(x, y):   ...:     return x - y   ...: >> old_funcs =

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Friedrich Romstedt
> Did you omit the @contextmanager decorator? Oh, yes! I guessed it would mean: In module contextmanager you write what follows after the colon? What does this decoration do? Friedrich ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Friedrich Romstedt
2010/2/11 : > If this is global it won't work, because only the last package that > changes it wins. ?? Hm, at the current implementation of upy you're right, but I think you can do in the resp. module like: original_numpy_ops = numpy.set_numeric_ops() [ ... implementation of my_add_object, cal

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Robert Kern
On Thu, Feb 11, 2010 at 15:03, Friedrich Romstedt wrote: > Robert Kern: >> def numpy_ops(**ops): >>    old_ops = np.set_numeric_ops(**ops) >>    try: >>        yield >>    finally: >>        np.set_numeric_ops(**old_ops) >> >> >> with numpy_ops(multiply=...): >>    print np.array([1, 2, 3]) * np.a

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Friedrich Romstedt
Robert Kern: > def numpy_ops(**ops): >    old_ops = np.set_numeric_ops(**ops) >    try: >        yield >    finally: >        np.set_numeric_ops(**old_ops) > > > with numpy_ops(multiply=...): >    print np.array([1, 2, 3]) * np.array([1, 2, 3]) Well, at least for me in Py 2.5 this fails with: Att

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Robert Kern
On Thu, Feb 11, 2010 at 14:40, Keith Goodman wrote: > On Thu, Feb 11, 2010 at 12:32 PM, Friedrich Romstedt > wrote: >>> Hey! You broke my numpy  :) >>> > def addbug(x, y): >>>   ...:     return x - y >>>   ...: > old_funcs = np.set_numeric_ops(add=addbug) > np.array([1]) + np.array([1

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread josef . pktd
On Thu, Feb 11, 2010 at 3:43 PM, wrote: > On Thu, Feb 11, 2010 at 3:40 PM, Keith Goodman wrote: >> On Thu, Feb 11, 2010 at 12:32 PM, Friedrich Romstedt >> wrote: Hey! You broke my numpy  :) >> def addbug(x, y):   ...:     return x - y   ...: >> old_funcs = np.set_num

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread josef . pktd
On Thu, Feb 11, 2010 at 3:40 PM, Keith Goodman wrote: > On Thu, Feb 11, 2010 at 12:32 PM, Friedrich Romstedt > wrote: >>> Hey! You broke my numpy  :) >>> > def addbug(x, y): >>>   ...:     return x - y >>>   ...: > old_funcs = np.set_numeric_ops(add=addbug) > np.array([1]) + np.array(

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Keith Goodman
On Thu, Feb 11, 2010 at 12:32 PM, Friedrich Romstedt wrote: >> Hey! You broke my numpy  :) >> def addbug(x, y): >>   ...:     return x - y >>   ...: old_funcs = np.set_numeric_ops(add=addbug) np.array([1]) + np.array([1]) >>   array([0]) > Yea, that's what I meant.  Great. > > :-) :

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Friedrich Romstedt
> Hey! You broke my numpy  :) > >>> def addbug(x, y): >   ...:     return x - y >   ...: >>> old_funcs = np.set_numeric_ops(add=addbug) >>> np.array([1]) + np.array([1]) >   array([0]) Yea, that's what I meant. Great. :-) :-) Friedrich ___ NumPy-Discus

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Keith Goodman
On Thu, Feb 11, 2010 at 12:21 PM, Friedrich Romstedt wrote: > Hi Keith, > > 2010/2/11 Keith Goodman : >> Is there some way to tell numpy to use my __eq__ instead of its own? >> That would solve my problem. I had a similar problem with __radd__ >> which was solved by setting __array_priority__ = 10

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Friedrich Romstedt
Oh Sorry, I typed some keys, don't know what I did precisely, but the message was sent prematurely. Now I repeat: Hi Keith, 2010/2/11 Keith Goodman : > Is there some way to tell numpy to use my __eq__ instead of its own? > That would solve my problem. I had a similar problem with __radd__ > which

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Friedrich Romstedt
Hi Keith, 2010/2/11 Keith Goodman : > Is there some way to tell numpy to use my __eq__ instead of its own? > That would solve my problem. I had a similar problem with __radd__ > which was solved by setting __array_priority__ = 10. But that doesn't > work in this case. It's quite simple, but hidde

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Keith Goodman
On Thu, Feb 11, 2010 at 7:27 AM, Friedrich Romstedt wrote: > Keith Goodman: >> No one answered my post either  :( >> >> http://old.nabble.com/arrays-and-__eq__-td26987903.html#a26987903 >> >> Is it the same issue? > > First, before I post the package on github, I dived into Keith's > problem, and

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Friedrich Romstedt
2010/2/11 Stéfan van der Walt : > Could you please put your "undarray" as well as the ufunc-wrapper > online (preferably in a repository) so that we can have a look? Done, github.com/friedrichromsted/upy . Have fun with it :-) ! And thanks a lot in advance for your help. You will easily locate t

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-11 Thread Friedrich Romstedt
Keith Goodman: > No one answered my post either :( > > http://old.nabble.com/arrays-and-__eq__-td26987903.html#a26987903 > > Is it the same issue? First, before I post the package on github, I dived into Keith's problem, and here comes the explanation to the wreid behaviour: I used the code: cl

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-10 Thread Stéfan van der Walt
Hi Friedrich On 10 February 2010 20:57, Friedrich Romstedt wrote: > I wonder why there is no response on my e-mail dating back to Feb 4. > Is there nobody interested in it, is somebody working on it, or did it > simply did not come through?  I changed the recipient now to > "Discussion of Numeric

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-10 Thread josef . pktd
On Wed, Feb 10, 2010 at 2:41 PM, Alan G Isaac wrote: > On 2/10/2010 1:57 PM, Friedrich Romstedt wrote: >> I wonder why there is no response on my e-mail dating back to Feb 4. >> Is there nobody interested in it, is somebody working on it, or did it >> simply did not come through? > > I'm going to

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-10 Thread Alan G Isaac
On 2/10/2010 1:57 PM, Friedrich Romstedt wrote: > I wonder why there is no response on my e-mail dating back to Feb 4. > Is there nobody interested in it, is somebody working on it, or did it > simply did not come through? I'm going to guess it is because your actual question is at the very end of

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-10 Thread Keith Goodman
On Wed, Feb 10, 2010 at 10:57 AM, Friedrich Romstedt wrote: > I wonder why there is no response on my e-mail dating back to Feb 4. > Is there nobody interested in it, is somebody working on it, or did it > simply did not come through?  I changed the recipient now to > "Discussion of Numerical Pyth

Re: [Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-10 Thread Friedrich Romstedt
I wonder why there is no response on my e-mail dating back to Feb 4. Is there nobody interested in it, is somebody working on it, or did it simply did not come through? I changed the recipient now to "Discussion of Numerical Python", hth ... Sorry when there is double posting now, it's not intend

[Numpy-discussion] Scalar-ndarray arguments passed to not_equal

2010-02-04 Thread Friedrich Romstedt
Hi, I'm just coding a package for uncertain arrays using the accelerated numpy functionality intensively. I'm sorry, but I have to give some background information first. The package provides a class upy.undarray, which holds the nominal value and the uncertainty information. It has methods __a