scipy 1.8.0 Pypi GitHub Homepage
Other Docs
ParametersBackRef

Using an instance of errstate as a context manager allows statements in that context to execute with a known error handling behavior. Upon entering the context the error handling is set with seterr , and upon exiting it is restored to what it was before.

Parameters

kwargs : {all, singular, underflow, overflow, slow, loss, no_result, domain, arg, other}

Keyword arguments. The valid keywords are possible special-function errors. Each keyword should have a string value that defines the treatement for the particular type of error. Values must be 'ignore', 'warn', or 'other'. See seterr for details.

Context manager for special-function error handling.

See Also

geterr

get the current way of handling special-function errors

numpy.errstate

similar numpy function for floating-point errors

seterr

set how special-function errors are handled

Examples

>>> import scipy.special as sc
... from pytest import raises
... sc.gammaln(0) inf
>>> with sc.errstate(singular='raise'):
...  with raises(sc.SpecialFunctionError):
...  sc.gammaln(0) ...
>>> sc.gammaln(0)
inf

We can also raise on every category except one.

>>> with sc.errstate(all='raise', singular='ignore'):
...  sc.gammaln(0)
...  with raises(sc.SpecialFunctionError):
...  sc.spence(-1) ... inf
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.special._ufuncs.geterr scipy.special._ufuncs.seterr scipy.special._ufuncs.errstate

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/special/_ufuncs.cpython-39-darwin.so#None
type: <class 'type'>
Commit: