I have a numpy array called stack, lets say 50 by 50, which has a specific value at each positions (for example stack[23, 19] = -0.13). I am trying to create and if statement where if the value at any position is below a certain value, that value is turned into 0. so if stack[23, 19] = -0.13 before the if statement, it would turn into stack[23, 19] = 0 after the statement. So far I have
peaks = stack
if abs(peaks[i, i]) > -1.2 or abs(peaks[i, i]) < 1.2:
peaks[i, i] = 0
And I wants 'peaks' to retain the same 50 by 50 shape of 'stack', but this doesn't seem to work.
Any help would be appreciated! Thank you!
Aucun commentaire:
Enregistrer un commentaire