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

add y labels, integrate utils in filters and remove comma in sys names #2020

Closed
wants to merge 4 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
88 changes: 70 additions & 18 deletions nnpdf_data/nnpdf_data/new_commondata/ATLAS_1JET_13TEV_DIF/filter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
from math import sqrt

import yaml
from validphys.commondata_utils import symmetrize_errors as se


def symmetrize_errors(delta_plus, delta_minus):
r"""Compute the symmterized uncertainty and the shift in data point.
Parameters
----------
delta_plus : float
The top/plus uncertainty with sign
delta_minus : float
The bottom/minus uncertainty with sign

Returns
-------
se_delta : float
The value to be added to the data point
se_sigma : float
The symmetrized uncertainty to be used in commondata
"""
semi_diff = (delta_plus + delta_minus) / 2
average = (delta_plus - delta_minus) / 2
se_delta = semi_diff
se_sigma = sqrt(average * average + 2 * semi_diff * semi_diff)
return se_delta, se_sigma


def processData():
with open('metadata.yaml', 'r') as file:
Expand All @@ -15,7 +40,7 @@ def processData():
kin_altcorr1 = []
error_altcorr1 = []

# jet data
# jet data

for i in tables:
if i == 1:
Expand All @@ -37,7 +62,7 @@ def processData():
y_min = 2.5
y_max = 3
y_central = None
hepdata_tables="rawdata/atlas_inclusive_jet2015_r04_eta"+str(i)+".yaml"
hepdata_tables = "rawdata/atlas_inclusive_jet2015_r04_eta" + str(i) + ".yaml"
with open(hepdata_tables, 'r') as file:
input = yaml.safe_load(file)

Expand All @@ -50,21 +75,32 @@ def processData():
value_delta = 0
error_value = {}
for k in range(len(values[j]['errors'])):
se_delta, se_sigma = se(values[j]['errors'][k]['asymerror']['plus'], values[j]['errors'][k]['asymerror']['minus'])
se_delta, se_sigma = symmetrize_errors(
values[j]['errors'][k]['asymerror']['plus'],
values[j]['errors'][k]['asymerror']['minus'],
)
value_delta = value_delta + se_delta
error_label = str(values[j]['errors'][k]['label'])
error_value[error_label] = se_sigma
data_central_value = values[j]['value'] + value_delta
data_central.append(data_central_value)
error.append(error_value)
kin_value = {'sqrts': {'min': None, 'mid': sqrts, 'max': None}, 'pT': {'min': pT_min, 'mid': None, 'max': pT_max}, 'y': {'min': y_min, 'mid': y_central, 'max': y_max}}
kin_value = {
'sqrts': {'min': None, 'mid': sqrts, 'max': None},
'pT': {'min': pT_min, 'mid': None, 'max': pT_max},
'y': {'min': y_min, 'mid': y_central, 'max': y_max},
}
kin.append(kin_value)

hepdata_tables="rawdata/atlas_inclusive_jet2015_r04_eta1.yaml"
hepdata_tables = "rawdata/atlas_inclusive_jet2015_r04_eta1.yaml"
with open(hepdata_tables, 'r') as file:
input = yaml.safe_load(file)
error_definition = {}
error_definition['stat'] = {'description': 'total statistical uncertainty', 'treatment': 'ADD', 'type': 'UNCORR'}
error_definition['stat'] = {
'description': 'total statistical uncertainty',
'treatment': 'ADD',
'type': 'UNCORR',
}
for i in range(1, len(input['dependent_variables'][0]['values'][0]['errors'])):
error_name = input['dependent_variables'][0]['values'][0]['errors'][i]['label']
error_definition[error_name] = {'description': '', 'treatment': 'MULT', 'type': 'CORR'}
Expand All @@ -74,15 +110,15 @@ def processData():
uncertainties_yaml = {'definitions': error_definition, 'bins': error}

with open('data.yaml', 'w') as file:
yaml.dump(data_central_yaml, file, sort_keys=False)
yaml.dump(data_central_yaml, file, sort_keys=False)

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

with open('uncertainties.yaml', 'w') as file:
yaml.dump(uncertainties_yaml, file, sort_keys=False)

# jet altcorr1 data
# jet altcorr1 data

for i in tables_altcorr1:
if i == 1:
Expand All @@ -104,7 +140,7 @@ def processData():
y_min = 2.5
y_max = 3
y_central = None
hepdata_tables="rawdata/atlas_inclusive_jet2015_r04_altcorr1_eta"+str(i)+".yaml"
hepdata_tables = "rawdata/atlas_inclusive_jet2015_r04_altcorr1_eta" + str(i) + ".yaml"
with open(hepdata_tables, 'r') as file:
input = yaml.safe_load(file)

Expand All @@ -117,36 +153,52 @@ def processData():
value_delta = 0
error_value = {}
for k in range(len(values[j]['errors'])):
se_delta, se_sigma = se(values[j]['errors'][k]['asymerror']['plus'], values[j]['errors'][k]['asymerror']['minus'])
se_delta, se_sigma = symmetrize_errors(
values[j]['errors'][k]['asymerror']['plus'],
values[j]['errors'][k]['asymerror']['minus'],
)
value_delta = value_delta + se_delta
error_label = str(values[j]['errors'][k]['label'])
error_value[error_label] = se_sigma
data_central_value = values[j]['value'] + value_delta
data_central_altcorr1.append(data_central_value)
error_altcorr1.append(error_value)
kin_value = {'sqrts': {'min': None, 'mid': sqrts, 'max': None}, 'pT': {'min': pT_min, 'mid': None, 'max': pT_max}, 'y': {'min': y_min, 'mid': y_central, 'max': y_max}}
kin_value = {
'sqrts': {'min': None, 'mid': sqrts, 'max': None},
'pT': {'min': pT_min, 'mid': None, 'max': pT_max},
'y': {'min': y_min, 'mid': y_central, 'max': y_max},
}
kin_altcorr1.append(kin_value)

hepdata_tables="rawdata/atlas_inclusive_jet2015_r04_altcorr1_eta1.yaml"
hepdata_tables = "rawdata/atlas_inclusive_jet2015_r04_altcorr1_eta1.yaml"
with open(hepdata_tables, 'r') as file:
input = yaml.safe_load(file)
error_definition_altcorr1 = {}
error_definition_altcorr1['stat'] = {'description': 'total statistical uncertainty', 'treatment': 'ADD', 'type': 'UNCORR'}
error_definition_altcorr1['stat'] = {
'description': 'total statistical uncertainty',
'treatment': 'ADD',
'type': 'UNCORR',
}
for i in range(1, len(input['dependent_variables'][0]['values'][0]['errors'])):
error_name = input['dependent_variables'][0]['values'][0]['errors'][i]['label']
error_definition_altcorr1[error_name] = {'description': '', 'treatment': 'MULT', 'type': 'CORR'}
error_definition_altcorr1[error_name] = {
'description': '',
'treatment': 'MULT',
'type': 'CORR',
}

data_central_altcorr1_yaml = {'data_central': data_central_altcorr1}
kinematics_altcorr1_yaml = {'bins': kin_altcorr1}
uncertainties_altcorr1_yaml = {'definitions': error_definition_altcorr1, 'bins': error_altcorr1}

with open('data_altcorr1.yaml', 'w') as file:
yaml.dump(data_central_altcorr1_yaml, file, sort_keys=False)
yaml.dump(data_central_altcorr1_yaml, file, sort_keys=False)

with open('kinematics_altcorr1.yaml', 'w') as file:
yaml.dump(kinematics_altcorr1_yaml, file, sort_keys=False)
yaml.dump(kinematics_altcorr1_yaml, file, sort_keys=False)

with open('uncertainties_altcorr1.yaml', 'w') as file:
yaml.dump(uncertainties_altcorr1_yaml, file, sort_keys=False)


processData()
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ implemented_observables:
x_scale: log
dataset_label: 'ATLAS Jet 13 TeV: $\frac{d^2\sigma}{dp_T d|y|}$'
plot_x: pT
y_label: '$\frac{d^2\sigma}{dp_T d|y|}$ ($\frac{pb}{GeV}$)'
figure_by:
- y
theory:
Expand Down Expand Up @@ -70,6 +71,7 @@ implemented_observables:
x_scale: log
dataset_label: 'ATLAS Jet 13 TeV: $\frac{d^2\sigma}{dp_T d|y|}$'
plot_x: pT
y_label: '$\frac{d^2\sigma}{dp_T d|y|}$ ($\frac{pb}{GeV}$)'
figure_by:
- y
theory:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
from math import sqrt

import yaml
from validphys.commondata_utils import symmetrize_errors as se


def symmetrize_errors(delta_plus, delta_minus):
r"""Compute the symmterized uncertainty and the shift in data point.
Parameters
----------
delta_plus : float
The top/plus uncertainty with sign
delta_minus : float
The bottom/minus uncertainty with sign

Returns
-------
se_delta : float
The value to be added to the data point
se_sigma : float
The symmetrized uncertainty to be used in commondata
"""
semi_diff = (delta_plus + delta_minus) / 2
average = (delta_plus - delta_minus) / 2
se_delta = semi_diff
se_sigma = sqrt(average * average + 2 * semi_diff * semi_diff)
return se_delta, se_sigma


def processData():
with open('metadata.yaml', 'r') as file:
Expand Down Expand Up @@ -31,7 +56,7 @@ def processData():
y_min = 2.5
y_max = 3
y_central = None
hepdata_tables="rawdata/atlas_mjj_jet2015_r04_ystar"+str(i)+".yaml"
hepdata_tables = "rawdata/atlas_mjj_jet2015_r04_ystar" + str(i) + ".yaml"
with open(hepdata_tables, 'r') as file:
input = yaml.safe_load(file)

Expand All @@ -44,21 +69,32 @@ def processData():
value_delta = 0
error_value = {}
for k in range(len(values[j]['errors'])):
se_delta, se_sigma = se(values[j]['errors'][k]['asymerror']['plus'], values[j]['errors'][k]['asymerror']['minus'])
se_delta, se_sigma = symmetrize_errors(
values[j]['errors'][k]['asymerror']['plus'],
values[j]['errors'][k]['asymerror']['minus'],
)
value_delta = value_delta + se_delta
error_label = str(values[j]['errors'][k]['label'])
error_value[error_label] = se_sigma
data_central_value = values[j]['value'] + value_delta
data_central.append(data_central_value)
error.append(error_value)
kin_value = {'sqrts': {'min': None, 'mid': sqrts, 'max': None}, 'm_jj': {'min': m_jj_min, 'mid': None, 'max': m_jj_max}, 'ystar': {'min': y_min, 'mid': y_central, 'max': y_max}}
kin_value = {
'sqrts': {'min': None, 'mid': sqrts, 'max': None},
'm_jj': {'min': m_jj_min, 'mid': None, 'max': m_jj_max},
'ystar': {'min': y_min, 'mid': y_central, 'max': y_max},
}
kin.append(kin_value)

hepdata_tables="rawdata/atlas_mjj_jet2015_r04_ystar1.yaml"
hepdata_tables = "rawdata/atlas_mjj_jet2015_r04_ystar1.yaml"
with open(hepdata_tables, 'r') as file:
input = yaml.safe_load(file)
error_definition = {}
error_definition['stat'] = {'description': 'total statistical uncertainty', 'treatment': 'ADD', 'type': 'UNCORR'}
error_definition['stat'] = {
'description': 'total statistical uncertainty',
'treatment': 'ADD',
'type': 'UNCORR',
}
for i in range(1, len(input['dependent_variables'][0]['values'][0]['errors'])):
error_name = input['dependent_variables'][0]['values'][0]['errors'][i]['label']
error_definition[error_name] = {'description': '', 'treatment': 'MULT', 'type': 'CORR'}
Expand All @@ -68,12 +104,13 @@ def processData():
uncertainties_yaml = {'definitions': error_definition, 'bins': error}

with open('data.yaml', 'w') as file:
yaml.dump(data_central_yaml, file, sort_keys=False)
yaml.dump(data_central_yaml, file, sort_keys=False)

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

with open('uncertainties.yaml', 'w') as file:
yaml.dump(uncertainties_yaml, file, sort_keys=False)


processData()
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ implemented_observables:
plotting:
kinematics_override: identity
x_scale: log
dataset_label: 'ATLAS DiJet 13 TeV: $\frac{d^2\sigma}{dm_{jj} d|y|}$'
dataset_label: 'ATLAS DiJet 13 TeV: $\frac{d^2\sigma}{dm_{jj} d|y^*|}$'
plot_x: m_jj
y_label: '$\frac{d^2\sigma}{dm_{jj} d|y^*|}$ ($\frac{pb}{GeV}$)'
figure_by:
- ystar
theory:
Expand Down
Loading
Loading