[PYTHON MATRIX-SIG] Slice expressions

Phil Austin phil@geog.ubc.ca
Wed, 16 Oct 1996 08:17:49 -0700 (PDT)


>>>>> "Konrad" == Konrad Hinsen <hinsen@ibs.ibs.fr> writes:

    Konrad> What happened to the slice generator that was in Numeric
    Konrad> in earlier versions? It seems to have disappeared, with no
    Konrad> visible replacement.

    Konrad> Just in case someone else needs it, here's the definition
    Konrad> that I just put into my copy of Core.py:

    Konrad> ----------------------------------------------------------------------
    Konrad> class _index_expression_class:

    Konrad>     def __getitem__(self, item): if type(item) !=
    Konrad> type(()): return (item,) else: return item

    Konrad> index_expression = _index_expression_class()
    Konrad> ----------------------------------------------------------------------


An ignorant question: does this give the functionality of
a Fortran90 array mask (or logical indexes in Splus)?

i.e. is there a NumPy equivalent to this Splus expression, which finds
the warm, dark, sea-surface in a cloudy satellite image for which I
have temperature and reflectivity:

seaSurfaceIndex -> (temp > 280) & (reflec < 0.10)
meanSST -> mean(temp[seaSurfaceIndex])


Phil Austin		INTERNET: phil@geog.ubc.ca
(604) 822-2175		FAX:	  (604) 822-6150

http://www.geog.ubc.ca/~phil
Associate Professor
Atmospheric Sciences Programme
Geography #217
University of British Columbia
1984 W Mall
Vancouver, BC  V6T 1Z2
CANADA


=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================