[SciPy-dev] slicing using Index and Mask arrays

Fernando Perez Fernando.Perez at colorado.edu
Thu Jun 10 12:44:06 CDT 2004


Travis Oliphant wrote:
> I have just added a feature to scipy in CVS
> 
> This feature lets
> 
> a[a > 3] = 10
> a[indexarray] = 3
> 
> and so forth  to function.

So far so good!  This is a great addition, this message is just to report that
it works here with current CVS, Numeric 23.1 built with dotblas on, and a
binary ATLAS as supplied by scipy.org:

planck[~]> scipy

IPython profile: scipy

Welcome to the SciPy Scientific Computing Environment.

In [1]: a=arange(10)

In [2]: a[a>3]=9
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)

/home/fperez/<console>

IndexError: invalid index

In [3]: scipy.alter_numeric()

In [4]: a[a>3]=9

In [5]: a
Out[5]: NumPy array, format: long
[0 1 2 3 9 9 9 9 9 9]

In [6]: scipy.restore_numeric()

In [7]: a[a>3]=9
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)

/home/fperez/<console>

IndexError: invalid index


I'll enable the alter_numeric() from now on permanently for me.

Many thanks!

f.




More information about the Scipy-dev mailing list