xpipe.tools.selector.safedivide¶
- xpipe.tools.selector.safedivide(x, y, eps=1e-08)[source]¶
Calculates x / y for arrays, setting result to zero if x ~ 0 OR y ~ 0
Defined such that
but
and and
- Parameters
x (np.array)
y (np.array)
eps (float) – threshold for setting element to zero
- Returns
x / y where (xabs > eps) and (yabs > eps), 0 elsewhere
- Return type
np.array