[SciPy-user] mapping bool array...

Gael Varoquaux gael.varoquaux@normalesup....
Fri Aug 24 02:44:13 CDT 2007


On Fri, Aug 24, 2007 at 09:04:25AM +0200, fred wrote:
> My bool array is a mask array: it contains false & true.
> The "shape" which contains true inside this mask has the shape of an 
> ellipse.

> I want to create a float array which has the same dimension
> as the mask: inside the ellispoide, I want to put scalars from another array
> which has the right dimensions to fit those of the ellipse's,
> and outside, I want to put 0.

> How can I do this, in a ? numpy/scipy way ? ?

Something like (not tested):

a[b == 0] = c[b == 0]

Get the idea ?

Gaël


More information about the SciPy-user mailing list