I found this which allows to break on exception.
However, what I'd like is to break on a warning. This is the warning I get and would like if this or another warning are reported to break at that point.
RuntimeWarning: invalid value encountered in double_scalars yv = Nv(v, U*r)/Nv(v, U*r_)
Thanks in advance.