From 1512d268122ed1aadf9eb9b4fb0bcfa135615dfb Mon Sep 17 00:00:00 2001 From: ecole41 Date: Wed, 18 Dec 2024 11:39:54 +0000 Subject: [PATCH] Added function to produce data.yaml --- .../commondata/ATLAS_Z0_7TEV_36PB/data.yaml | 9 +++ .../commondata/ATLAS_Z0_7TEV_36PB/filter.py | 29 ++++++++ .../ATLAS_Z0_7TEV_36PB/filter_utils.py | 33 +++++++++ .../ATLAS_Z0_7TEV_36PB/metadata.yaml | 4 +- .../rawdata/HEPData-ins928289-v1-Table_1.yaml | 67 +++++++++++++++++++ 5 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/data.yaml create mode 100644 nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/filter.py create mode 100644 nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/filter_utils.py create mode 100644 nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/rawdata/HEPData-ins928289-v1-Table_1.yaml diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/data.yaml b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/data.yaml new file mode 100644 index 0000000000..6b10636498 --- /dev/null +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/data.yaml @@ -0,0 +1,9 @@ +data_central: +- 1.31687349e+05 +- 1.31860528e+05 +- 1.28162647e+05 +- 1.20440901e+05 +- 1.15490019e+05 +- 1.07228362e+05 +- 9.39037660e+04 +- 5.43782060e+04 diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/filter.py b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/filter.py new file mode 100644 index 0000000000..e3948ba58c --- /dev/null +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/filter.py @@ -0,0 +1,29 @@ +""" +When running `python filter.py` the relevant data yaml +file will be created in the `nnpdf_data/commondata/ATLAS_WPWM_7TEV_46FB` directory. +""" + +import yaml +from filter_utils import get_data_values + +from nnpdf_data.filter_utils.utils import prettify_float + +yaml.add_representer(float, prettify_float) + + +def filter_ATLAS_Z0_7TEV_36FB_data_kinematic(): + """ + This function writes the systematics to yaml files. + """ + + central_values = get_data_values() + + data_central_yaml = {"data_central": central_values} + + # write central values and kinematics to yaml file + with open("data.yaml", "w") as file: + yaml.dump(data_central_yaml, file, sort_keys=False) + + +if __name__ == "__main__": + filter_ATLAS_Z0_7TEV_36FB_data_kinematic() diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/filter_utils.py b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/filter_utils.py new file mode 100644 index 0000000000..7b8fe01bcd --- /dev/null +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/filter_utils.py @@ -0,0 +1,33 @@ +""" +This module contains helper functions that are used to extract the data values +from the rawdata files. +""" + +import yaml +import pandas as pd +import numpy as np + + +def get_data_values(): + """ + returns the central data values in the form of a list. + """ + + data_central = [] + + hepdata_table = f"rawdata/HEPData-ins928289-v1-Table_1.yaml" + + with open(hepdata_table, 'r') as file: + input = yaml.safe_load(file) + + values = input['dependent_variables'][0]['values'] + + for value in values: + # store data central and convert the units and apply the correction factor + data_central.append(value['value'] * 1000 * 1.0187) + + return data_central + + +if __name__ == "__main__": + get_data_values() diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/metadata.yaml b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/metadata.yaml index 93a9c6e2f4..86a6306c1b 100644 --- a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/metadata.yaml +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/metadata.yaml @@ -10,7 +10,7 @@ arXiv: iNSPIRE: url: '' hepdata: - url: '' + url: 'https://www.hepdata.net/record/ins928289' version: -1 implemented_observables: - observable_name: ETA @@ -19,7 +19,7 @@ implemented_observables: label: ATLAS $Z$ 7 TeV 2010 units: '' process_type: EWK_RAP - tables: [] + tables: [1] npoints: [] ndata: 8 plotting: diff --git a/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/rawdata/HEPData-ins928289-v1-Table_1.yaml b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/rawdata/HEPData-ins928289-v1-Table_1.yaml new file mode 100644 index 0000000000..318c5e419f --- /dev/null +++ b/nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/rawdata/HEPData-ins928289-v1-Table_1.yaml @@ -0,0 +1,67 @@ +dependent_variables: +- header: {name: D(SIG)/DABS(YRAP), units: PB} + qualifiers: + - {name: M(C=LEPTON+LEPTON-), units: GeV, value: 66.0-116.0} + - {name: PT(C=LEPTON), units: GEV, value: '> 20'} + - {name: RE, value: P P --> Z0 < LEPTON+ LEPTON- > X + GAMMA* < LEPTON+ LEPTON- + > X} + values: + - errors: + - {label: stat, symerror: 1.88} + - {label: sys, symerror: 0.76} + - {label: sys, symerror: 1.39} + - {label: 'sys,luminosity uncertainty', symerror: 3.4%} + value: 129.27 + - errors: + - {label: stat, symerror: 1.9} + - {label: sys, symerror: 0.65} + - {label: sys, symerror: 1.39} + - {label: 'sys,luminosity uncertainty', symerror: 3.4%} + value: 129.44 + - errors: + - {label: stat, symerror: 1.89} + - {label: sys, symerror: 0.6} + - {label: sys, symerror: 1.18} + - {label: 'sys,luminosity uncertainty', symerror: 3.4%} + value: 125.81 + - errors: + - {label: stat, symerror: 1.9} + - {label: sys, symerror: 0.53} + - {label: sys, symerror: 1.16} + - {label: 'sys,luminosity uncertainty', symerror: 3.4%} + value: 118.23 + - errors: + - {label: stat, symerror: 2.09} + - {label: sys, symerror: 0.71} + - {label: sys, symerror: 1.43} + - {label: 'sys,luminosity uncertainty', symerror: 3.4%} + value: 113.37 + - errors: + - {label: stat, symerror: 2.71} + - {label: sys, symerror: 1.44} + - {label: sys, symerror: 2.31} + - {label: 'sys,luminosity uncertainty', symerror: 3.4%} + value: 105.26 + - errors: + - {label: stat, symerror: 2.99} + - {label: sys, symerror: 3.51} + - {label: sys, symerror: 3.47} + - {label: 'sys,luminosity uncertainty', symerror: 3.4%} + value: 92.18 + - errors: + - {label: stat, symerror: 2.25} + - {label: sys, symerror: 2.33} + - {label: sys, symerror: 4.3} + - {label: 'sys,luminosity uncertainty', symerror: 3.4%} + value: 53.38 +independent_variables: +- header: {name: ABS(YRAP)} + values: + - {high: 0.4, low: 0.0} + - {high: 0.8, low: 0.4} + - {high: 1.2, low: 0.8} + - {high: 1.6, low: 1.2} + - {high: 2.0, low: 1.6} + - {high: 2.4, low: 2.0} + - {high: 2.8, low: 2.4} + - {high: 3.6, low: 2.8}