|
| 1 | +import numpy as np |
| 2 | +from numpy.linalg import eig |
| 3 | +import yaml |
| 4 | + |
| 5 | +from nnpdf_data.filter_utils.utils import concat_matrices as cm |
| 6 | +from nnpdf_data.filter_utils.utils import cormat_to_covmat as ctc |
| 7 | +from nnpdf_data.filter_utils.utils import covmat_to_artunc as cta |
| 8 | +from nnpdf_data.filter_utils.utils import matlist_to_matrix as mtm |
| 9 | +from nnpdf_data.filter_utils.utils import percentage_to_absolute as pta |
| 10 | + |
| 11 | + |
| 12 | +def artunc(): |
| 13 | + statArr = [] |
| 14 | + for i in [618, 610, 614, 626]: |
| 15 | + with open('rawdata/Table' + str(i) + '.yaml', 'r') as file: |
| 16 | + input = yaml.safe_load(file) |
| 17 | + for j in range(len(input['dependent_variables'][0]['values'])): |
| 18 | + datval = input['dependent_variables'][0]['values'][j]['value'] |
| 19 | + statperc = input['dependent_variables'][0]['values'][j]['errors'][0]['symerror'] |
| 20 | + statArr.append(pta(statperc, datval)) |
| 21 | + |
| 22 | + # mttbar(9)| pTt (8)| yt(5)| yttbar(7) |
| 23 | + # mttbar| 803 801 802 810 |
| 24 | + # pTt | 801t 798 799 808 |
| 25 | + # yt | 802t 799t 800 809 |
| 26 | + # yttbar| 810t 808t 809t 812 |
| 27 | + ml803, ml801, ml802, ml810, ml798, ml799, ml808, ml800, ml809, ml812 = ([] for i in range(10)) |
| 28 | + |
| 29 | + with open('rawdata/Table803.yaml', 'r') as file: |
| 30 | + input = yaml.safe_load(file) |
| 31 | + for i in range(len(input['dependent_variables'][0]['values'])): |
| 32 | + ml803.append(input['dependent_variables'][0]['values'][i]['value']) |
| 33 | + |
| 34 | + with open('rawdata/Table801.yaml', 'r') as file: |
| 35 | + input = yaml.safe_load(file) |
| 36 | + for i in range(len(input['dependent_variables'][0]['values'])): |
| 37 | + ml801.append(input['dependent_variables'][0]['values'][i]['value']) |
| 38 | + |
| 39 | + with open('rawdata/Table802.yaml', 'r') as file: |
| 40 | + input = yaml.safe_load(file) |
| 41 | + for i in range(len(input['dependent_variables'][0]['values'])): |
| 42 | + ml802.append(input['dependent_variables'][0]['values'][i]['value']) |
| 43 | + |
| 44 | + with open('rawdata/Table810.yaml', 'r') as file: |
| 45 | + input = yaml.safe_load(file) |
| 46 | + for i in range(len(input['dependent_variables'][0]['values'])): |
| 47 | + ml810.append(input['dependent_variables'][0]['values'][i]['value']) |
| 48 | + |
| 49 | + with open('rawdata/Table798.yaml', 'r') as file: |
| 50 | + input = yaml.safe_load(file) |
| 51 | + for i in range(len(input['dependent_variables'][0]['values'])): |
| 52 | + ml798.append(input['dependent_variables'][0]['values'][i]['value']) |
| 53 | + |
| 54 | + with open('rawdata/Table799.yaml', 'r') as file: |
| 55 | + input = yaml.safe_load(file) |
| 56 | + for i in range(len(input['dependent_variables'][0]['values'])): |
| 57 | + ml799.append(input['dependent_variables'][0]['values'][i]['value']) |
| 58 | + |
| 59 | + with open('rawdata/Table808.yaml', 'r') as file: |
| 60 | + input = yaml.safe_load(file) |
| 61 | + for i in range(len(input['dependent_variables'][0]['values'])): |
| 62 | + ml808.append(input['dependent_variables'][0]['values'][i]['value']) |
| 63 | + |
| 64 | + with open('rawdata/Table800.yaml', 'r') as file: |
| 65 | + input = yaml.safe_load(file) |
| 66 | + for i in range(len(input['dependent_variables'][0]['values'])): |
| 67 | + ml800.append(input['dependent_variables'][0]['values'][i]['value']) |
| 68 | + |
| 69 | + with open('rawdata/Table809.yaml', 'r') as file: |
| 70 | + input = yaml.safe_load(file) |
| 71 | + for i in range(len(input['dependent_variables'][0]['values'])): |
| 72 | + ml809.append(input['dependent_variables'][0]['values'][i]['value']) |
| 73 | + |
| 74 | + with open('rawdata/Table812.yaml', 'r') as file: |
| 75 | + input = yaml.safe_load(file) |
| 76 | + for i in range(len(input['dependent_variables'][0]['values'])): |
| 77 | + ml812.append(input['dependent_variables'][0]['values'][i]['value']) |
| 78 | + |
| 79 | + mat803 = mtm(9, 9, ml803) |
| 80 | + mat801 = mtm(9, 8, ml801) |
| 81 | + mat801t = mat801.transpose() |
| 82 | + mat802 = mtm(9, 5, ml802) |
| 83 | + mat802t = mat802.transpose() |
| 84 | + mat810t = mtm(7, 9, ml810) |
| 85 | + mat810 = mat810t.transpose() |
| 86 | + mat798 = mtm(8, 8, ml798) |
| 87 | + mat799t = mtm(5, 8, ml799) |
| 88 | + mat799 = mat799t.transpose() |
| 89 | + mat808t = mtm(7, 8, ml808) |
| 90 | + mat808 = mat808t.transpose() |
| 91 | + mat800 = mtm(5, 5, ml800) |
| 92 | + mat809t = mtm(7, 5, ml809) |
| 93 | + mat809 = mat809t.transpose() |
| 94 | + mat812 = mtm(7, 7, ml812) |
| 95 | + |
| 96 | + cormatlist = cm( |
| 97 | + 4, |
| 98 | + 4, |
| 99 | + [ |
| 100 | + mat803, |
| 101 | + mat801, |
| 102 | + mat802, |
| 103 | + mat810, |
| 104 | + mat801t, |
| 105 | + mat798, |
| 106 | + mat799, |
| 107 | + mat808, |
| 108 | + mat802t, |
| 109 | + mat799t, |
| 110 | + mat800, |
| 111 | + mat809, |
| 112 | + mat810t, |
| 113 | + mat808t, |
| 114 | + mat809t, |
| 115 | + mat812, |
| 116 | + ], |
| 117 | + ) |
| 118 | + |
| 119 | + covmatlist_stat = ctc(statArr, cormatlist) |
| 120 | + covmat_stat = mtm(29, 29, covmatlist_stat) |
| 121 | + artunc = cta(29, covmatlist_stat) |
| 122 | + return covmat_stat, artunc |
0 commit comments