From 47fd72b814c6e93b03d006d2109f4915ed3e1c4f Mon Sep 17 00:00:00 2001 From: Fabian Joswig <fjosw@users.noreply.github.com> Date: Sun, 3 Nov 2024 16:57:20 +0100 Subject: [PATCH 1/6] [Build] Release workflow added. (#244) --- .github/workflows/release.yml | 58 +++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..2548255f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: Release + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + build: + name: Build sdist and wheel + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + name: Checkout repository + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + + - name: Build wheel and source tarball + run: python3 -m build + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + if-no-files-found: error + + publish: + needs: [build] + name: Upload to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/pyerrors + permissions: + id-token: write + + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + - name: Sanity check + run: ls -la dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 From c057ecffdae82594e0bd6fa75ecca372858a7f93 Mon Sep 17 00:00:00 2001 From: Fabian Joswig <fjosw@users.noreply.github.com> Date: Sun, 3 Nov 2024 17:03:06 +0100 Subject: [PATCH 2/6] [Release] Updated changelog and bumped version --- CHANGELOG.md | 8 ++++++++ pyerrors/version.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b59bb577..d019608c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. +## [2.13.0] - 2024-11-03 + +### Added +- Allow providing lower triangular matrix constructed from a Cholesky decomposition in least squares function for correlated fits. + +### Fixed +- Corrected bug that prevented combined fits with multiple x-obs in some cases. + ## [2.12.0] - 2024-08-22 ### Changed diff --git a/pyerrors/version.py b/pyerrors/version.py index 9b9dc340..930e2cd6 100644 --- a/pyerrors/version.py +++ b/pyerrors/version.py @@ -1 +1 @@ -__version__ = "2.13.0-dev" +__version__ = "2.13.0" From 0ce765a99d0bcd5f7ae04c4d97a792bf83bc92d9 Mon Sep 17 00:00:00 2001 From: Fabian Joswig <fjosw@users.noreply.github.com> Date: Sun, 3 Nov 2024 17:07:29 +0100 Subject: [PATCH 3/6] [Version] Bumped version to 2.14.0-dev --- pyerrors/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyerrors/version.py b/pyerrors/version.py index 930e2cd6..941c31df 100644 --- a/pyerrors/version.py +++ b/pyerrors/version.py @@ -1 +1 @@ -__version__ = "2.13.0" +__version__ = "2.14.0-dev" From 30bfb55981f97b7c5e78c01b728b5f2277a74a25 Mon Sep 17 00:00:00 2001 From: Fabian Joswig <fjosw@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:52:27 +0100 Subject: [PATCH 4/6] [Feat] Provide derivatives for pow (#246) * [Feat] Provide manual derivatives for __pow__ * [Feat] Also applied changes to rpow * [Test] Another pow test added. --- pyerrors/obs.py | 9 +++------ tests/obs_test.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pyerrors/obs.py b/pyerrors/obs.py index a1c2fd55..0caecfdc 100644 --- a/pyerrors/obs.py +++ b/pyerrors/obs.py @@ -856,15 +856,12 @@ class Obs: def __pow__(self, y): if isinstance(y, Obs): - return derived_observable(lambda x: x[0] ** x[1], [self, y]) + return derived_observable(lambda x, **kwargs: x[0] ** x[1], [self, y], man_grad=[y.value * self.value ** (y.value - 1), self.value ** y.value * np.log(self.value)]) else: - return derived_observable(lambda x: x[0] ** y, [self]) + return derived_observable(lambda x, **kwargs: x[0] ** y, [self], man_grad=[y * self.value ** (y - 1)]) def __rpow__(self, y): - if isinstance(y, Obs): - return derived_observable(lambda x: x[0] ** x[1], [y, self]) - else: - return derived_observable(lambda x: y ** x[0], [self]) + return derived_observable(lambda x, **kwargs: y ** x[0], [self], man_grad=[y ** self.value * np.log(y)]) def __abs__(self): return derived_observable(lambda x: anp.abs(x[0]), [self]) diff --git a/tests/obs_test.py b/tests/obs_test.py index 726ecffa..8b82213f 100644 --- a/tests/obs_test.py +++ b/tests/obs_test.py @@ -461,6 +461,18 @@ def test_cobs_overloading(): obs / cobs +def test_pow(): + data = [1, 2.341, pe.pseudo_Obs(4.8, 0.48, "test_obs"), pe.cov_Obs(1.1, 0.3 ** 2, "test_cov_obs")] + + for d in data: + assert d * d == d ** 2 + assert d * d * d == d ** 3 + + for d2 in data: + assert np.log(d ** d2) == d2 * np.log(d) + assert (d ** d2) ** (1 / d2) == d + + def test_reweighting(): my_obs = pe.Obs([np.random.rand(1000)], ['t']) assert not my_obs.reweighted From b1448a2703c69c169e864945a5015337ec572a5b Mon Sep 17 00:00:00 2001 From: Justus Kuhlmann <82444481+jkuhl-uni@users.noreply.github.com> Date: Thu, 5 Dec 2024 22:08:48 +0100 Subject: [PATCH 5/6] Fix plateaus in correlator (#247) --- pyerrors/correlators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyerrors/correlators.py b/pyerrors/correlators.py index de1addfd..21a11533 100644 --- a/pyerrors/correlators.py +++ b/pyerrors/correlators.py @@ -862,7 +862,7 @@ class Corr: raise Exception("prange must be a list or array with two values") if not ((isinstance(prange[0], int)) and (isinstance(prange[1], int))): raise Exception("Start and end point must be integers") - if not (0 <= prange[0] <= self.T and 0 <= prange[1] <= self.T and prange[0] < prange[1]): + if not (0 <= prange[0] <= self.T and 0 <= prange[1] <= self.T and prange[0] <= prange[1]): raise Exception("Start and end point must define a range in the interval 0,T") self.prange = prange From d9085081202076e08b12359bb0480f27b3b3b1cc Mon Sep 17 00:00:00 2001 From: Fabian Joswig <fjosw@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:00:06 +0100 Subject: [PATCH 6/6] [docs] Simplify README --- README.md | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/README.md b/README.md index aa669ad5..7937da4d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[](https://github.com/fjosw/pyerrors/actions/workflows/pytest.yml) [](https://www.python.org/downloads/) [](https://opensource.org/licenses/MIT) [](https://arxiv.org/abs/2209.14371) [](https://doi.org/10.1016/j.cpc.2023.108750) +[](https://www.python.org/downloads/) [](https://opensource.org/licenses/MIT) [](https://arxiv.org/abs/2209.14371) [](https://doi.org/10.1016/j.cpc.2023.108750) # pyerrors `pyerrors` is a python framework for error computation and propagation of Markov chain Monte Carlo data from lattice field theory and statistical mechanics simulations. @@ -14,11 +14,6 @@ Install the most recent release using pip and [pypi](https://pypi.org/project/py python -m pip install pyerrors # Fresh install python -m pip install -U pyerrors # Update ``` -Install the most recent release using conda and [conda-forge](https://anaconda.org/conda-forge/pyerrors): -```bash -conda install -c conda-forge pyerrors # Fresh install -conda update -c conda-forge pyerrors # Update -``` ## Contributing We appreciate all contributions to the code, the documentation and the examples. If you want to get involved please have a look at our [contribution guideline](https://github.com/fjosw/pyerrors/blob/develop/CONTRIBUTING.md).