Skip to content

Commit

Permalink
Added function to produce data.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
ecole41 committed Dec 18, 2024
1 parent 050d723 commit 1512d26
Show file tree
Hide file tree
Showing 5 changed files with 140 additions and 2 deletions.
9 changes: 9 additions & 0 deletions nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/data.yaml
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions nnpdf_data/nnpdf_data/commondata/ATLAS_Z0_7TEV_36PB/filter.py
Original file line number Diff line number Diff line change
@@ -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()
Original file line number Diff line number Diff line change
@@ -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()
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ arXiv:
iNSPIRE:
url: ''
hepdata:
url: ''
url: 'https://www.hepdata.net/record/ins928289'
version: -1
implemented_observables:
- observable_name: ETA
Expand All @@ -19,7 +19,7 @@ implemented_observables:
label: ATLAS $Z$ 7 TeV 2010
units: ''
process_type: EWK_RAP
tables: []
tables: [1]
npoints: []
ndata: 8
plotting:
Expand Down
Original file line number Diff line number Diff line change
@@ -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}

0 comments on commit 1512d26

Please sign in to comment.