bundles / scipy 1.17.1 / scipy / special / _ufuncs / errstate
class
scipy.special._ufuncs:errstate
source: /scipy/special/_ufuncs.cpython-314-x86_64-linux-gnu.so
Signature
class errstate ( ** kwargs ) Members
Summary
Context manager for special-function error handling.
Extended Summary
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 treatment for the particular type of error. Values must be 'ignore', 'warn', or 'other'. See seterr for details.
Examples
import scipy.special as sc from pytest import raises✓
sc.gammaln(0)
✗with sc.errstate(singular='raise'): with raises(sc.SpecialFunctionError): sc.gammaln(0)✓
sc.gammaln(0)
✗with sc.errstate(all='raise', singular='ignore'): sc.gammaln(0) with raises(sc.SpecialFunctionError): sc.spence(-1)✗
See also
Aliases
-
scipy.special.errstate