From 8488df00fd5293723cb40ffbfcbc34d9c9678b5e Mon Sep 17 00:00:00 2001 From: Fabian Joswig Date: Fri, 15 Oct 2021 11:47:41 +0100 Subject: [PATCH] zero_within_error method added, warnings added to Corr methods symmetric and anti-symmetric --- README.md | 2 +- pyerrors/correlators.py | 6 ++++++ pyerrors/pyerrors.py | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 31adec9d..7401d2b1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![flake8 Lint](https://github.com/fjosw/pyerrors/actions/workflows/flake8.yml/badge.svg)](https://github.com/fjosw/pyerrors/actions/workflows/flake8.yml) [![CI](https://github.com/fjosw/pyerrors/actions/workflows/CI.yml/badge.svg)](https://github.com/fjosw/pyerrors/actions/workflows/CI.yml)[![](https://img.shields.io/badge/python-3.5+-blue.svg)](https://www.python.org/downloads/) +[![flake8 Lint](https://github.com/fjosw/pyerrors/actions/workflows/flake8.yml/badge.svg)](https://github.com/fjosw/pyerrors/actions/workflows/flake8.yml) [![CI](https://github.com/fjosw/pyerrors/actions/workflows/CI.yml/badge.svg)](https://github.com/fjosw/pyerrors/actions/workflows/CI.yml) [![](https://img.shields.io/badge/python-3.5+-blue.svg)](https://www.python.org/downloads/) # pyerrors pyerrors is a python package for error computation and propagation of Markov Chain Monte Carlo data. It is based on the gamma method [arXiv:hep-lat/0306017](https://arxiv.org/abs/hep-lat/0306017). Some of its features are: diff --git a/pyerrors/correlators.py b/pyerrors/correlators.py index 33809267..10bc3b14 100644 --- a/pyerrors/correlators.py +++ b/pyerrors/correlators.py @@ -129,6 +129,9 @@ class Corr: if self.T % 2 != 0: raise Exception("Can not symmetrize odd T") + if np.argmax(np.abs(self.content)) != 0: + print('Warning: correlator does not seem to be symmetric around x0=0.') + newcontent = [self.content[0]] for t in range(1, self.T): if (self.content[t] is None) or (self.content[self.T - t] is None): @@ -144,6 +147,9 @@ class Corr: if self.T % 2 != 0: raise Exception("Can not symmetrize odd T") + if not all([o.zero_within_error() for o in self.content[0]]): + print('Warning: correlator does not seem to be anti-symmetric around x0=0.') + newcontent = [self.content[0]] for t in range(1, self.T): if (self.content[t] is None) or (self.content[self.T - t] is None): diff --git a/pyerrors/pyerrors.py b/pyerrors/pyerrors.py index 947be666..9a0d02c0 100644 --- a/pyerrors/pyerrors.py +++ b/pyerrors/pyerrors.py @@ -340,6 +340,9 @@ class Obs: for e_name in self.e_names: print(e_name, ':', self.e_content[e_name]) + def zero_within_error(self): + return np.abs(self.value) <= self.dvalue + def plot_tauint(self, save=None): """Plot integrated autocorrelation time for each ensemble.""" if not self.e_names: