I think you're looking for the errstate context manager:
https://numpy.org/doc/stable/reference/generated/numpy.errstate.html
On Thu, May 9, 2024 at 1:11 PM wrote:
> The current way (according to 1.26 doc) of setting and resetting error is
> ```
> old_settings = np.seterr(all='ignore') #seterr
The current way (according to 1.26 doc) of setting and resetting error is
```
old_settings = np.seterr(all='ignore') #seterr to known value
np.seterr(over='raise')
{'divide': 'ignore', 'over': 'ignore', 'under': 'ignore', 'invalid': 'ignore'}
np.seterr(**old_settings) # reset to default
```
This