Merge branch 'develop' into documentation

This commit is contained in:
fjosw 2022-10-19 12:09:43 +00:00
commit 7c4b73ff2f
4 changed files with 32 additions and 15 deletions

View file

@ -13,7 +13,7 @@ jobs:
pytest: pytest:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: true fail-fast: false
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"] python-version: ["3.7", "3.8", "3.9", "3.10"]

View file

@ -267,18 +267,6 @@ class Obs:
self.e_windowsize[e_name] = 0 self.e_windowsize[e_name] = 0
continue continue
self.e_rho[e_name] = e_gamma[e_name][:w_max] / e_gamma[e_name][0]
self.e_n_tauint[e_name] = np.cumsum(np.concatenate(([0.5], self.e_rho[e_name][1:])))
# Make sure no entry of tauint is smaller than 0.5
self.e_n_tauint[e_name][self.e_n_tauint[e_name] <= 0.5] = 0.5 + np.finfo(np.float64).eps
# hep-lat/0306017 eq. (42)
self.e_n_dtauint[e_name] = self.e_n_tauint[e_name] * 2 * np.sqrt(np.abs(np.arange(w_max) + 0.5 - self.e_n_tauint[e_name]) / e_N)
self.e_n_dtauint[e_name][0] = 0.0
def _compute_drho(i):
tmp = self.e_rho[e_name][i + 1:w_max] + np.concatenate([self.e_rho[e_name][i - 1::-1], self.e_rho[e_name][1:w_max - 2 * i]]) - 2 * self.e_rho[e_name][i] * self.e_rho[e_name][1:w_max - i]
self.e_drho[e_name][i] = np.sqrt(np.sum(tmp ** 2) / e_N)
gaps = [] gaps = []
for r_name in e_content[e_name]: for r_name in e_content[e_name]:
if isinstance(self.idl[r_name], range): if isinstance(self.idl[r_name], range):
@ -291,6 +279,18 @@ class Obs:
else: else:
gapsize = gaps[0] gapsize = gaps[0]
self.e_rho[e_name] = e_gamma[e_name][:w_max] / e_gamma[e_name][0]
self.e_n_tauint[e_name] = np.cumsum(np.concatenate(([0.5], self.e_rho[e_name][1:])))
# Make sure no entry of tauint is smaller than 0.5
self.e_n_tauint[e_name][self.e_n_tauint[e_name] <= 0.5] = 0.5 + np.finfo(np.float64).eps
# hep-lat/0306017 eq. (42)
self.e_n_dtauint[e_name] = self.e_n_tauint[e_name] * 2 * np.sqrt(np.abs(np.arange(w_max) / gapsize + 0.5 - self.e_n_tauint[e_name]) / e_N)
self.e_n_dtauint[e_name][0] = 0.0
def _compute_drho(i):
tmp = self.e_rho[e_name][i + 1:w_max] + np.concatenate([self.e_rho[e_name][i - 1::-1], self.e_rho[e_name][1:w_max - 2 * i]]) - 2 * self.e_rho[e_name][i] * self.e_rho[e_name][1:w_max - i]
self.e_drho[e_name][i] = np.sqrt(np.sum(tmp ** 2) / e_N)
_compute_drho(gapsize) _compute_drho(gapsize)
if self.tau_exp[e_name] > 0: if self.tau_exp[e_name] > 0:
texp = self.tau_exp[e_name] texp = self.tau_exp[e_name]

View file

@ -24,8 +24,8 @@ setup(name='pyerrors',
author_email='fabian.joswig@ed.ac.uk', author_email='fabian.joswig@ed.ac.uk',
license="MIT", license="MIT",
packages=find_packages(), packages=find_packages(),
python_requires='>=3.6.0', python_requires='>=3.7.0',
install_requires=['numpy>=1.19', 'autograd>=1.5', 'numdifftools', 'matplotlib>=3.3', 'scipy>=1.5', 'iminuit>=2', 'h5py>=3', 'lxml>=4', 'python-rapidjson>=1', 'pandas>=1.1', 'pysqlite3>=0.4'], install_requires=['numpy>=1.19', 'autograd>=1.5', 'numdifftools', 'matplotlib>=3.5', 'scipy>=1.7', 'iminuit>=2.17', 'h5py>=3.7', 'lxml>=4.9', 'python-rapidjson>=1.9', 'pandas>=1.1'],
classifiers=[ classifiers=[
'Development Status :: 5 - Production/Stable', 'Development Status :: 5 - Production/Stable',
'Intended Audience :: Science/Research', 'Intended Audience :: Science/Research',

View file

@ -669,6 +669,23 @@ def test_gamma_method_irregular():
assert np.isclose(tau_a, tau_b) assert np.isclose(tau_a, tau_b)
def test_irregular_gapped_dtauint():
my_idl = list(range(0, 5010, 10))
my_idl.remove(400)
my_idl2 = list(range(0, 501, 1))
my_idl2.remove(40)
my_data = np.random.normal(1.1, 0.2, 500)
obs = pe.Obs([my_data], ["B1"], idl=[my_idl])
obs.gamma_method()
obs2 = pe.Obs([my_data], ["B2"], idl=[my_idl2])
obs2.gamma_method()
assert np.isclose(obs.e_tauint["B1"], obs2.e_tauint["B2"])
assert np.isclose(obs.e_dtauint["B1"], obs2.e_dtauint["B2"])
def test_covariance_is_variance(): def test_covariance_is_variance():
value = np.random.normal(5, 10) value = np.random.normal(5, 10)
dvalue = np.abs(np.random.normal(0, 1)) dvalue = np.abs(np.random.normal(0, 1))