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. In code:
import numpy as np
N = 1000
Nmark = 20
ind =
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 =
On Mon, Sep 22, 2008 at 09:41, John Hunter [EMAIL PROTECTED] wrote:
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. In code:
On Mon, Sep 22, 2008 at 10:13 AM, Robert Kern [EMAIL PROTECTED] wrote:
marked[ind + np.arange(Nmark)] = True
That triggers a broadcasting error:
Traceback (most recent call last):
File /home/titan/johnh/test.py, line 13, in ?
marked3[ind + np.arange(Nmark)] = True
ValueError: shape
On Mon, Sep 22, 2008 at 10:22, Robert Kern [EMAIL PROTECTED] wrote:
ind2mark = np.asarray((ind[:,np.newaxis] + np.arange(Nmark).flat).clip(0, N-1)
marked[ind2mark] = True
Missing parenthesis:
ind2mark = np.asarray((ind[:,np.newaxis] + np.arange(Nmark)).flat).clip(0, N-1)
--
Robert Kern
I
On Mon, Sep 22, 2008 at 10:23 AM, Robert Kern [EMAIL PROTECTED] wrote:
On Mon, Sep 22, 2008 at 10:22, Robert Kern [EMAIL PROTECTED] wrote:
ind2mark = np.asarray((ind[:,np.newaxis] + np.arange(Nmark).flat).clip(0,
N-1)
marked[ind2mark] = True
Missing parenthesis:
ind2mark =