Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Dave Hirschfeld
Robert Kern robert.kern at gmail.com writes: One alternative that does not expand the API with two-liners is to let the ndarray.fill() method return self: a = np.empty(...).fill(20.0) This violates the convention that in-place operations never return self, to avoid

Re: [Numpy-discussion] numpydoc for python 3?

2013-01-14 Thread Pierre Haessig
Hi, Le 14/01/2013 11:35, Jaakko Luttinen a écrit : Ok, thanks, maybe I'll try to make the tests valid in all Python versions. It seems there's only one line which I'm not able to transform. In doc/sphinxext/tests/test_docscrape.py, on line 559: assert doc['Summary'][0] ==

Re: [Numpy-discussion] 1.8 release

2013-01-14 Thread Matthew Brett
Hi, On Mon, Jan 14, 2013 at 12:19 AM, David Cournapeau courn...@gmail.com wrote: On Sun, Jan 13, 2013 at 5:26 PM, Nathaniel Smith n...@pobox.com wrote: On Sun, Jan 13, 2013 at 7:03 PM, Charles R Harris charlesr.har...@gmail.com wrote: Now that 1.7 is nearing release, it's time to look forward

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Pierre Haessig
Hi, Le 14/01/2013 00:39, Nathaniel Smith a écrit : (The nice thing about np.filled() is that it makes np.zeros() and np.ones() feel like clutter, rather than the reverse... not that I'm suggesting ever getting rid of them, but it makes the API conceptually feel smaller, not larger.) Coming

Re: [Numpy-discussion] numpydoc for python 3?

2013-01-14 Thread Matthew Brett
Hi, On Mon, Jan 14, 2013 at 10:35 AM, Jaakko Luttinen jaakko.lutti...@aalto.fi wrote: On 01/14/2013 12:53 AM, Matthew Brett wrote: On Sun, Jan 13, 2013 at 10:46 PM, Jaakko Luttinen jaakko.lutti...@aalto.fi wrote: I'm a bit stuck trying to make numpydoc Python 3 compatible. I made setup.py

Re: [Numpy-discussion] phase unwrapping (1d)

2013-01-14 Thread Neal Becker
Nadav Horesh wrote: There is an unwrap function in numpy. Doesn't it work for you? Like I had said, np.unwrap was too slow. Profiling showed it eating up an absurd proportion of time. My c++ code was much better (although still surprisingly slow).

Re: [Numpy-discussion] phase unwrapping (1d)

2013-01-14 Thread Pierre Haessig
Hi Neal, Le 11/01/2013 16:40, Neal Becker a écrit : I wanted to be able to handle the case of unwrap (arg (x1) + arg (x2)) Here, phase can change by more than 2pi. It's not clear to me what you mean by change more than 2pi ? Do you mean that the consecutive points of in input can increase by

Re: [Numpy-discussion] Insights / lessons learned from NumPy design

2013-01-14 Thread Mike Anderson
Just wanted to say a big thanks to everyone in the NumPy community who has commented on this topic - it's given us a lot to think about and a lot of good ideas to work into the design! Best regards, Mike. On 4 January 2013 14:29, Mike Anderson mike.r.anderson...@gmail.com wrote: Hello all,

Re: [Numpy-discussion] phase unwrapping (1d)

2013-01-14 Thread Neal Becker
This code should explain all: import numpy as np arg = np.angle def nint (x): return int (x + 0.5) if x = 0 else int (x - 0.5) def unwrap (inp, y=np.pi, init=0, cnt=0): o = np.empty_like (inp) prev_o = init for i in range (len (inp)): o[i]

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Benjamin Root
On Mon, Jan 14, 2013 at 7:38 AM, Pierre Haessig pierre.haes...@crans.orgwrote: Hi, Le 14/01/2013 00:39, Nathaniel Smith a écrit : (The nice thing about np.filled() is that it makes np.zeros() and np.ones() feel like clutter, rather than the reverse... not that I'm suggesting ever getting

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Frédéric Bastien
Why not optimize NumPy to detect a mul of an ndarray by a scalar to call fill? That way, np.empty * 2 will be as fast as x=np.empty; x.fill(2)? Fred On Mon, Jan 14, 2013 at 9:57 AM, Benjamin Root ben.r...@ou.edu wrote: On Mon, Jan 14, 2013 at 7:38 AM, Pierre Haessig pierre.haes...@crans.org

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Robin
On Mon, Jan 14, 2013 at 2:57 PM, Benjamin Root ben.r...@ou.edu wrote: I am also +1 on the idea of having a filled() and filled_like() function (I learned a long time ago to just do a = np.empty() and a.fill() rather than the multiplication trick I learned from Matlab). However, the collision

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Robert Kern
On Mon, Jan 14, 2013 at 4:12 PM, Frédéric Bastien no...@nouiz.org wrote: Why not optimize NumPy to detect a mul of an ndarray by a scalar to call fill? That way, np.empty * 2 will be as fast as x=np.empty; x.fill(2)? In general, each element of an array will be different, so the result of the

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Matthew Brett
Hi, On Mon, Jan 14, 2013 at 9:02 AM, Dave Hirschfeld dave.hirschf...@gmail.com wrote: Robert Kern robert.kern at gmail.com writes: One alternative that does not expand the API with two-liners is to let the ndarray.fill() method return self: a = np.empty(...).fill(20.0)

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Olivier Delalleau
2013/1/14 Matthew Brett matthew.br...@gmail.com: Hi, On Mon, Jan 14, 2013 at 9:02 AM, Dave Hirschfeld dave.hirschf...@gmail.com wrote: Robert Kern robert.kern at gmail.com writes: One alternative that does not expand the API with two-liners is to let the ndarray.fill() method

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread josef . pktd
On Mon, Jan 14, 2013 at 11:15 AM, Olivier Delalleau sh...@keba.be wrote: 2013/1/14 Matthew Brett matthew.br...@gmail.com: Hi, On Mon, Jan 14, 2013 at 9:02 AM, Dave Hirschfeld dave.hirschf...@gmail.com wrote: Robert Kern robert.kern at gmail.com writes: One alternative that does not

Re: [Numpy-discussion] 1.8 release

2013-01-14 Thread Frédéric Bastien
Hi, I don't volontear for the next release manager, but +1 for shorter releases. I heard just good comments from that. Also, I'm not sure it would ask more from the release manager. Do someone have an idea? The most work I do as a release manager for theano is the preparation/tests/release notes

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread josef . pktd
On Mon, Jan 14, 2013 at 11:22 AM, josef.p...@gmail.com wrote: On Mon, Jan 14, 2013 at 11:15 AM, Olivier Delalleau sh...@keba.be wrote: 2013/1/14 Matthew Brett matthew.br...@gmail.com: Hi, On Mon, Jan 14, 2013 at 9:02 AM, Dave Hirschfeld dave.hirschf...@gmail.com wrote: Robert Kern

Re: [Numpy-discussion] New numpy functions: vals and vals_like or filled, filled_like?

2013-01-14 Thread Alan G Isaac
Just changing the subject line so a good suggestion does not get lost ... Alan ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Eric Firing
On 2013/01/14 6:15 AM, Olivier Delalleau wrote: - I agree the name collision with np.ma.filled is a problem. I have no better suggestion though at this point. How about initialized()? ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Benjamin Root
On Mon, Jan 14, 2013 at 12:27 PM, Eric Firing efir...@hawaii.edu wrote: On 2013/01/14 6:15 AM, Olivier Delalleau wrote: - I agree the name collision with np.ma.filled is a problem. I have no better suggestion though at this point. How about initialized()? A verb! +1 from me! For those

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Charles R Harris
On Sun, Jan 13, 2013 at 4:24 PM, Robert Kern robert.k...@gmail.com wrote: On Sun, Jan 13, 2013 at 6:27 PM, Nathaniel Smith n...@pobox.com wrote: Hi all, PR 2875 adds two new functions, that generalize zeros(), ones(), zeros_like(), ones_like(), by simply taking an arbitrary fill value:

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Pierre Haessig
Le 14/01/2013 18:33, Benjamin Root a écrit : How about initialized()? A verb! +1 from me! Shouldn't it be initialize() then ? I'm not so fond of it though, because initialize is pretty broad in the field of programming. What about refurbishing the already existing tile() function ? As

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread David Warde-Farley
On Mon, Jan 14, 2013 at 9:57 AM, Benjamin Root ben.r...@ou.edu wrote: On Mon, Jan 14, 2013 at 7:38 AM, Pierre Haessig pierre.haes...@crans.org wrote: Hi, Le 14/01/2013 00:39, Nathaniel Smith a écrit : (The nice thing about np.filled() is that it makes np.zeros() and np.ones() feel like

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread David Warde-Farley
On Mon, Jan 14, 2013 at 1:12 PM, Pierre Haessig pierre.haes...@crans.org wrote: In [8]: tile(nan, (3,3)) # (it's a verb ! ) tile, in my opinion, is useful in some cases (for people who think in terms of repmat()) but not very NumPy-ish. What I'd like is a function that takes - an initial

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Benjamin Root
On Mon, Jan 14, 2013 at 1:56 PM, David Warde-Farley d.warde.far...@gmail.com wrote: On Mon, Jan 14, 2013 at 1:12 PM, Pierre Haessig pierre.haes...@crans.org wrote: In [8]: tile(nan, (3,3)) # (it's a verb ! ) tile, in my opinion, is useful in some cases (for people who think in terms of

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Alan G Isaac
Thanks Pierre for noting that np.tile already provides a chunk of this functionality: a = np.tile(5,(1,2,3)) a array([[[5, 5, 5], [5, 5, 5]]]) np.tile(1,a.shape) array([[[1, 1, 1], [1, 1, 1]]]) I had not realized a scalar first argument was possible. Alan Isaac

Re: [Numpy-discussion] 1.8 release

2013-01-14 Thread Ralf Gommers
On Mon, Jan 14, 2013 at 1:19 AM, David Cournapeau courn...@gmail.comwrote: On Sun, Jan 13, 2013 at 5:26 PM, Nathaniel Smith n...@pobox.com wrote: On Sun, Jan 13, 2013 at 7:03 PM, Charles R Harris charlesr.har...@gmail.com wrote: Now that 1.7 is nearing release, it's time to look forward to

Re: [Numpy-discussion] 1.8 release

2013-01-14 Thread Nathaniel Smith
On Mon, Jan 14, 2013 at 4:45 PM, Frédéric Bastien no...@nouiz.org wrote: I don't volontear for the next release manager, but +1 for shorter releases. I heard just good comments from that. Also, I'm not sure it would ask more from the release manager. Do someone have an idea? The most work I do