bundles / scipy latest / scipy / special / _ufuncs / seterr
cython_function_or_method
scipy.special._ufuncs:seterr
Signature
def seterr ( ** kwargs ) Summary
Set how special-function errors are handled.
Parameters
all: {'ignore', 'warn' 'raise'}, optionalSet treatment for all type of special-function errors at once. The options are:
'ignore' Take no action when the error occurs
'warn' Print a SpecialFunctionWarning when the error occurs (via the Python warnings module)
'raise' Raise a SpecialFunctionError when the error occurs.
The default is to not change the current behavior. If behaviors for additional categories of special-function errors are specified, then
allis applied first, followed by the additional categories.singular: {'ignore', 'warn', 'raise'}, optionalTreatment for singularities.
underflow: {'ignore', 'warn', 'raise'}, optionalTreatment for underflow.
overflow: {'ignore', 'warn', 'raise'}, optionalTreatment for overflow.
slow: {'ignore', 'warn', 'raise'}, optionalTreatment for slow convergence.
loss: {'ignore', 'warn', 'raise'}, optionalTreatment for loss of accuracy.
no_result: {'ignore', 'warn', 'raise'}, optionalTreatment for failing to find a result.
domain: {'ignore', 'warn', 'raise'}, optionalTreatment for an invalid argument to a function.
arg: {'ignore', 'warn', 'raise'}, optionalTreatment for an invalid parameter to a function.
other: {'ignore', 'warn', 'raise'}, optionalTreatment for an unknown error.
Returns
olderr: dictDictionary containing the old settings.
Examples
import scipy.special as sc from pytest import raises✓
sc.gammaln(0)
✗olderr = sc.seterr(singular='raise') with raises(sc.SpecialFunctionError): sc.gammaln(0) _ = sc.seterr(**olderr)✓
olderr = sc.seterr(all='raise', singular='ignore')
✓sc.gammaln(0)
✗with raises(sc.SpecialFunctionError): sc.spence(-1) _ = sc.seterr(**olderr)✓
See also
Aliases
-
scipy.special.seterr