Skip to content

Commit

Permalink
fill the mid kinematic value with the average of min and max
Browse files Browse the repository at this point in the history
  • Loading branch information
scarlehoff committed Apr 28, 2023
1 parent 0d56bfe commit 56fe007
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 199 deletions.
286 changes: 87 additions & 199 deletions Playground for the new commondata format.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@
" \n",
" check_this(cds, \"get_cv\", naming=\"central_values\")\n",
" check_this(cds, \"get_kintable\", naming=\"kinematics\")\n",
" check_this(cds, \"stat_errors\")\n",
" check_this(cds, \"multiplicative_errors\")\n",
" check_this(cds, \"additive_errors\", unc=True)\n",
" check_this(cds, \"stat_errors\")"
" check_this(cds, \"additive_errors\", unc=True)"
]
},
{
Expand Down Expand Up @@ -137,7 +137,7 @@
"execution_count": 4,
"id": "a1c03485",
"metadata": {
"scrolled": false
"scrolled": true
},
"outputs": [
{
Expand All @@ -146,9 +146,50 @@
"text": [
"\n",
"Checking E605_DY_38P8GEV_PXSEC (old name: DYE605)\n",
" > Comparing values...\n"
"Files for E605_DY_38P8GEV_PXSEC not found\n",
"\n",
"Checking E866_DY_800GEV_PXSEC (old name: DYE886P)\n",
"Files for E866_DY_800GEV_PXSEC not found\n",
"\n",
"Checking E866_DY_800GEV_RATIO_PDXSECRATIO (old name: DYE886R)\n",
"Files for E866_DY_800GEV_RATIO_PDXSECRATIO not found\n",
"\n",
"Checking E906_DY_120GEV_PDXSECRATIO (old name: DYE906R)\n",
"Files for E906_DY_120GEV_PDXSECRATIO not found\n"
]
},
}
],
"source": [
"datasets = {\n",
" \"DYE605\": \"E605_DY_38P8GEV_PXSEC\",\n",
" \"DYE886P\": \"E866_DY_800GEV_PXSEC\",\n",
" \"DYE886R\": \"E866_DY_800GEV_RATIO_PDXSECRATIO\",\n",
" \"DYE906R\": \"E906_DY_120GEV_PDXSECRATIO\",\n",
"}\n",
"\n",
"res_ft = test_group(datasets, nofail=False)\n",
"\n",
"\n",
"#old_cd, new_cd = load_old_and_new(\"DYE906R\", \"E906_DY_120GEV_PDXSECRATIO\")\n",
"#run_checks(old_cd, new_cd)"
]
},
{
"cell_type": "markdown",
"id": "140e48f3",
"metadata": {},
"source": [
"## Atlas datasets\n",
"\n",
"These datasets can be found in the `gluon_pdf_ncd` branch"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "09a38520",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
Expand All @@ -164,71 +205,7 @@
{
"data": {
"text/html": [
"<text style=color:green>equal=True Testing kinematics (get_kintable)</text>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<text style=color:green>equal=True Testing multiplicative_errors (multiplicative_errors)</text>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<text style=color:red>equal=False Testing additive_errors (additive_errors)</text>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
" > > The resulting covmat instead agrees? False\n"
]
},
{
"data": {
"text/html": [
"<text style=color:red>equal=False Testing stat_errors (stat_errors)</text>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Checking E866_DY_800GEV_PXSEC (old name: DYE886P)\n",
" > Comparing values...\n"
]
},
{
"data": {
"text/html": [
"<text style=color:red>equal=False Testing central_values (get_cv)</text>"
"<text style=color:red>equal=False Testing kinematics (get_kintable)</text>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
Expand All @@ -240,7 +217,7 @@
{
"data": {
"text/html": [
"<text style=color:red>equal=False Testing kinematics (get_kintable)</text>"
"<text style=color:green>equal=True Testing stat_errors (stat_errors)</text>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
Expand Down Expand Up @@ -277,27 +254,50 @@
"name": "stdout",
"output_type": "stream",
"text": [
" > > The resulting covmat instead agrees? False\n"
" > > The resulting covmat instead agrees? True\n"
]
},
{
"data": {
"text/html": [
"<text style=color:red>equal=False Testing stat_errors (stat_errors)</text>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
}
],
"source": [
"datasets = {\n",
" \"ATLASTTBARTOT13TEV\": \"ATLAS_TTBAR_13TEV_TOT_X-SEC\",\n",
" \"ATLASTTBARTOT7TEV\": \"ATLAS_TTBAR_7TEV_TOT_X-SEC\",\n",
" \"ATLAS_TOPDIFF_DILEPT_8TEV_TTM\": \"ATLAS_TTBAR_8TEV_2L_DIF_MTTBAR\",\n",
"}\n",
"\n",
"#res = test_group(datasets, nofail=True)\n",
"\n",
"old_name = list(datasets)[2]\n",
"new_name = datasets[old_name]\n",
"\n",
"old_cd, new_cd = load_old_and_new(old_name, new_name)\n",
"run_checks(old_cd, new_cd)"
]
},
{
"cell_type": "markdown",
"id": "18beecf0",
"metadata": {},
"source": [
"## CMS ttbar\n",
"\n",
"These datasets can be found in the `more_efficient_metadata_for_new_commondata` branch [#1684](https://github.com/NNPDF/nnpdf/pull/1684)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "d2852f43",
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Checking E866_DY_800GEV_RATIO_PDXSECRATIO (old name: DYE886R)\n",
"Checking CMS_TTBAR_8TEV_LJ_DIF_YTTBAR-NORM (old name: CMSTOPDIFF8TEVTTRAPNORM)\n",
" > Comparing values...\n"
]
},
Expand Down Expand Up @@ -325,30 +325,6 @@
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<text style=color:green>equal=True Testing multiplicative_errors (multiplicative_errors)</text>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<text style=color:green>equal=True Testing additive_errors (additive_errors)</text>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
Expand All @@ -361,39 +337,6 @@
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Checking E906_DY_120GEV_PDXSECRATIO (old name: DYE906R)\n",
" > Comparing values...\n"
]
},
{
"data": {
"text/html": [
"<text style=color:green>equal=True Testing central_values (get_cv)</text>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<text style=color:green>equal=True Testing kinematics (get_kintable)</text>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
Expand Down Expand Up @@ -424,61 +367,6 @@
"text": [
" > > The resulting covmat instead agrees? True\n"
]
},
{
"data": {
"text/html": [
"<text style=color:green>equal=True Testing stat_errors (stat_errors)</text>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"datasets = {\n",
" \"DYE605\": \"E605_DY_38P8GEV_PXSEC\",\n",
" \"DYE886P\": \"E866_DY_800GEV_PXSEC\",\n",
" \"DYE886R\": \"E866_DY_800GEV_RATIO_PDXSECRATIO\",\n",
" \"DYE906R\": \"E906_DY_120GEV_PDXSECRATIO\",\n",
"}\n",
"\n",
"res_ft = test_group(datasets, nofail=False)\n",
"\n",
"\n",
"#old_cd, new_cd = load_old_and_new(\"DYE906R\", \"E906_DY_120GEV_PDXSECRATIO\")\n",
"#run_checks(old_cd, new_cd)"
]
},
{
"cell_type": "markdown",
"id": "18beecf0",
"metadata": {},
"source": [
"## CMS ttbar\n",
"\n",
"These datasets can be found in the `more_efficient_metadata_for_new_commondata` branch [#1684](https://github.com/NNPDF/nnpdf/pull/1684)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "d2852f43",
"metadata": {
"scrolled": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Checking CMS_TTBAR_8TEV_LJ_DIF_YTTBAR-NORM (old name: CMSTOPDIFF8TEVTTRAPNORM)\n",
"Files for CMS_TTBAR_8TEV_LJ_DIF_YTTBAR-NORM not found\n"
]
}
],
"source": [
Expand Down Expand Up @@ -506,7 +394,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.10"
"version": "3.10.11"
}
},
"nbformat": 4,
Expand Down
3 changes: 3 additions & 0 deletions validphys2/src/validphys/commondataparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,10 @@ def _parse_kinematics(metadata):
for i, dbin in enumerate(kinyaml["bins"]):
bin_index = i + 1
# TODO: for now we are dropping min/max information since it didn't exist in the past
# unless the point doesn't have a mid value, in that case we need to generate it!
for d in dbin.values():
if d["mid"] is None:
d["mid"] = 0.5 * (d["max"] + d["min"])
d["min"] = None
d["max"] = None
kin_dict[bin_index] = pd.DataFrame(dbin).stack()
Expand Down

0 comments on commit 56fe007

Please sign in to comment.