npr.Zq now checks if imag part is at machine precision

This commit is contained in:
Fabian Joswig 2021-10-25 12:24:54 +01:00
parent 325293f2b4
commit 68b25ba4ca

View file

@ -92,10 +92,7 @@ def Zq(inv_prop, fermion='Wilson'):
res = 1 / 12. * np.trace(matmul(inv_prop, np.kron(np.eye(3, dtype=int), p_slash)))
res.gamma_method()
if not res.imag.is_zero_within_error(5):
if not res.imag.is_zero() and not res.imag.is_zero_within_error(5):
warnings.warn("Imaginary part of Zq is not zero within 5 sigma")
return res
if not np.abs(res.imag.value) <= 1e-6:
warnings.warn("Imaginary part of Zq is not smaller than 1e-6")
return res
return res.real