Skip to content
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

[WIP] Reimplement ATLAS_WPWM_7TEV_46FB #2201

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions nnpdf_data/nnpdf_data/commondata/ATLAS_WPWM_7TEV_46FB/data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
data_central:
- 577150.0
- 576870.0
- 581750.0
- 586070.0
- 586330.0
- 599070.0
- 596750.0
- 604170.0
- 606930.0
- 593400.0
- 558460.0
- 436450.0
- 432780.0
- 429290.0
- 423380.0
- 413640.0
- 405260.0
- 388020.0
- 377510.0
- 365820.0
- 344700.0
- 319040.0
31 changes: 31 additions & 0 deletions nnpdf_data/nnpdf_data/commondata/ATLAS_WPWM_7TEV_46FB/filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
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, get_kinematics


def filter_ATLAS_WPWM_7TEV_46FB_data_kinematic():
"""
This function writes the central values to yaml files.
"""
central_values = list(get_data_values())

kin = get_kinematics()

data_central_yaml = {"data_central": central_values}

kinematics_yaml = {"bins": kin}

# write central values and kinematics to yaml file
with open("data.yaml", "w") as file:
yaml.dump(data_central_yaml, file, sort_keys=False)

with open("kinematics.yaml", "w") as file:
yaml.dump(kinematics_yaml, file, sort_keys=False)


if __name__ == "__main__":
filter_ATLAS_WPWM_7TEV_46FB_data_kinematic()
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
"""
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_1 = f"rawdata/HEPData-ins1502620-v1-Table_9.yaml"
hepdata_table_2 = f"rawdata/HEPData-ins1502620-v1-Table_10.yaml"

with open(hepdata_table_1, 'r') as file:
input_1 = yaml.safe_load(file)

with open(hepdata_table_2, 'r') as file:
input_2 = yaml.safe_load(file)

values_1 = input_1['dependent_variables'][0]['values']
values_2 = input_2['dependent_variables'][0]['values']

values = values_1 + values_2

for value in values:
# store data central and convert the units
data_central.append(value['value'] * 1000)

return data_central


def get_kinematics():
"""
returns the kinematics in the form of a list of dictionaries.
"""
kin = []

hepdata_table_1 = f"rawdata/HEPData-ins1502620-v1-Table_9.yaml"
hepdata_table_2 = f"rawdata/HEPData-ins1502620-v1-Table_10.yaml"

with open(hepdata_table_1, 'r') as file:
input_1 = yaml.safe_load(file)

with open(hepdata_table_2, 'r') as file:
input_2 = yaml.safe_load(file)

for i, M in enumerate(input_1["independent_variables"][0]['values']):

kin_value = {
'k1': {
'min': None,
'mid': (0.5 * (M['low'] + M['high'])),
'max': None,
}, # absolute lepton eta
'k2': {'min': None, 'mid': 6463.838404, 'max': None},
'k3': {'min': None, 'mid': 7000.0, 'max': None},
}

kin.append(kin_value)

for i, M in enumerate(input_2["independent_variables"][0]['values']):

kin_value = {
'k1': {
'min': None,
'mid': (0.5 * (M['low'] + M['high'])),
'max': None,
}, # absolute lepton eta
'k2': {'min': None, 'mid': 6463.838404, 'max': None},
'k3': {'min': None, 'mid': 7000.0, 'max': None},
}

kin.append(kin_value)

return kin
Loading
Loading