-
Notifications
You must be signed in to change notification settings - Fork 14
Fit with theory covmat with n3fit #1528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
3469368
80bba9d
815a595
539f366
99ffdd4
f1ac85b
6e64443
2601ce6
9a8cf90
88adcad
3c0d0f5
6278c58
6a2c0e7
2b61504
73e578c
3789d1e
82ce369
234cf80
9d83d75
2064796
abc1a0d
9dc505c
dd96091
36b0a55
c3dc6d7
9fe8d25
91a9c80
43e60ee
662bcf0
0b070c4
f1c514a
d43b357
7e89de0
bf4f841
684cba5
0497427
f52c492
d615806
585e69a
9a1e9f6
166873c
05d3d61
419e9b0
0ce016b
894138a
c94f741
e9d81f8
176eb3d
a4f4133
89ac78f
793de60
fce0ad8
9007322
99185dd
1d7b089
b7cf514
1d68e85
a922e26
62392de
7d8f4e8
bbd3bc0
d84bb2f
e3d41be
d4b4702
4d768f0
1c5205a
a10450e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| import numpy as np | ||
| import pandas as pd | ||
| import scipy.linalg as la | ||
| import pathlib | ||
|
|
||
| from reportengine import collect | ||
| from reportengine.table import table | ||
|
|
@@ -23,7 +24,7 @@ | |
| from validphys.core import PDF, DataGroupSpec, DataSetSpec | ||
| from validphys.covmats_utils import construct_covmat, systematics_matrix | ||
| from validphys.results import ThPredictionsResult | ||
|
|
||
| from validphys.commondata import loaded_commondata_with_cuts | ||
|
andreab1997 marked this conversation as resolved.
|
||
| log = logging.getLogger(__name__) | ||
|
andreab1997 marked this conversation as resolved.
|
||
|
|
||
| INTRA_DATASET_SYS_NAME = ("UNCORR", "CORR", "THEORYUNCORR", "THEORYCORR") | ||
|
|
@@ -227,6 +228,17 @@ def dataset_inputs_covmat_from_systematics( | |
| covmat, | ||
| norm_threshold=norm_threshold | ||
| ) | ||
| # try: | ||
| # theory_covmat_path = pathlib.Path.cwd() | ||
| # data = pd.read_csv(theory_covmat_path / "prov_moredata" / "tables" / "datacuts_theory_theorycovmatconfig_theory_covmat_custom.csv", sep='\t') | ||
| # datael = data.iloc[3:] | ||
| # datael = datael.drop(['group'], axis=1) | ||
| # datael = datael.drop(['Unnamed: 1'], axis=1) | ||
| # datael = datael.drop(['Unnamed: 2'], axis=1) | ||
| # theory_covmat = np.copy(datael.values) | ||
| #except FileNotFoundError: | ||
| # theory_covmat = np.zeros(covmat.shape) | ||
| #total_covmat = np.add(covmat, theory_covmat) | ||
|
andreab1997 marked this conversation as resolved.
Outdated
|
||
| return covmat | ||
|
|
||
|
|
||
|
|
@@ -339,6 +351,41 @@ def dataset_inputs_t0_covmat_from_systematics( | |
| _list_of_central_values=dataset_inputs_t0_predictions | ||
| ) | ||
|
|
||
| def dataset_inputs_t0_total_covmat(dataset_inputs_loaded_cd_with_cuts, | ||
| *, | ||
| data_input, | ||
| use_weights_in_covmat=True, | ||
| norm_threshold=None, | ||
| dataset_inputs_t0_predictions, | ||
| output_path, | ||
| theory_covmat_flag, | ||
| use_user_uncertainties, | ||
| use_scalevar_uncertainties): | ||
| exp_covmat = dataset_inputs_covmat_from_systematics( | ||
| dataset_inputs_loaded_cd_with_cuts, | ||
| data_input, | ||
| use_weights_in_covmat, | ||
| norm_threshold=norm_threshold, | ||
| _list_of_central_values=dataset_inputs_t0_predictions | ||
| ) | ||
| if theory_covmat_flag is True: | ||
| generic_path = None | ||
| if use_scalevar_uncertainties is True: | ||
| if use_user_uncertainties is True: | ||
| generic_path = pathlib.Path("datacuts_theory_theorycovmatconfig_total_theory_covmat.csv") | ||
| else: | ||
| generic_path = pathlib.Path("datacuts_theory_theorycovmatconfig_theory_covmat_custom.csv") | ||
| else: | ||
| if use_user_uncertainties is True: | ||
| generic_path = pathlib.Path("datacuts_theory_theorycovmatconfig_user_covmat.csv") | ||
| else: | ||
| generic_path = pathlib.Path("datacuts_theory_theorycovmatconfig_theory_covmat_custom.csv") | ||
| theorypath = pathlib.Path(str(output_path/"tables"/generic_path.relative_to(generic_path.anchor))) | ||
|
andreab1997 marked this conversation as resolved.
Outdated
|
||
| theory_covmat = pd.read_csv(theorypath, sep='\t') | ||
| theory_covmat = theory_covmat.iloc[3:].drop(['group'], axis=1).drop(['Unnamed: 1'], axis=1).drop(['Unnamed: 2'], axis=1) | ||
| return np.add(exp_covmat,theory_covmat.values.astype(np.float)) | ||
| return exp_covmat | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think for these two functions (and all the branches they create) we need to rethink a bit the names and what we want to have. Imho we should have Personally I would just enforce that We can sketch the different names / branches that we want in a blackboard when I'm at the office, it will be faster.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok sure. Till then I leave the names as they are now
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW I believe that we should leave the flags for t0 as well
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes! It would help if such a flag is available, at least from a conceptual point of view. |
||
|
|
||
|
|
||
| def sqrt_covmat(covariance_matrix): | ||
| """Function that computes the square root of the covariance matrix. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.