diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 9db158d3..5e215110 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -40,6 +40,7 @@ jobs: pip install pytest pip install pytest-cov pip install pytest-benchmark + pip freeze - name: Run tests run: pytest --cov=pyerrors -vv diff --git a/.gitignore b/.gitignore index 2701c491..a8338e8f 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ core.* htmlcov build pyerrors.egg-info +dist diff --git a/pyerrors/correlators.py b/pyerrors/correlators.py index d4d6206e..921ae732 100644 --- a/pyerrors/correlators.py +++ b/pyerrors/correlators.py @@ -602,7 +602,7 @@ class Corr: if variant == 'log': newcontent = [] for t in range(self.T - 1): - if (self.content[t] is None) or (self.content[t + 1] is None): + if ((self.content[t] is None) or (self.content[t + 1] is None)) or (self.content[t + 1][0].value == 0): newcontent.append(None) else: newcontent.append(self.content[t] / self.content[t + 1]) @@ -622,7 +622,7 @@ class Corr: newcontent = [] for t in range(self.T - 1): - if (self.content[t] is None) or (self.content[t + 1] is None): + if (self.content[t] is None) or (self.content[t + 1] is None) or (self.content[t + 1][0].value == 0): newcontent.append(None) # Fill the two timeslices in the middle of the lattice with their predecessors elif variant == 'sinh' and t in [self.T / 2, self.T / 2 - 1]: @@ -637,7 +637,7 @@ class Corr: elif variant == 'arccosh': newcontent = [] for t in range(1, self.T - 1): - if (self.content[t] is None) or (self.content[t + 1] is None) or (self.content[t - 1] is None): + if (self.content[t] is None) or (self.content[t + 1] is None) or (self.content[t - 1] is None) or (self.content[t][0].value == 0): newcontent.append(None) else: newcontent.append((self.content[t + 1] + self.content[t - 1]) / (2 * self.content[t])) diff --git a/setup.py b/setup.py index ca4f785d..0c00aad5 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,16 @@ from setuptools import setup, find_packages from pathlib import Path +from distutils.util import convert_path + this_directory = Path(__file__).parent long_description = (this_directory / "README.md").read_text() +version = {} +with open(convert_path('pyerrors/version.py')) as ver_file: + exec(ver_file.read(), version) + setup(name='pyerrors', - version='2.2.0+dev', + version=version['__version__'], description='Error analysis for lattice QCD', long_description=long_description, long_description_content_type='text/markdown', diff --git a/tests/correlators_test.py b/tests/correlators_test.py index 0aadcb85..3cfa230b 100644 --- a/tests/correlators_test.py +++ b/tests/correlators_test.py @@ -1,6 +1,7 @@ import os import numpy as np import scipy +import matplotlib.pyplot as plt import pyerrors as pe import pytest @@ -440,6 +441,7 @@ def test_spaghetti_plot(): corr.spaghetti_plot(True) corr.spaghetti_plot(False) + plt.close('all') def _gen_corr(val, samples=2000): diff --git a/tests/obs_test.py b/tests/obs_test.py index 2a158c3e..5b6a8509 100644 --- a/tests/obs_test.py +++ b/tests/obs_test.py @@ -1,6 +1,7 @@ import autograd.numpy as np import os import copy +import matplotlib.pyplot as plt import pyerrors as pe import pytest @@ -56,6 +57,7 @@ def test_Obs_exceptions(): one.gamma_method() with pytest.raises(Exception): one.plot_piechart() + plt.close('all') def test_dump(): value = np.random.normal(5, 10) @@ -368,6 +370,7 @@ def test_utils(): assert my_obs < (my_obs + 1) float(my_obs) str(my_obs) + plt.close('all') def test_cobs():