[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 tho

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 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 0

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 sppa

[Numpy-discussion] I must be wrong? -- endian detection failure on Mac OSX 10.5

2012-02-01 Thread Dustin Lang
Hi, I don't really believe this is a numpy bug that hasn't been detected, so it must be something weird about my setup, but I can't figure it out. Here goes. The symptom is that while numpy-1.4.1 builds fine, numpy-1.5.0 and later releases fail with: In file included from numpy/core/src/npym

Re: [Numpy-discussion] I must be wrong? -- endian detection failure on Mac OSX 10.5

2012-02-01 Thread Samuel John
Hi! Your Machine should be able to handle at least Mac OS X10.6 and even 10.7. If there is not a strong reason to remain on 10.5... 10.5 is so long ago, I can barely remember. cheers, Samuel On 01.02.2012, at 18:03, Dustin Lang wrote: > > Hi, > > I don't really believe this is a numpy bug t

[Numpy-discussion] Help with f2py in MacPorts environment

2012-02-01 Thread Aronne Merrelli
Hello, I'm trying to do a simple test with f2py, using the Hermite polynomial example here: http://www.scipy.org/Cookbook/F2Py I cannot figure out how to configure the compile/build commands to work with my system. I'm a novice at this stuff, so please bear with me... I'm running on Mac OS X, and

[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 matplotlib.pyplot.a

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

2012-02-01 Thread martin großhauser
2012/2/1 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/inter

[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 wrote: > 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

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

2012-02-01 Thread Benjamin Root
2012/2/1 martin großhauser > 2012/2/1 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 cal

[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 nu

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 attache

[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 --- a/doc/source/u

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

2012-02-01 Thread Benjamin Root
On Wednesday, February 1, 2012, Pierre Haessig 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 package). > The st

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 wrote: > > > On Wednesday, February 1, 2012, Pierre Haessig > 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 >> autoc

Re: [Numpy-discussion] Documentation question.

2012-02-01 Thread Mark Wiebe
On Wed, Feb 1, 2012 at 3:29 PM, Charles R Harris wrote: > 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 number of rounds trying

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 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 arguments ne

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 > wrote: > 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 c

Re: [Numpy-discussion] Documentation question.

2012-02-01 Thread Mark Wiebe
On Wed, Feb 1, 2012 at 6:14 PM, Travis Oliphant 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 seems stra

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 wrote: > > On Feb 1, 2012, at 7:04 PM, Mark Wiebe wrote: > >> On Wed, Feb 1, 2012 at 3:29 PM, Charles R Harris >> wrote: >> The macro PyArray_RemoveLarges

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 gen

Re: [Numpy-discussion] Documentation question.

2012-02-01 Thread Travis Oliphant
I believe I sent the wrong link to PDL, threading, earlier http://www.johnlapeyre.com/pdl/pdldoc/newbook/node5.html#SECTION00510 Is the explanation of threading in Perl that I was reading about. I have read about Threading earlier and really liked it's generality. I would

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 ('O

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() >

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

2012-02-01 Thread Travis Oliphant
Yes. This is the behavior. It was part of the original Numeric implementation.In the code generator file: numpy/core/code_generators/generate_umath.py ufuncs with a registered type of 'P' have this behavior. There is a long list of them. -Travis On Feb 2, 2012, at 12:04 AM,

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

2012-02-01 Thread Warren Weckesser
On Thu, Feb 2, 2012 at 12:21 AM, Travis Oliphant wrote: > Yes. This is the behavior. It was part of the original Numeric > implementation.In the code generator file: > > numpy/core/code_generators/generate_umath.py > > ufuncs with a registered type of 'P' have this behavior. There is a lon

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 t