diff --git a/python/damask/util.py b/python/damask/util.py index a04ee47de..655f75879 100644 --- a/python/damask/util.py +++ b/python/damask/util.py @@ -172,8 +172,9 @@ def scale_to_coprime(v): m = (np.array(v) * reduce(lcm, map(lambda x: int(get_square_denominator(x)),v)) ** 0.5).astype(np.int) m = m//reduce(np.gcd,m) - if not np.allclose(v[v.nonzero()]/m[v.nonzero()],v[v.nonzero()][0]/m[m.nonzero()][0]): - raise ValueError(f'Invalid result {m} for input {v}. Insufficient precision?') + with np.errstate(divide='ignore'): + if not np.allclose(v/m,v[0]/m[0]): + raise ValueError(f'Invalid result {m} for input {v}. Insufficient precision?') return m