elephant.utils.round_binning_errors¶
- elephant.utils.round_binning_errors(values, tolerance=1e-08)[source]¶
Round the input values in-place due to the machine floating point precision errors.
- Parameters:
- valuesnp.ndarray or float
An input array or a scalar.
- tolerancefloat or None, optional
The precision error absolute tolerance; acts as
atol
innumpy.isclose()
function. If None, no rounding is performed. Default: 1e-8
- Returns:
- valuesnp.ndarray or int
Corrected integer values.
Examples
>>> from elephant.utils import round_binning_errors >>> round_binning_errors(0.999999, tolerance=None) 0 >>> round_binning_errors(0.999999, tolerance=1e-6) 1