Skip to content
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
261 changes: 261 additions & 0 deletions buildmaster/NMCPD/data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
data_central:
- 0.9815
- 1.003
- 0.9675
- 1.033
- 0.9912
- 1.008
- 0.9824
- 0.9825
- 0.9736
- 0.9704
- 0.9921
- 0.9959
- 1.005
- 1.0
- 1.014
- 0.9945
- 0.9795
- 0.9966
- 0.9893
- 0.9959
- 0.9842
- 0.9817
- 1.011
- 0.9993
- 1.02
- 0.9618
- 0.9775
- 0.9642
- 0.9714
- 0.9891
- 0.975
- 0.9837
- 0.9924
- 0.9683
- 1.008
- 0.953
- 0.969
- 0.9872
- 0.968
- 0.9624
- 0.9797
- 0.9747
- 0.9738
- 0.9813
- 0.9844
- 0.9734
- 0.9821
- 0.9573
- 0.9747
- 1.007
- 0.9939
- 0.9645
- 0.9685
- 0.9834
- 0.9925
- 0.9763
- 0.968
- 0.9761
- 0.9716
- 0.9817
- 0.9942
- 0.9493
- 0.9601
- 0.9408
- 0.962
- 0.9585
- 0.9631
- 0.9849
- 0.9802
- 0.9677
- 0.9581
- 0.979
- 0.9764
- 0.9592
- 0.9893
- 0.9738
- 0.9557
- 0.9264
- 0.9308
- 0.9618
- 0.9723
- 0.9633
- 0.9554
- 0.9572
- 0.9766
- 0.9565
- 0.9611
- 0.9669
- 0.9817
- 0.9686
- 0.9572
- 0.9439
- 0.9101
- 0.9539
- 0.9204
- 0.9738
- 0.94
- 0.9532
- 0.9526
- 0.9642
- 0.9597
- 0.9551
- 0.9577
- 0.9682
- 0.9578
- 0.9532
- 0.9698
- 0.9635
- 0.9488
- 0.9595
- 1.001
- 0.981
- 0.971
- 0.9477
- 0.9449
- 0.9486
- 0.937
- 0.945
- 0.9367
- 0.9394
- 0.9328
- 0.9432
- 0.9371
- 0.9592
- 0.9678
- 0.9351
- 0.9385
- 0.9413
- 0.9313
- 0.9445
- 0.936
- 0.9397
- 0.942
- 0.9245
- 0.9218
- 0.9254
- 0.9291
- 0.9319
- 0.9554
- 0.9233
- 0.9264
- 0.9005
- 0.9227
- 0.915
- 0.9292
- 0.9205
- 0.9114
- 0.9409
- 0.9291
- 0.9266
- 0.9263
- 0.9272
- 0.9123
- 0.9272
- 0.905
- 0.9039
- 0.914
- 0.9427
- 0.9056
- 0.9223
- 0.8966
- 0.9132
- 0.9242
- 0.9212
- 0.9147
- 0.8981
- 0.9068
- 0.9018
- 0.8924
- 0.905
- 0.8453
- 0.8859
- 0.8781
- 0.9173
- 0.8983
- 0.8811
- 0.9134
- 0.8869
- 0.8622
- 0.8676
- 0.8787
- 0.862
- 0.8684
- 0.8641
- 0.8715
- 0.897
- 0.8552
- 0.8761
- 0.8714
- 0.8702
- 0.8445
- 0.8607
- 0.8464
- 0.8534
- 0.8549
- 0.8617
- 0.8651
- 0.867
- 0.8343
- 0.8218
- 0.8219
- 0.8637
- 0.8542
- 0.8505
- 0.8302
- 0.8377
- 0.8202
- 0.8459
- 0.8269
- 0.8334
- 0.832
- 0.8444
- 0.8104
- 0.8027
- 0.8205
- 0.7953
- 0.8332
- 0.7939
- 0.8222
- 0.8188
- 0.7828
- 0.792
- 0.8055
- 0.8197
- 0.762
- 0.7732
- 0.7614
- 0.7771
- 0.7608
- 0.7698
- 0.7793
- 0.7754
- 0.7626
- 0.7529
- 0.7705
- 0.7474
- 0.7575
- 0.7632
- 0.7254
- 0.7209
- 0.7323
- 0.7442
- 0.728
- 0.7345
- 0.7419
- 0.7263
- 0.7281
- 0.7641
- 0.6626
- 0.7622
- 0.6989
- 0.7365
- 0.7418
- 0.7988
- 0.7357
- 0.6717
- 0.7194
- 0.6959
- 0.702
- 0.7724
69 changes: 69 additions & 0 deletions buildmaster/NMCPD/filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#Filter for NMCPD

import sys
import yaml
Comment thread
Radonirinaunimi marked this conversation as resolved.

def filter_NMCPD():
with open('metadata.yaml', 'r') as file:
metadata = yaml.safe_load(file)

version = metadata['hepdata']['version']
tables = metadata['hepdata']['tables']

Comment thread
Radonirinaunimi marked this conversation as resolved.
data_central = []
kin = []
error = []
error_nuc = []

for i in tables:
hepdata_tables="rawdata/HEPData-ins426595-v"+str(version)+"-Table_"+str(i)+".yaml"
with open(hepdata_tables, 'r') as file:
input = yaml.safe_load(file)

values = input['dependent_variables'][0]['values']
x = float(input['dependent_variables'][0]['qualifiers'][4]['value'])
sqrts = float(input['dependent_variables'][0]['qualifiers'][3]['value'])

for j in range(len(values)):

data_central_value = input['dependent_variables'][0]['values'][j]['value']
data_central.append(data_central_value)
Q2 = input['independent_variables'][0]['values'][j]['value']
y = Q2 / ( sqrts * sqrts * x )
kin_value = {'x' : {'min': None, 'mid': x , 'max': None}, 'q2' : {'min': None, 'mid': Q2 , 'max': None} , 'y' : {'min': None, 'mid': y , 'max': None}}
kin.append(kin_value)

error_value = {'stat_1': input['dependent_variables'][0]['values'][j]['errors'][0]['symerror'], 'syst_1': input['dependent_variables'][0]['values'][j]['errors'][1]['symerror']}
error.append(error_value)

error_value_nuc = {'nuclear': input['dependent_variables'][0]['values'][j]['errors'][0]['symerror']}
error_nuc.append(error_value_nuc)

error_definition = {'stat_1': {'description': "total statistical uncertainty", 'treatment': "ADD", 'type': "UNCORR"},
'syst_1': {'description': "total systematic uncertainty", 'treatment': "ADD", 'type': "CORR"}}

error_definition_dw = {'nuclear': {'description': "nuclear uncertainty (deweighted)", 'treatment': "ADD", 'type': "NUC_DW"}}
error_definition_sh = {'nuclear': {'description': "nuclear uncertainty (shifted)", 'treatment': "ADD", 'type': "NUC_SH"}}

data_central_yaml = { 'data_central' : data_central }
kinematics_yaml = { 'bins' : kin }
uncertainties_yaml = { 'definition': error_definition, 'bins' : error }
uncertainties_dw_yaml = { 'definition': error_definition_dw, 'bins' : error_nuc }
uncertainties_sh_yaml = { 'definition': error_definition_sh, 'bins' : error_nuc }

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)

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

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

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

filter_NMCPD()
Comment thread
Radonirinaunimi marked this conversation as resolved.
Loading