Warnings
How to filter, record or escalate them: Warnings.
VolesWarning
Bases: UserWarning
Base class of every warning voles emits.
Each diagnostic is issued once per solver call with warnings.warn,
attributed to the line that called the solver, so the standard
warnings filters apply. Python shows a given warning once per
calling line by default.
See Also
- AccuracyWarning, PerformanceWarning: the two kinds.
Examples:
A first-kind equation with \(g(0) \ne 0\) has no bounded solution, so voles warns. Make that an error:
>>> import warnings
>>> import numpy as np
>>> import voles
>>> with warnings.catch_warnings():
... warnings.simplefilter("error", voles.AccuracyWarning)
... voles.solve_vie1(kernel=np.ones(10), g=np.ones(10))
Traceback (most recent call last):
...
voles.AccuracyWarning: g(0) is not zero ...
or silence every voles diagnostic in a block:
>>> with warnings.catch_warnings():
... warnings.simplefilter("ignore", voles.VolesWarning)
... sol = voles.solve_vie1(kernel=np.ones(10), g=np.ones(10))
Source code in src/voles/_warnings.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
AccuracyWarning
Bases: VolesWarning
The requested method runs, but the result is less accurate than its nominal order suggests (reduced order, an ill-posed start, an unstable regime, or a mesh that doesn't suit the declared singularity).
Source code in src/voles/_warnings.py
59 60 61 62 63 | |
PerformanceWarning
Bases: VolesWarning
The result is correct, but it comes from a slower code path than the one normally used (the numba fallback, or an extension build that lacks a fast path).
Source code in src/voles/_warnings.py
66 67 68 69 70 | |