mirror of
				https://github.com/fjosw/pyerrors.git
				synced 2025-10-31 07:45:45 +01:00 
			
		
		
		
	Merge branch 'develop' into ci/add_python_3.14
This commit is contained in:
		
				commit
				
					
						fb39000284
					
				
			
		
					 7 changed files with 84 additions and 14 deletions
				
			
		
							
								
								
									
										58
									
								
								.github/workflows/release.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								.github/workflows/release.yml
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -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 | ||||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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). | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
|  | @ -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]) | ||||
|  |  | |||
|  | @ -1 +1 @@ | |||
| __version__ = "2.13.0-dev" | ||||
| __version__ = "2.14.0-dev" | ||||
|  |  | |||
|  | @ -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 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue