-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathplt.py
More file actions
110 lines (99 loc) · 3.24 KB
/
plt.py
File metadata and controls
110 lines (99 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
from utils import load
import matplotlib.pyplot as plt
import numpy as np
import argparse
import mplhep as hep
plt.style.use(hep.style.CMS)
parser = argparse.ArgumentParser()
parser.add_argument('--restore_file', default=None,
help="Optional, name of the file in --model_dir containing weights to reload before \
training") # 'best' or 'train'
parser.add_argument('--ckpts', default='ckpts',
help="Name of the ckpts folder")
args = parser.parse_args()
a=load(args.ckpts + '/' +args.restore_file+ '.resolutions')
colors = {
'pfMET': 'black',
'puppiMET': 'red',
'deepMETResponse': 'blue',
'deepMETResolution': 'green',
'MET': 'magenta',
}
label_arr = {
'MET': 'Graph MET' ,
'pfMET': 'PF MET',
'puppiMET': 'PUPPI MET',
'deepMETResponse': 'DeepMETResponse',
'deepMETResolution': 'DeepMETResolution',
}
resolutions_arr = {
'MET': [[],[],[]],
'pfMET': [[],[],[]],
'puppiMET': [[],[],[]],
'deepMETResponse': [[],[],[]],
'deepMETResolution': [[],[],[]],
}
for key in resolutions_arr:
plt.figure(1)
xx = a[key]['u_perp_resolution'][1][0:20]
yy = a[key]['u_perp_resolution'][0]
plt.plot(xx, yy,color=colors[key], label=label_arr[key])
plt.figure(2)
xx = a[key]['u_perp_scaled_resolution'][1][0:20]
yy = a[key]['u_perp_scaled_resolution'][0]
plt.plot(xx, yy,color=colors[key], label=label_arr[key])
plt.figure(3)
xx = a[key]['u_par_resolution'][1][0:20]
yy = a[key]['u_par_resolution'][0]
plt.plot(xx, yy,color=colors[key], label=label_arr[key])
plt.figure(4)
xx = a[key]['u_par_scaled_resolution'][1][0:20]
yy = a[key]['u_par_scaled_resolution'][0]
plt.plot(xx, yy,color=colors[key], label=label_arr[key])
plt.figure(5)
xx = a[key]['R'][1][0:20]
yy = a[key]['R'][0]
plt.plot(xx, yy,color=colors[key], label=label_arr[key])
if(True):
model_dir=args.ckpts+'/'+args.restore_file+'_'
plt.figure(1)
plt.axis([0, 400, 0, 35])
plt.xlabel(r'$q_{T}$ [GeV]')
plt.ylabel(r'$\sigma (u_{\perp})$ [GeV]')
plt.legend()
plt.savefig(model_dir+'resol_perp.png')
plt.clf()
plt.close()
plt.figure(2)
plt.axis([0, 400, 0, 35])
plt.xlabel(r'$q_{T}$ [GeV]')
plt.ylabel(r'Scaled $\sigma (u_{\perp})$ [GeV]')
plt.legend()
plt.savefig(model_dir+'resol_perp_scaled.png')
plt.clf()
plt.close()
plt.figure(3)
plt.axis([0, 400, 0, 60])
plt.xlabel(r'$q_{T}$ [GeV]')
plt.ylabel(r'$\sigma (u_{\parallel})$ [GeV]')
plt.legend()
plt.savefig(model_dir+'resol_parallel.png')
plt.clf()
plt.close()
plt.figure(4)
plt.axis([0, 400, 0, 60])
plt.xlabel(r'$q_{T}$ [GeV]')
plt.ylabel(r'Scaled $\sigma (u_{\parallel})$ [GeV]')
plt.legend()
plt.savefig(model_dir+'resol_parallel_scaled.png')
plt.clf()
plt.close()
plt.figure(5)
plt.axis([0, 400, 0, 1.2])
plt.axhline(y=1.0, color='black', linestyle='-.')
plt.xlabel(r'$q_{T}$ [GeV]')
plt.ylabel(r'Response $-\frac{<u_{\parallel}>}{<q_{T}>}$')
plt.legend()
plt.savefig(model_dir+'response_parallel.png')
plt.clf()
plt.close()