From f39a70c5a86ab8e14f90def05eedc227b35c59c9 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Tue, 20 Dec 2022 17:40:41 +0100 Subject: [PATCH] fix: Corr.__repr__ also works for complex correlators. --- pyerrors/correlators.py | 2 ++ tests/correlators_test.py | 1 + 2 files changed, 3 insertions(+) diff --git a/pyerrors/correlators.py b/pyerrors/correlators.py index 3e0ad600..c39c7095 100644 --- a/pyerrors/correlators.py +++ b/pyerrors/correlators.py @@ -969,6 +969,8 @@ class Corr: content_string += "Description: " + self.tag + "\n" if self.N != 1: return content_string + if isinstance(self[0], CObs): + return content_string if print_range[1]: print_range[1] += 1 diff --git a/tests/correlators_test.py b/tests/correlators_test.py index 222f8030..49c950be 100644 --- a/tests/correlators_test.py +++ b/tests/correlators_test.py @@ -539,3 +539,4 @@ def test_complex_Corr(): cobs = pe.CObs(o1, o1) ccorr = pe.Corr([cobs, cobs, cobs]) assert np.all([ccorr.imag[i] == ccorr.real[i] for i in range(ccorr.T)]) + print(ccorr)