[Numpy-discussion] combination of list of indices and newaxis not allowed?

2012-02-01 Thread Mark Bakker
Hello list, I am trying to specify the indices of an array with a list and add a newaxis, but that combination doesn't seem to be allowed. Any reason why? Here's an example: a = arange(3) This works: a[[0,2]][:,newaxis] Out[445]: array([[0], [2]]) This is more elegant syntax (and, I

Re: [Numpy-discussion] combination of list of indices and newaxis not allowed?

2012-02-01 Thread Olivier Delalleau
I think you just can't use newaxis in advanced indexing (doc says The newaxishttp://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#numpy.newaxisobject can be used in the basic slicing syntax, and does not mention newaxis in the advanced indexing part). -=- Olivier Le 1 février 2012

Re: [Numpy-discussion] Cross-covariance function

2012-02-01 Thread Pierre Haessig
Hi Bruce, Sorry for the delay in the answer. Le 27/01/2012 17:28, Bruce Southey a écrit : The output is still a covariance so do we really need yet another set of very similar functions to maintain? Or can we get away with a new keyword? The idea of an additional keyword seems appealing.

[Numpy-discussion] Broadcasting doesn't work with divide after tile

2012-02-01 Thread martin großhauser
Hello, when I try in my script to divide a masked array by a scalar I get an error. The instruction is: sppa = sp / 100. sp is a masked array with ndim = 3. error is: Traceback (most recent call last): File /media/nethome/Work/workspace/interimEnso/src/mlBudget.py, line 95, in module

[Numpy-discussion] autocorrelation computation performance : use of np.correlate

2012-02-01 Thread Pierre Haessig
Hi, [I'm not sure whether this discussion belongs to numpy-discussion or scipy-dev] In day to day time series analysis I regularly need to look at the data autocorrelation (acorr or acf depending on the software package). The straighforward available function I have is

Re: [Numpy-discussion] Broadcasting doesn't work with divide after tile

2012-02-01 Thread martin großhauser
2012/2/1 martin großhauser mgroszhau...@gmail.com: Hello, when I try in my script to divide a masked array by a scalar I get an error. The instruction is: sppa = sp / 100. sp is a masked array with ndim = 3. error is: Traceback (most recent call last):  File

[Numpy-discussion] Curious behavior of __radd__

2012-02-01 Thread Andreas Kloeckner
Hi all, here's something I don't understand. Consider the following code snippet: --- class A(object): def __radd__(self, other): print(type(other)) import numpy as np np.complex64(1j) + A()

Re: [Numpy-discussion] Curious behavior of __radd__

2012-02-01 Thread Charles R Harris
On Wed, Feb 1, 2012 at 12:26 PM, Andreas Kloeckner li...@informa.tiker.netwrote: Hi all, here's something I don't understand. Consider the following code snippet: --- class A(object): def __radd__(self, other): print(type(other))

Re: [Numpy-discussion] Broadcasting doesn't work with divide after tile

2012-02-01 Thread Benjamin Root
2012/2/1 martin großhauser mgroszhau...@gmail.com 2012/2/1 martin großhauser mgroszhau...@gmail.com: Hello, when I try in my script to divide a masked array by a scalar I get an error. The instruction is: sppa = sp / 100. sp is a masked array with ndim = 3. error is:

[Numpy-discussion] Heads up and macro deprecation.

2012-02-01 Thread Charles R Harris
Hi All, Two things here. 1) Some macros for threading and the iterator now require a trailing semicolon. This change will be reverted before the 1.7 release so that scipy 0.10 will compile, but because it is desirable in the long term it would be helpful if folks maintaining c extensions using

Re: [Numpy-discussion] Broadcasting doesn't work with divide after tile

2012-02-01 Thread Pierre Haessig
Le 01/02/2012 21:09, Benjamin Root a écrit : I can't reproduce this bug with the latest numpy from github master. Perhaps it has been fixed by now? Hi, I've no idea what's going on, but here is my $0.02 contribution. I reproduced the bug (numpy 1.5.1) with a rather minimal script. See

[Numpy-discussion] Documentation question.

2012-02-01 Thread Charles R Harris
The macro PyArray_RemoveLargest has been replaced by PyArray_RemoveSmallest (which seems strange), but I wonder if this documentation still makes sense. diff --git a/doc/source/user/c-info.beyond-basics.rst b/doc/source/user/ c-info.beyond-basics.rs index 9ed2ab3..3437985 100644 ---

[Numpy-discussion] autocorrelation computation performance : use of np.correlate

2012-02-01 Thread Benjamin Root
On Wednesday, February 1, 2012, Pierre Haessig pierre.haes...@crans.org wrote: Hi, [I'm not sure whether this discussion belongs to numpy-discussion or scipy-dev] In day to day time series analysis I regularly need to look at the data autocorrelation (acorr or acf depending on the software

Re: [Numpy-discussion] autocorrelation computation performance : use of np.correlate

2012-02-01 Thread josef . pktd
On Wed, Feb 1, 2012 at 6:48 PM, Benjamin Root ben.r...@ou.edu wrote: On Wednesday, February 1, 2012, Pierre Haessig pierre.haes...@crans.org wrote: Hi, [I'm not sure whether this discussion belongs to numpy-discussion or scipy-dev] In day to day time series analysis I regularly need to

Re: [Numpy-discussion] Documentation question.

2012-02-01 Thread Mark Wiebe
On Wed, Feb 1, 2012 at 3:29 PM, Charles R Harris charlesr.har...@gmail.comwrote: The macro PyArray_RemoveLargest has been replaced by PyArray_RemoveSmallest (which seems strange), but I wonder if this documentation still makes sense. My impression about this code is that it went through a

Re: [Numpy-discussion] combination of list of indices and newaxis not allowed?

2012-02-01 Thread Stéfan van der Walt
On Wed, Feb 1, 2012 at 3:47 AM, Olivier Delalleau sh...@keba.be wrote: I think you just can't use newaxis in advanced indexing (doc says The newaxis object can be used in the basic slicing syntax, and does not mention newaxis in the advanced indexing part). Yes, with fancy indexing the two

Re: [Numpy-discussion] Documentation question.

2012-02-01 Thread Travis Oliphant
On Feb 1, 2012, at 7:04 PM, Mark Wiebe wrote: On Wed, Feb 1, 2012 at 3:29 PM, Charles R Harris charlesr.har...@gmail.com wrote: The macro PyArray_RemoveLargest has been replaced by PyArray_RemoveSmallest (which seems strange), but I wonder if this documentation still makes sense. My

Re: [Numpy-discussion] Documentation question.

2012-02-01 Thread Mark Wiebe
On Wed, Feb 1, 2012 at 6:14 PM, Travis Oliphant tra...@continuum.io wrote: On Feb 1, 2012, at 7:04 PM, Mark Wiebe wrote: On Wed, Feb 1, 2012 at 3:29 PM, Charles R Harris charlesr.har...@gmail.com wrote: The macro PyArray_RemoveLargest has been replaced by PyArray_RemoveSmallest (which

Re: [Numpy-discussion] Documentation question.

2012-02-01 Thread Travis Oliphant
Thanks! What a great doc page. -Travis On Feb 1, 2012, at 8:31 PM, Mark Wiebe wrote: On Wed, Feb 1, 2012 at 6:14 PM, Travis Oliphant tra...@continuum.io wrote: On Feb 1, 2012, at 7:04 PM, Mark Wiebe wrote: On Wed, Feb 1, 2012 at 3:29 PM, Charles R Harris charlesr.har...@gmail.com

Re: [Numpy-discussion] Documentation question.

2012-02-01 Thread Travis Oliphant
Hey Mark, I spent some quality time with your iterator docs tonight and look forward to getting into the code a bit more soon. I wanted to get your general impressions about what it would take to extend the iterator API to handle iterating over regions of the inputs --- i.e. to support

Re: [Numpy-discussion] Curious behavior of __radd__

2012-02-01 Thread Travis Oliphant
This seems odd to me. Unraveling what is going on (so far): Let a = np.complex64(1j) and b = A() * np.complex64.__add__ is calling np.add * np.add(a, b) needs to search for an add loop that matches the input types and it finds one with signature

Re: [Numpy-discussion] ufunc delegation to object method

2012-02-01 Thread Warren Weckesser
Bump... On Mon, Jan 30, 2012 at 1:17 AM, Warren Weckesser warren.weckes...@enthought.com wrote: In the following code, numpy.sin() calls the object's sin() function: In [2]: class Foo(object): ...: def sin(self): ...: return spam ...: In [3]: f = Foo() In [4]:

Re: [Numpy-discussion] Curious behavior of __radd__

2012-02-01 Thread Travis Oliphant
Hey Andreas, As previously described: what changes the type of np.complex64(1j) during the A() call is that when a is an array scalar it is converted to an object array because that is the only signature that matches. During this conversion, what is extracted from the object array is piped