-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
807cc21
commit 7cfdea7
Showing
24 changed files
with
1,710 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
data_central: | ||
- -0.311 | ||
- -0.195 | ||
- -0.154 | ||
- -0.142 | ||
- -0.099 | ||
- -0.042 | ||
- 0.01 | ||
- 0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import pandas as pd | ||
import yaml | ||
import numpy as np | ||
import glob | ||
|
||
|
||
def read_data(fnames): | ||
df = pd.DataFrame() | ||
for fname in fnames: | ||
with open(fname, "r") as file: | ||
data = yaml.safe_load(file) | ||
|
||
xsub = data["independent_variables"][0]["values"] | ||
y = 0.0 | ||
Q2 = 2.0 | ||
Gsub = data["dependent_variables"][0]["values"] | ||
|
||
|
||
for i in range(len(xsub)): | ||
try: | ||
xsub[i]["low"] | ||
except NameError: | ||
xsub[i]["low"] = None | ||
try: | ||
xsub[i]["high"] | ||
except NameError: | ||
xsub[i]["high"] = None | ||
df = pd.concat( | ||
[ | ||
df, | ||
pd.DataFrame( | ||
{ | ||
"x": [xsub[i]["value"]], | ||
"x_low": [xsub[i]["low"]], | ||
"x_high": [xsub[i]["high"]], | ||
"y": [y], | ||
"Q2": [Q2], | ||
"G": [Gsub[i]["value"]], | ||
"stat": [Gsub[i]["errors"][0]["symerror"]], | ||
"sys": [Gsub[i]["errors"][1]["symerror"]], | ||
} | ||
), | ||
], | ||
ignore_index=True, | ||
) | ||
|
||
return df | ||
|
||
|
||
def write_data(df): | ||
data_central = [] | ||
for i in range(len(df["G"])): | ||
data_central.append(float(df.loc[i, "G"])) | ||
|
||
data_central_yaml = {"data_central": data_central} | ||
with open("data.yaml", "w") as file: | ||
yaml.dump(data_central_yaml, file, sort_keys=False) | ||
|
||
# Write kin file | ||
kin = [] | ||
for i in range(len(df["G"])): | ||
kin_value = { | ||
"x": {"min": float(df.loc[i, "x_low"]), "mid": float(df.loc[i, "x"]), "max": float(df.loc[i, "x_high"])}, | ||
"Q2": {"min": None, "mid": float(df.loc[i, "Q2"]), "max": None}, | ||
"y": {"min": None, "mid": float(df.loc[i, "y"]), "max": None}, | ||
} | ||
kin.append(kin_value) | ||
|
||
kinematics_yaml = {"bins": kin} | ||
|
||
with open("kinematics.yaml", "w") as file: | ||
yaml.dump(kinematics_yaml, file, sort_keys=False) | ||
|
||
# Write unc file | ||
error = [] | ||
for i in range(len(df)): | ||
e = { | ||
"stat": float(df.loc[i, "stat"]), | ||
"sys": float(df.loc[i, "sys"]), | ||
} | ||
error.append(e) | ||
|
||
error_definition = { | ||
"stat": { | ||
"description": "statistical uncertainty", | ||
"treatment": "ADD", | ||
"type": "UNCORR", | ||
}, | ||
"sys": { | ||
"description": "systematic uncertainty", | ||
"treatment": "ADD", | ||
"type": "UNCORR", | ||
}, | ||
} | ||
|
||
uncertainties_yaml = {"definitions": error_definition, "bins": error} | ||
|
||
with open("uncertainties.yaml", "w") as file: | ||
yaml.dump(uncertainties_yaml, file, sort_keys=False) | ||
|
||
|
||
if __name__ == "__main__": | ||
fnames = glob.glob("rawdata/*.yaml") | ||
df = read_data(fnames) | ||
write_data(df) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
bins: | ||
- x: | ||
min: 0.03 | ||
mid: 0.04 | ||
max: 0.04 | ||
Q2: | ||
min: null | ||
mid: 2.0 | ||
max: null | ||
y: | ||
min: null | ||
mid: 0.0 | ||
max: null | ||
- x: | ||
min: 0.04 | ||
mid: 0.05 | ||
max: 0.06 | ||
Q2: | ||
min: null | ||
mid: 2.0 | ||
max: null | ||
y: | ||
min: null | ||
mid: 0.0 | ||
max: null | ||
- x: | ||
min: 0.06 | ||
mid: 0.081 | ||
max: 0.1 | ||
Q2: | ||
min: null | ||
mid: 2.0 | ||
max: null | ||
y: | ||
min: null | ||
mid: 0.0 | ||
max: null | ||
- x: | ||
min: 0.1 | ||
mid: 0.124 | ||
max: 0.15 | ||
Q2: | ||
min: null | ||
mid: 2.0 | ||
max: null | ||
y: | ||
min: null | ||
mid: 0.0 | ||
max: null | ||
- x: | ||
min: 0.15 | ||
mid: 0.174 | ||
max: 0.2 | ||
Q2: | ||
min: null | ||
mid: 2.0 | ||
max: null | ||
y: | ||
min: null | ||
mid: 0.0 | ||
max: null | ||
- x: | ||
min: 0.2 | ||
mid: 0.245 | ||
max: 0.3 | ||
Q2: | ||
min: null | ||
mid: 2.0 | ||
max: null | ||
y: | ||
min: null | ||
mid: 0.0 | ||
max: null | ||
- x: | ||
min: 0.3 | ||
mid: 0.341 | ||
max: 0.4 | ||
Q2: | ||
min: null | ||
mid: 2.0 | ||
max: null | ||
y: | ||
min: null | ||
mid: 0.0 | ||
max: null | ||
- x: | ||
min: 0.4 | ||
mid: 0.466 | ||
max: 0.6 | ||
Q2: | ||
min: null | ||
mid: 2.0 | ||
max: null | ||
y: | ||
min: null | ||
mid: 0.0 | ||
max: null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Generalia | ||
setname: "E142_NC_2GEV_EN_G1" | ||
|
||
version: 1 | ||
version_comment: "Initial implementation" | ||
|
||
# References | ||
APS: | ||
url: "https://journals.aps.org/prd/abstract/10.1103/PhysRevD.54.6620" | ||
iNSPIRE: | ||
url: "https://inspirehep.net/literature/424108" | ||
hepdata: | ||
url: "https://www.hepdata.net/record/ins424108" | ||
version: 1 | ||
|
||
nnpdf_metadata: | ||
nnpdf31_process: "DIS" | ||
experiment: "E142" | ||
|
||
implemented_observables: | ||
- observable_name: "G1" | ||
observable: | ||
description: "E142 DIS scattering experiment polarized structure function" | ||
label: "$g_1$" | ||
units: "" | ||
process_type: "DIS" | ||
ndata: 8 | ||
tables: [5] | ||
npoints: [8] # number of datapoints in each table | ||
|
||
# Plotting information | ||
plotting: | ||
kinematics_override: dis_sqrt_scale | ||
dataset_label: "E142 (g1)" | ||
plot_x: x | ||
y_label: '$g_{1,N}(x, Q^2)$' | ||
figure_by: | ||
- Q2 | ||
kinematic_coverage: [x, y, Q2] | ||
|
||
kinematics: | ||
variables: | ||
x: {description: "momentum fraction", label: "$x$", units: ""} | ||
Q2: {description: "virtuality", label: "$Q^2$", units: "$GeV^2$"} | ||
y: {description: "inelasticity", label: "$y$", units: ""} | ||
file: kinematics.yaml | ||
|
||
data_central: data.yaml | ||
data_uncertainties: | ||
- uncertainties.yaml | ||
|
||
theory: | ||
FK_tables: | ||
- - E142_NC_2GEV_EN_G1 | ||
operation: 'null' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
dependent_variables: | ||
- header: {name: G1} | ||
qualifiers: | ||
- {name: PLAB, units: GEV, value: 19.42 + 22.66 + 25.51} | ||
- {name: Q**2, units: GeV^2, value: '2.0'} | ||
- {name: RE, value: E- N --> E- X} | ||
- {name: SQRT(S), units: GeV, value: '58.056'} | ||
values: | ||
- errors: | ||
- {label: stat, symerror: 0.207} | ||
- {label: sys, symerror: 0.074} | ||
value: -0.311 | ||
- errors: | ||
- {label: stat, symerror: 0.09} | ||
- {label: sys, symerror: 0.036} | ||
value: -0.195 | ||
- errors: | ||
- {label: stat, symerror: 0.044} | ||
- {label: sys, symerror: 0.026} | ||
value: -0.154 | ||
- errors: | ||
- {label: stat, symerror: 0.031} | ||
- {label: sys, symerror: 0.022} | ||
value: -0.142 | ||
- errors: | ||
- {label: stat, symerror: 0.026} | ||
- {label: sys, symerror: 0.016} | ||
value: -0.099 | ||
- errors: | ||
- {label: stat, symerror: 0.018} | ||
- {label: sys, symerror: 0.009} | ||
value: -0.042 | ||
- errors: | ||
- {label: stat, symerror: 0.02} | ||
- {label: sys, symerror: 0.006} | ||
value: 0.01 | ||
- errors: | ||
- {label: stat, symerror: 0.02} | ||
- {label: sys, symerror: 0.003} | ||
value: 0.0 | ||
independent_variables: | ||
- header: {name: X} | ||
values: | ||
- {high: 0.04, low: 0.03, value: 0.04} | ||
- {high: 0.06, low: 0.04, value: 0.05} | ||
- {high: 0.1, low: 0.06, value: 0.081} | ||
- {high: 0.15, low: 0.1, value: 0.124} | ||
- {high: 0.2, low: 0.15, value: 0.174} | ||
- {high: 0.3, low: 0.2, value: 0.245} | ||
- {high: 0.4, low: 0.3, value: 0.341} | ||
- {high: 0.6, low: 0.4, value: 0.466} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
definitions: | ||
stat: | ||
description: statistical uncertainty | ||
treatment: ADD | ||
type: UNCORR | ||
sys: | ||
description: systematic uncertainty | ||
treatment: ADD | ||
type: UNCORR | ||
bins: | ||
- stat: 0.207 | ||
sys: 0.074 | ||
- stat: 0.09 | ||
sys: 0.036 | ||
- stat: 0.044 | ||
sys: 0.026 | ||
- stat: 0.031 | ||
sys: 0.022 | ||
- stat: 0.026 | ||
sys: 0.016 | ||
- stat: 0.018 | ||
sys: 0.009 | ||
- stat: 0.02 | ||
sys: 0.006 | ||
- stat: 0.02 | ||
sys: 0.003 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
data_central: | ||
- -0.269 | ||
- -0.177 | ||
- -0.151 | ||
- -0.146 | ||
- -0.105 | ||
- -0.045 | ||
- 0.011 | ||
- 0.0 |
Oops, something went wrong.