mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
Merge branch 'develop' of github.com:fjosw/pyerrors into develop
This commit is contained in:
commit
8720ae6dfb
4 changed files with 11 additions and 11 deletions
10
README.md
10
README.md
|
@ -1,4 +1,4 @@
|
||||||
[](https://github.com/fjosw/pyerrors/actions/workflows/flake8.yml) [](https://github.com/fjosw/pyerrors/actions/workflows/CI.yml) [](https://www.python.org/downloads/)
|
[](https://github.com/fjosw/pyerrors/actions/workflows/flake8.yml) [](https://github.com/fjosw/pyerrors/actions/workflows/CI.yml) [](https://www.python.org/downloads/)
|
||||||
# pyerrors
|
# pyerrors
|
||||||
`pyerrors` is a python package for error computation and propagation of Markov chain Monte Carlo data.
|
`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:
|
It is based on the **gamma method** [arXiv:hep-lat/0306017](https://arxiv.org/abs/hep-lat/0306017). Some of its features are:
|
||||||
|
@ -16,7 +16,11 @@ There exist similar implementations of gamma method error analysis suites in
|
||||||
## Installation
|
## Installation
|
||||||
To install the most recent release of `pyerrors` run
|
To install the most recent release of `pyerrors` run
|
||||||
```bash
|
```bash
|
||||||
pip install git+https://github.com/fjosw/pyerrors.git
|
pip install git+https://github.com/fjosw/pyerrors.git@master
|
||||||
|
```
|
||||||
|
to install the current `develop` version run
|
||||||
|
```bash
|
||||||
|
pip install git+https://github.com/fjosw/pyerrors.git@develop
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
@ -31,6 +35,7 @@ obs1.print()
|
||||||
Often one is interested in secondary observables which can be arbitrary functions of primary observables. `pyerrors` overloads most basic math operations and `numpy` functions such that the user can work with `Obs` objects as if they were floats
|
Often one is interested in secondary observables which can be arbitrary functions of primary observables. `pyerrors` overloads most basic math operations and `numpy` functions such that the user can work with `Obs` objects as if they were floats
|
||||||
```python
|
```python
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
obs3 = 12.0 / obs1 ** 2 - np.exp(-1.0 / obs2)
|
obs3 = 12.0 / obs1 ** 2 - np.exp(-1.0 / obs2)
|
||||||
obs3.gamma_method()
|
obs3.gamma_method()
|
||||||
obs3.print()
|
obs3.print()
|
||||||
|
@ -44,6 +49,5 @@ More detailed examples can be found in the `examples` folder:
|
||||||
* [04_fit_example](examples/04_fit_example.ipynb)
|
* [04_fit_example](examples/04_fit_example.ipynb)
|
||||||
* [05_matrix_operations](examples/05_matrix_operations.ipynb)
|
* [05_matrix_operations](examples/05_matrix_operations.ipynb)
|
||||||
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
[MIT](https://choosealicense.com/licenses/mit/)
|
[MIT](https://choosealicense.com/licenses/mit/)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -3,7 +3,7 @@
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
setup(name='pyerrors',
|
setup(name='pyerrors',
|
||||||
version='1.1.0',
|
version='2.0.0',
|
||||||
description='Error analysis for lattice QCD',
|
description='Error analysis for lattice QCD',
|
||||||
author='Fabian Joswig',
|
author='Fabian Joswig',
|
||||||
author_email='fabian.joswig@ed.ac.uk',
|
author_email='fabian.joswig@ed.ac.uk',
|
||||||
|
|
|
@ -94,15 +94,11 @@ def test_matrix_functions():
|
||||||
|
|
||||||
for (i, j), entry in np.ndenumerate(check):
|
for (i, j), entry in np.ndenumerate(check):
|
||||||
diff = entry - sym[i, j]
|
diff = entry - sym[i, j]
|
||||||
diff.gamma_method()
|
assert diff.is_zero()
|
||||||
assert math.isclose(diff.value, 0.0, abs_tol=1e-9), 'value ' + str(i) + ',' + str(j)
|
|
||||||
assert math.isclose(diff.dvalue, 0.0, abs_tol=1e-9), 'dvalue ' + str(i) + ',' + str(j)
|
|
||||||
|
|
||||||
# Check eigh
|
# Check eigh
|
||||||
e, v = pe.linalg.eigh(sym)
|
e, v = pe.linalg.eigh(sym)
|
||||||
for i in range(dim):
|
for i in range(dim):
|
||||||
tmp = sym @ v[:, i] - v[:, i] * e[i]
|
tmp = sym @ v[:, i] - v[:, i] * e[i]
|
||||||
for j in range(dim):
|
for j in range(dim):
|
||||||
tmp[j].gamma_method()
|
assert tmp[j].is_zero()
|
||||||
assert math.isclose(tmp[j].value, 0.0, abs_tol=1e-9), 'value ' + str(i) + ',' + str(j)
|
|
||||||
assert math.isclose(tmp[j].dvalue, 0.0, abs_tol=1e-9), 'dvalue ' + str(i) + ',' + str(j)
|
|
||||||
|
|
|
@ -245,4 +245,4 @@ def test_cobs():
|
||||||
assert np.allclose(0.0, diff.real.deltas['t'])
|
assert np.allclose(0.0, diff.real.deltas['t'])
|
||||||
assert np.allclose(0.0, diff.imag.deltas['t'])
|
assert np.allclose(0.0, diff.imag.deltas['t'])
|
||||||
|
|
||||||
div = my_cobs / other
|
assert (my_cobs / other * other - my_cobs).is_zero()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue