def tiny2zero(x, eps=1e-15):
 mask = (np.abs(x.copy()) < eps)
 x[mask] = 0
 return x

def tiny2zero ( x , eps = 1e-15 ) : mask = ( np . abs ( x . copy ( ) ) < eps ) x [ mask ] = 0 return x
replace abs values smaller than eps by zero .