Re: [Numpy-discussion] clip() with None as argument

2010-09-09 Thread Robert Kern
On Thu, Sep 9, 2010 at 05:05, Chris Ball wrote: > Robert Kern gmail.com> writes: >> >> On Wed, Sep 8, 2010 at 14:42, Chris Ball gmail.com> wrote: >> > Robert Kern gmail.com> writes: >> > > ... >> a = numpy.array([1,2,3,4,5]) >> a.clip(2,None) >> > array([2, 2, 2, 2, 2], dtype=object)

Re: [Numpy-discussion] clip() with None as argument

2010-09-09 Thread Chris Ball
Robert Kern gmail.com> writes: > > On Wed, Sep 8, 2010 at 14:42, Chris Ball gmail.com> wrote: > > Robert Kern gmail.com> writes: > > ... > a = numpy.array([1,2,3,4,5]) > a.clip(2,None) > > array([2, 2, 2, 2, 2], dtype=object) > > > > I'm not sure why the returned array has a dtype of

Re: [Numpy-discussion] clip() with None as argument

2010-09-08 Thread Robert Kern
On Wed, Sep 8, 2010 at 14:42, Chris Ball wrote: > Robert Kern gmail.com> writes: > >> >> On Tue, Sep 7, 2010 at 15:12, Friedrich Romstedt >> gmail.com> wrote: >> > Ah, no need to answer, I do this myself: >> > >> > Friedrich, would you please use numpy.inf and -numpy.inf. >> >> But if you have a

Re: [Numpy-discussion] clip() with None as argument

2010-09-08 Thread Chris Ball
Robert Kern gmail.com> writes: > > On Tue, Sep 7, 2010 at 15:12, Friedrich Romstedt > gmail.com> wrote: > > Ah, no need to answer, I do this myself: > > > > Friedrich, would you please use numpy.inf and -numpy.inf. > > But if you have an integer array, you will run into the same problem. > The

Re: [Numpy-discussion] clip() with None as argument

2010-09-07 Thread Robert Kern
On Tue, Sep 7, 2010 at 15:12, Friedrich Romstedt wrote: > Ah, no need to answer, I do this myself: > > Friedrich, would you please use numpy.inf and -numpy.inf. But if you have an integer array, you will run into the same problem. The result will be upcast to float. I think we would accept a patc

Re: [Numpy-discussion] clip() with None as argument

2010-09-07 Thread Friedrich Romstedt
Ah, no need to answer, I do this myself: Friedrich, would you please use numpy.inf and -numpy.inf. Thanks, and sorry for the noise, Friedrich ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discu

[Numpy-discussion] clip() with None as argument

2010-09-07 Thread Friedrich Romstedt
I just came across a problem with the intention to specify unset boundaries given to numpy.clip() or array.clip(): a.clip(1e-10, None) a.clip(None, -1e-10) When doing this, the returned array is dtype=numpy.object, seemingly None gets converted to a numpy.asarray(None, dtype=numpy.object), and th