Le lundi 22 septembre 2008 à 09:41 -0500, John Hunter a écrit :
> I have a an array of indices into a larger array where some condition
> is satisfied.  I want to create a larger set of indices which *mark*
> all the indicies following the condition over some Nmark length
> window.

A = np.random.rand(N)
What about that:
        marked = (A<0.01)

> In the real use case, there will be significant auto-correlation among
> the places where the condition is satisfied.  Eg, if it is satisfied
> at some index, it is likely that it will be satisfied for many of its
> neighbors.  Eg, the real case looks more like
> 
>     y = np.sin(2*np.pi*np.linspace(0, 2, N))
> 
>     ind = np.nonzero(y>0.95)[0]
>     marked2 = np.zeros(N, bool)
>     for i in ind:
>         marked2[i:i+Nmark] = True

I do not understand what you do expect here to code...

-- 
Fabrice Silva <[EMAIL PROTECTED]>
LMA UPR CNRS 7051

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to