SciPy

scipy.special.errprint

scipy.special.errprint(inflag=None)

Set or return the error printing flag for special functions.

Parameters:

inflag : bool, optional

Whether warnings concerning evaluation of special functions in scipy.special are shown. If omitted, no change is made to the current setting.

Returns:

old_flag : bool

Previous value of the error flag

Examples

Turn on error printing.

>>> import warnings
>>> import scipy.special as sc
>>> sc.bdtr(-1, 10, 0.3)
nan
>>> sc.errprint(True)
False
>>> with warnings.catch_warnings(record=True) as w:
...     sc.bdtr(-1, 10, 0.3)
...
nan
>>> len(w)
1
>>> w[0].message
SpecialFunctionWarning('scipy.special/bdtr: domain error',)