From 67fc15e001df7cc55e3d8736389e2494cb013568 Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Wed, 3 Nov 2021 10:15:44 +0000 Subject: [PATCH] Corr.__get_item__ now returns an Obs in case there is only one entry per timeslice --- pyerrors/correlators.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pyerrors/correlators.py b/pyerrors/correlators.py index ab210da9..65b26525 100644 --- a/pyerrors/correlators.py +++ b/pyerrors/correlators.py @@ -63,7 +63,11 @@ class Corr: self.gamma_method() def __getitem__(self, idx): - return self.content[idx] + """Return the content of timeslice idx""" + if len(self.content[idx]) == 1: + return self.content[idx][0] + else: + return self.content[idx] @property def reweighted(self): @@ -250,7 +254,7 @@ class Corr: on the configurations in obs[i].idl. """ new_content = [] - for t_slice in self: + for t_slice in self.content: if t_slice is None: new_content.append(None) else: @@ -274,7 +278,7 @@ class Corr: T_partner = parity * partner.reverse() t_slices = [] - for x0, t_slice in enumerate(self - T_partner): + for x0, t_slice in enumerate((self - T_partner).content): if t_slice is not None: if not t_slice[0].is_zero_within_error(5): t_slices.append(x0)