From a previous post, I learned how to change all values in a 2D-Array in a very fast and easy way:
e.g. set all values smaller than 255 to x:
arr[arr < 255] = x
Now I want to do something similar, but not just setting the value to x.
I want to manipulate the value in this array in a specific way when it's below a treshold.
arr[abs(arr) < threshold] = arr(*where condition is true*) - threshold*x
arr - theshold*x does not work, since arr is the complete array.
I think that a loop with np.where is needed to solve this problem which isn't quite easy as before. Is there any better way?