Ensure fixed dimensions of cov and grad in covobs. Allow for differences of O(1e-14) in two cov matrices, when combining observables

This commit is contained in:
Simon Kuberski 2021-12-07 17:15:46 +01:00
parent 3324b0aa07
commit 3190140023
2 changed files with 4 additions and 1 deletions

View file

@ -1069,7 +1069,7 @@ def derived_observable(func, data, array_mode=False, **kwargs):
for o in raveled_data:
for name in o.cov_names:
if name in allcov:
if not np.array_equal(allcov[name], o.covobs[name].cov):
if not np.allclose(allcov[name], o.covobs[name].cov, rtol=1e-14, atol=1e-14):
raise Exception('Inconsistent covariance matrices for %s!' % (name))
else:
allcov[name] = o.covobs[name].cov