vendredi 13 décembre 2019

If function using future arrays

I have an np.array with multiple arrays within.

bool_window = (10,128,1)

in this case i have 10 arrays of (128,1). The data within the array is either 0 or 1 and i want to use this code to check if the next array has more 1 than the one before.

for i in bool_window:
    if (np.count_nonzero(i) > 0)  and (np.count_nonzero(i) < 128) and np.count_nonzero(i) < np.count_nonzero(i+1):
        print('In this array there are ', np.count_nonzero(i), ' events')

The problem is that np.count_nonzero(i+1) is not working properly. Is there a way to say that the next array needs to be bigger than the actual one?

Aucun commentaire:

Enregistrer un commentaire