Re: Numpy array index handling

2007-07-13 Thread Robert Kern
sturlamolden wrote: > Enthought and similar distros are in my experience "unclean". They > don't always work and they are difficult to update. I rather download > the binary installers (for Windows) and install the packages I need. Right, that's why we (I'm an Enthought employee) haven't been upda

Re: Numpy array index handling

2007-07-13 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Thanks a lot for your reply. > I'll have a look at the numpy-discussion for future issues. > > FYI, I'm using Python 2.4.3 for Windows (Enthought Edition) and the > included IPython shell. I found my mistake; importing of pylab. > E.g., this works > from pylab import * ;

Re: Numpy array index handling

2007-07-13 Thread sturlamolden
On 13 Jul, 22:52, [EMAIL PROTECTED] wrote: > It seems a bit risky to use 'from scipy import *'. Maybe it's better > to use 'import scipy' and then scipy.arange, to be sure what is > actually being used? Would there be any disadvanages with that > approach, other than more use of the keyboard? Gen

Re: Numpy array index handling

2007-07-13 Thread phishboh
Thanks a lot for your reply. I'll have a look at the numpy-discussion for future issues. FYI, I'm using Python 2.4.3 for Windows (Enthought Edition) and the included IPython shell. I found my mistake; importing of pylab. E.g., this works from pylab import * ; from scipy import * ; y = arange(3) ;

Re: Numpy array index handling

2007-07-13 Thread sturlamolden
>>> from numpy import * >>> from numpy.random import * >>> N = 100 >>> input = sign(randn(N)) >>> a = arange(N) >>> output = zeros(N) >>> output[input < 0] = 10 * a[input < 0] >>> output[input > 0] = 20 * a[input > 0] >>> Worked fine for me. S.M. -- http://mail.python.org/mailman/list

Re: Numpy array index handling

2007-07-13 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Being a Matlab user wanting to switch to Python/SciPy, Fantastic! You might be interested in joining the numpy mailing list. There are a lot more of us numpy devs and users there than here. http://www.scipy.org/Mailing_Lists > I'd like to > know how the following Mat

Numpy array index handling

2007-07-13 Thread phishboh
Being a Matlab user wanting to switch to Python/SciPy, I'd like to know how the following Matlab code would be written in Python: % First, just some artificial data N = 100 ; input = sign(randn(1, N)) ; a = (1 : N) ; % This is what I'd like to do; % for indices where the input has a certain va