This is normally done:
```
err = np.seterr(invalid='ignore')
...
np.seterr(**err)
```
See examples in `numpy/core/tests/test_umath.py`. However, now that we don't support Python2.4 you can use a context manager, `with warnings.catch_warnings():`