scijit.integrate.IntegrationWarning

exception scijit.integrate.IntegrationWarning

Bases: UserWarning

Warning category emitted on a soft failure during integration.

Raised at two conditions: a soft QUADPACK failure (ier in 1, 2, 3, 4, 5, 7) with full_output false, and points given together with weight. The message carries the limit substituted into the ier = 1 text, and separate wording for ier 1, 4 and 7 on the cos/sin route to infinity, where a subdivision is a cycle.

See also

scipy.integrate.IntegrationWarning

The scipy category this mirrors.

Notes

This is a DIFFERENT CLASS OBJECT from scipy.integrate. IntegrationWarning, with the same name and the same base. A filter naming this class selects it, and so does one naming UserWarning or a bare warnings.catch_warnings(record=True). A filter naming scipy’s class does NOT: simplefilter('error', scipy.integrate.IntegrationWarning) leaves this warning as a warning, and except scijit.integrate.IntegrationWarning does not catch a scipy one. Ported code that turns scipy’s class into an exception names this one as well.

Examples

The warning is emitted by quad(); the filter that catches it is Python-level, since warnings.catch_warnings does not run inside @njit:

>>> import numpy as np
>>> import warnings
>>> from numba import njit
>>> import scijit.integrate as si
>>> @njit
... def f(x):
...     return np.cos(x)
>>> with warnings.catch_warnings(record=True) as w:
...     warnings.simplefilter('always')
...     v, e = si.quad(f, 0.0, 1.0, (), False, 1.49e-8, 1.49e-8, 50,
...                    np.array([0.5]), 'cos', 1.0)
>>> issubclass(w[0].category, si.IntegrationWarning)
True