seterrobj(errobj, /)
The error object contains all information that defines the error handling behavior in NumPy. seterrobj
is used internally by the other functions that set error handling behavior (seterr
, seterrcall
).
For complete documentation of the types of floating-point exceptions and treatment options, see seterr
.
The error object, a list containing three elements: [internal numpy buffer size, error mask, error callback function].
The error mask is a single integer that holds the treatment information on all four floating point errors. The information for each error type is contained in three bits of the integer. If we print it in base 8, we can see what treatment is set for "invalid", "under", "over", and "divide" (in that order). The printed string can be interpreted with
Set the object that defines floating-point error handling.
>>> old_errobj = np.geterrobj() # first get the defaultsThis example is valid syntax, but we were not able to check execution
... old_errobj [8192, 521, None]
>>> def err_handler(type, flag):This example is valid syntax, but we were not able to check execution
... print("Floating point error (%s), with flag %s" % (type, flag)) ...
>>> new_errobj = [20000, 12, err_handler]This example is valid syntax, but we were not able to check execution
... np.seterrobj(new_errobj)
... np.base_repr(12, 8) # int for divide=4 ('print') and over=1 ('warn') '14'
>>> np.geterr() {'over': 'warn', 'divide': 'print', 'invalid': 'ignore', 'under': 'ignore'}This example is valid syntax, but we were not able to check execution
>>> np.geterrcall() is err_handler TrueSee :
The following pages refer to to this document either explicitly or contain code examples using this.
numpy.geterrobj
numpy.seterrobj
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