Just in time! I was just working on a cythonic replacement to
ndimage.generic_filter (well, I took a a short two years break in the middle).
thank you very much,
Nadav.
From: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org]
Dear all,
if I have
In [395]: a
Out[395]:
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9]])
In [396]: a[...,-1]
Out[396]: array([4, 9])
In [397]: a[...,-4:-1]
Out[397]:
array([[1, 2, 3],
[6, 7, 8]])
In [398]: a[...,-4:0]
Out[398]: array([], shape=(2, 0), dtype=int64)
how can I pick up
how can I pick up something like:
array([[1, 2, 3, 4],
[6, 7, 8, 9]])
I'm not sure to understand, should not a[:,1:] be sufficient ?
Did I miss something in your message ?
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
Thanks Jean
I just want the last several numbers by indexing from the end.
In [400]: b=np.arange(20).reshape(2,10)
In [401]: b
Out[401]:
array([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]])
I want something like b[...,...(index from the end by using
you are right Eric,
In [405]: b[...,-4:]
Out[405]:
array([[ 6, 7, 8, 9],
[16, 17, 18, 19]])
cheers,
Chao
2011/10/18 Chao YUE chaoyue...@gmail.com
Thanks Jean
I just want the last several numbers by indexing from the end.
In [400]: b=np.arange(20).reshape(2,10)
In [401]: b
Dear all,
previoulsy I think np.ma.mean() will automatically filter the masked
(missing) value but it's not?
In [489]: a=np.arange(20.).reshape(2,10)
In [490]:
a=np.ma.masked_array(a,(a==2)|(a==5)|(a==11)|(a==18),fill_value=np.nan)
In [491]: a
Out[491]:
masked_array(data =
[[0.0 1.0 -- 3.0 4.0
Thanks Olivier. but I don't know how can I check it in the code (not in an
interactive mode)?
I would like:
if ndarray a is a mased array:
code 1
else
code 2
thanks again,
Chao
2011/10/18 Olivier Delalleau sh...@keba.be
You could simply check if it has a 'mask' attribute. You can
As far as I can tell ma.mean() is working as expected here: it computes the
mean only over non-masked values.
If you want to get rid of any mean that was computed over a series
containing masked value you can do:
b = a.mean(0)
b.mask[a.mask.any(0)] = True
Then b will be:
masked_array(data =
if hasattr(a, 'mask'): # or if isinstance(a, numpy.ma.core.MaskedArray.)
code 1
else
code 2
-=- Olivier
2011/10/18 Chao YUE chaoyue...@gmail.com
Thanks Olivier. but I don't know how can I check it in the code (not in an
interactive mode)?
I would like:
if ndarray a is a mased
really cool, thanks.
Chao
2011/10/18 Olivier Delalleau sh...@keba.be
if hasattr(a, 'mask'): # or if isinstance(a, numpy.ma.core.MaskedArray.)
code 1
else
code 2
-=- Olivier
2011/10/18 Chao YUE chaoyue...@gmail.com
Thanks Olivier. but I don't know how can I check it in the
On 18 October 2011 13:56, Chao YUE chaoyue...@gmail.com wrote:
but it's strange that if you use b[...,-1],
you get:
In [402]: b[...,-1]
Out[402]: array([ 9, 19])
if use b[...,-4:-1],
you get:
Out[403]:
array([[ 6, 7, 8],
[16, 17, 18]])
That's because you're mixing two different
thanks. Olivier. I see.
Chao
2011/10/18 Olivier Delalleau sh...@keba.be
As far as I can tell ma.mean() is working as expected here: it computes the
mean only over non-masked values.
If you want to get rid of any mean that was computed over a series
containing masked value you can do:
b =
thanks Scott. very good explanation.
cheers,
Chao
2011/10/18 Scott Sinclair scott.sinclair...@gmail.com
On 18 October 2011 13:56, Chao YUE chaoyue...@gmail.com wrote:
but it's strange that if you use b[...,-1],
you get:
In [402]: b[...,-1]
Out[402]: array([ 9, 19])
if use
Thanks Bruce.
2011/10/18 Bruce Southey bsout...@gmail.com
**
On 10/18/2011 09:12 AM, Chao YUE wrote:
thanks. Olivier. I see.
Chao
2011/10/18 Olivier Delalleau sh...@keba.be
As far as I can tell ma.mean() is working as expected here: it computes
the mean only over non-masked values.
What about a parameter that allow to select the option the user want?
it would select between uint, upcasted_int, -MAX and +MAX. This way,
at least it will be documented and user who care will have the choose.
Personally, when the option is available, I would prefer the safe
version, uint, but I
Hi,
2011/10/18 Frédéric Bastien no...@nouiz.org:
What about a parameter that allow to select the option the user want?
it would select between uint, upcasted_int, -MAX and +MAX. This way,
at least it will be documented and user who care will have the choose.
Personally, when the option is
On Tue, Oct 11, 2011 at 4:59 PM, Robert Cimrman cimrm...@ntc.zcu.cz wrote:
Hi,
I have now spent several hours hunting down a major slowdown of my code
caused
(apparently) by using config.add_library() for a reusable part of C source
files instead of just config.add_extension().
The reason
17 matches
Mail list logo