package scipy

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `Errstate
]
type t = [ `Errstate | `Object ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val create : ?kwargs:(string * Py.Object.t) list -> unit -> t

Context manager for special-function error handling.

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.

See Also -------- geterr : get the current way of handling special-function errors seterr : set how special-function errors are handled numpy.errstate : similar numpy function for floating-point errors

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

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Stdlib.Format.formatter -> t -> unit

Pretty-print the object to a formatter.

OCaml

Innovation. Community. Security.