psychopy.tools.mathtools.zeroFix

psychopy.tools.mathtools.zeroFix(a, inplace=False, threshold=None)[source]

Fix zeros in an array.

This function truncates very small numbers in an array to zero and removes any negative zeros.

Parameters
  • a (ndarray) – Input array, must be a Numpy array.

  • inplace (bool) – Fix an array inplace. If True, the input array will be modified, otherwise a new array will be returned with same dtype and shape with the fixed values.

  • threshold (float or None) – Threshold for truncation. If None, the machine epsilon value for the input array dtype will be used. You can specify a custom threshold as a float.

Returns

Output array with zeros fixed.

Return type

ndarray


Back to top