From be4d9f722e51d44cbe6ac5cf3ea60902f68ccb30 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Sat, 16 Oct 2021 11:21:19 +0100 Subject: [PATCH] repr and str exchanged --- pyerrors/correlators.py | 4 ++-- pyerrors/pyerrors.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pyerrors/correlators.py b/pyerrors/correlators.py index 9868a5c1..0e8b74fa 100644 --- a/pyerrors/correlators.py +++ b/pyerrors/correlators.py @@ -402,7 +402,7 @@ class Corr: if plateau: if isinstance(plateau, Obs): - ax1.axhline(y=plateau.value, linewidth=2, color=plt.rcParams['text.color'], alpha=0.6, marker=',', ls='--', label=plateau.__repr__()) + ax1.axhline(y=plateau.value, linewidth=2, color=plt.rcParams['text.color'], alpha=0.6, marker=',', ls='--', label=str(plateau)) ax1.axhspan(plateau.value - plateau.dvalue, plateau.value + plateau.dvalue, alpha=0.25, color=plt.rcParams['text.color'], ls='-') else: raise Exception('plateau must be an Obs') @@ -451,7 +451,7 @@ class Corr: else: content_string += str(i + range[0]) for element in sub_corr: - content_string += '\t' + element.__repr__() + content_string += '\t' + str(element) content_string += '\n' return content_string diff --git a/pyerrors/pyerrors.py b/pyerrors/pyerrors.py index 5febd9ec..e4262af6 100644 --- a/pyerrors/pyerrors.py +++ b/pyerrors/pyerrors.py @@ -473,6 +473,9 @@ class Obs: pickle.dump(self, fb) def __repr__(self): + return 'Obs[' + str(self) + ']' + + def __str__(self): if self.dvalue == 0.0: return str(self.value) fexp = np.floor(np.log10(self.dvalue)) @@ -483,9 +486,6 @@ class Obs: else: return '{:.0f}({:2.0f})'.format(self.value, self.dvalue) - def __str__(self): - return 'Obs[' + self.__repr__() + ']' - # Overload comparisons def __lt__(self, other): return self.value < other