Re: [Numpy-discussion] mask one array using another array

2011-11-21 Thread questions anon
numpy.tile is what I was after. Thank you! On Tue, Nov 22, 2011 at 1:13 PM, Olivier Delalleau wrote: > I can't really figure out if that's the case in your code, but if you need > to repeat the mask along a new dimension (for instance, the first one), you > can do: > > numpy.tile(mask.mask, [num

Re: [Numpy-discussion] mask one array using another array

2011-11-21 Thread Olivier Delalleau
I can't really figure out if that's the case in your code, but if you need to repeat the mask along a new dimension (for instance, the first one), you can do: numpy.tile(mask.mask, [number_of_repeats] + [1] * len(mask.mask.shape)) (not sure that's the most elegant way to do it, but it should work

Re: [Numpy-discussion] mask one array using another array

2011-11-21 Thread questions anon
Excellent, thank you. I just realised this does not work with my data because of the extra dimension. I have a mask that matches my 2-dimensional array but my data is for every hour over a month so the arrays do not match. Is there a way to make them match or mask each time? thanks again This is s

[Numpy-discussion] subclassing ndarray

2011-11-21 Thread Chris.Barker
Hi folks, I'm working on a "ragged array" class -- an array that can store and work with what can be considered tabular data, with the rows of different lengths: """ ragged_array A "ragged" array class -- build on numpy The idea is to be able to store data that is essentially 2-d, but each

Re: [Numpy-discussion] mask one array using another array

2011-11-21 Thread Olivier Delalleau
If your new array is x, you can use: numpy.ma.masked_array(x, mask=mask.mask) -=- Olivier 2011/11/21 questions anon > I am trying to mask one array using another array. > > I have created a masked array using > mask=MA.masked_equal(myarray, > 0), > that looks something like: > [1 - - 1, >

[Numpy-discussion] mask one array using another array

2011-11-21 Thread questions anon
I am trying to mask one array using another array. I have created a masked array using mask=MA.masked_equal(myarray, 0), that looks something like: [1 - - 1, 1 1 - 1, 1 1 1 1, - 1 - 1] I have an array of values that I want to mask whereever my mask has a a '-'. how do I do this? I

Re: [Numpy-discussion] PyPy guys deserve some help on micronumpy from you, numpy gurus!

2011-11-21 Thread Peter
On Fri, Sep 16, 2011 at 10:49 AM, Peter wrote: > On Thu, Sep 15, 2011 at 11:34 AM, Peter > wrote: >> This may not be the best place to ask, but how should a >> python script (e.g. setup.py) distinguish between real NumPy >> and micronumpy? Or should I instead be looking to distinguish >> PyPy ver