Skip to content

Commit

Permalink
rebase on top of results-in-pdferr; add exception if from_convolution…
Browse files Browse the repository at this point in the history
… is ever used
  • Loading branch information
scarlehoff committed Apr 29, 2024
1 parent c01a7d3 commit f448f88
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions validphys2/examples/API_extension_Pineappl.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@
"def new_results_central_by_theoryid(dataset, pdf, covariance_matrix, sqrt_covmat):\n",
" dresult = validphys.results.DataResult(dataset, covariance_matrix, sqrt_covmat)\n",
" ####### This is the part that changes wrt validphys\n",
" data_path = Path(f\"results_{dataset.name}_{tid}_{pdf.name}.pkl\")\n",
" ret = []\n",
" theory_data_per_scale = _pine_predictions(dataset, pdf, central_only=True)\n",
" for i, theory_data in enumerate(theory_data_per_scale):\n",
Expand All @@ -193,7 +192,6 @@
"def new_results(dataset, pdf, covariance_matrix, sqrt_covmat, central_only=False):\n",
" dresult = validphys.results.DataResult(dataset, covariance_matrix, sqrt_covmat)\n",
" ####### This is the part that changes wrt validphys\n",
" data_path = Path(f\"results_{dataset.name}_{tid}_{pdf.name}.pkl\")\n",
" theory_data = _pine_predictions(dataset, pdf, central_only=central_only)[0]\n",
" theory_results = validphys.results.ThPredictionsResult(theory_data, pdf.stats_class, pdf=pdf)\n",
" #########\n",
Expand All @@ -204,7 +202,13 @@
"\n",
"validphys.results.results = new_results\n",
"validphys.results.results_central = new_results_central\n",
"validphys.theorycovariance.construction.results_central_bytheoryids = new_results_central_by_theoryid"
"validphys.theorycovariance.construction.results_central_bytheoryids = new_results_central_by_theoryid\n",
"\n",
"# Make sure that from_convolution is never accessed\n",
"def raise_me(pdf, dataset, **kwargs):\n",
" raise ValueError(\".from_convolution is being used, please report this error!\")\n",
"\n",
"validphys.results.ThPredictionsResult.from_convolution = raise_me"
]
},
{
Expand Down Expand Up @@ -232,7 +236,7 @@
"text": [
"Exp chi2: 0.5382\n",
"Exp+th chi2: 0.5037\n",
"Exp+th+pdf chi2: 0.2724\n"
"Exp+th+pdf chi2: 0.425\n"
]
}
],
Expand Down Expand Up @@ -295,6 +299,14 @@
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "1356c290-b7f0-43c2-a663-659ea6da2df4",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down

0 comments on commit f448f88

Please sign in to comment.