safe_as_int(val, atol=0.001)
This operation calculates val
modulo 1, which returns the mantissa of all values. Then all mantissas greater than 0.5 are subtracted from one. Finally, the absolute tolerance from zero is calculated. If it is less than atol
for all value(s) in val
, they are rounded and returned in an integer array. Or, if val
was a scalar, a NumPy scalar type is returned.
If any value(s) are outside the specified tolerance, an informative error is raised.
Number or container of numbers which are intended to be interpreted as integers, e.g., for indexing purposes, but which may not carry integer type.
Absolute tolerance away from nearest integer to consider values in val
functionally integers.
Returns the input value(s) coerced to dtype :None:None:`np.int64`
assuming all were within atol
of the nearest integer.
Attempt to safely cast values to integer format.
>>> safe_as_int(7.0) 7This example is valid syntax, but we were not able to check execution
>>> safe_as_int([9, 4, 2.9999999999]) array([9, 4, 3])This example is valid syntax, but we were not able to check execution
>>> safe_as_int(53.1) Traceback (most recent call last): ... ValueError: Integer argument required but received 53.1, check inputs.This example is valid syntax, but we were not able to check execution
>>> safe_as_int(53.01, atol=0.01) 53See :
The following pages refer to to this document either explicitly or contain code examples using this.
skimage._shared.utils.safe_as_int
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