Correlated covmats in python
Created by: siranipour
I've added a function that takes in a list of CommondData
objects and combines them into one 'effective' CommonData
where the (possible) correlations between the datasets are correctly accounted for.
So you can now do something like
import numpy as np
from validphys.covmats import covmat_from_systematics
from validphys.commondataparser import combine_commondata, load_commondata
from validphys.loader import Loader
l = Loader()
cd1 = l.check_commondata("ATLASLOMASSDY11EXT")
cd2 = l.check_commondata("ATLASZHIGHMASS49FB")
commondata_list = list(map(load_commondata, (cd1, cd2)))
cd = combine_commondata(commondata_list)
new_covmat = covmat_from_systematics(cd)
ds1 = l.check_dataset("ATLASLOMASSDY11EXT", theoryid=53, cuts=None)
ds2 = l.check_dataset("ATLASZHIGHMASS49FB", theoryid=53, cuts=None)
exp = l.check_experiment("FOO", [ds1, ds2])
ld = exp.load()
old_covmat = ld.get_covmat()
np.testing.assert_allclose(old_covmat, new_covmat)
This will in principle remedy https://github.com/NNPDF/nnpdf/pull/866#issuecomment-702677678 too, though I've not tested it yet.
The relevant piece of C++ code is here https://github.com/NNPDF/nnpdf/blob/f038c955e3045e90cc17edb1dff8cd52bfd294d5/libnnpdf/src/experiments.cc#L437