From 078ee76b29a83857c17cf72df89e991c9ee1acbc Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Wed, 20 Oct 2021 13:32:38 +0100 Subject: [PATCH] _check_geometry added --- pyerrors/npr.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pyerrors/npr.py b/pyerrors/npr.py index f5ea8802..402308db 100644 --- a/pyerrors/npr.py +++ b/pyerrors/npr.py @@ -111,15 +111,24 @@ class Npr_matrix(np.ndarray): self.mom_out = getattr(obj, 'mom_out', None) +def _check_geometry(): + if L is None: + raise Exception("Spatial extent 'L' not set.") + else: + if not isinstance(L, int): + raise Exception("Spatial extent 'L' must be an integer.") + if T is None: + raise Exception("Temporal extent 'T' not set.") + if not isinstance(T, int): + raise Exception("Temporal extent 'T' must be an integer.") + + def _invert_propagator(prop): return Npr_matrix(mat_mat_op(anp.linalg.inv, prop), prop.mom_in) def Zq(prop, fermion='Wilson'): - if L is None: - raise Exception("Spatial extent 'L' not set.") - if T is None: - raise Exception("Spatial extent 'T' not set.") + _check_geometry() mom = prop.mom_in mom[3] /= T / L sin_mom = np.sin(2 * np.pi / L * mom)