When I got np.where that tries to avoid division by zero, I am still getting the error, even when p_arr - 0.5 should be always > 0.
mo = np.where(p_arr > 0.5, -6.93/(p_arr - 0.5), 10)
RuntimeWarning: divide by zero encountered in true_divide
mo = np.where(p_arr > 0.5, -6.93/(p_arr - 0.5), 10)
Any idea why and how to fix that? Additionally is there any way to debug it properly, so the error would show what was the exact value from p_arr?
Some tests:
x = np.where(p_arr > 0.5, p_arr, 1)
print(np.all((p_arr - 0.5 != 0))) # FALSE
print(np.all((x - 0.5 != 0))) # TRUE