Steve Schmerler
2006-06-21 20:04:54 UTC
First of all: what's better (a) post this only on the numpy list (b)
only on the scipy list (I think many scipy users may find the answer to
questions like this one interesting) or (c) post on both.
I can't extract elements from array x with a mask array of indices but
x.take (Numeric style works). I'm sure that I have done such things
before .... and they worked.
In [58]: x
Out[58]: array([0, 0, 1, 2, 3, 0, 0, 9])
In [59]: mask=where(x!=0.0)[0]
In [60]: mask
Out[60]: array([2, 3, 4, 7])
In [61]: x.take(mask)
Out[61]: array([1, 2, 3, 9])
In [62]: x(mask)
---------------------------------------------------------------------------
exceptions.TypeError Traceback (most
recent call last)
/home/elcorto/ode_testdata/<ipython console>
TypeError: 'numpy.ndarray' object is not callable
In [63]: numpy.__version__
Out[63]: '0.9.9.2612'
cheers,
steve
only on the scipy list (I think many scipy users may find the answer to
questions like this one interesting) or (c) post on both.
I can't extract elements from array x with a mask array of indices but
x.take (Numeric style works). I'm sure that I have done such things
before .... and they worked.
In [58]: x
Out[58]: array([0, 0, 1, 2, 3, 0, 0, 9])
In [59]: mask=where(x!=0.0)[0]
In [60]: mask
Out[60]: array([2, 3, 4, 7])
In [61]: x.take(mask)
Out[61]: array([1, 2, 3, 9])
In [62]: x(mask)
---------------------------------------------------------------------------
exceptions.TypeError Traceback (most
recent call last)
/home/elcorto/ode_testdata/<ipython console>
TypeError: 'numpy.ndarray' object is not callable
In [63]: numpy.__version__
Out[63]: '0.9.9.2612'
cheers,
steve
--
Random number generation is the art of producing pure gibberish as
quickly as possible.
Random number generation is the art of producing pure gibberish as
quickly as possible.