[SciPy-User] hemisphere function

Pauli Virtanen pav@iki...
Wed Nov 24 13:16:49 CST 2010


On Wed, 24 Nov 2010 13:00:24 +0100, John wrote:
> Is there a function in scipy for a hemisphere?

No. IMO, there's no need to have it either.

> Something like:
> 
> def hemisphere(X,Y,a):
>     """ hemisphere over 2d X,Y """
>     h = np.sqrt(a-X**2-Y**2)
>     return h

That should work fine.

If you want a masked array, return numpy.ma.masked_invalid(h).

-- 
Pauli Virtanen



More information about the SciPy-User mailing list