-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathplot_centos.py
executable file
·48 lines (39 loc) · 1.37 KB
/
plot_centos.py
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
#!/usr/bin/env python
import numpy as np
import scipy.stats as stats
import sys
import pylab as pl
import json
with open(sys.argv[1], 'r') as f:
jsondata = json.load(f)
package_scores = []
binary_scores = []
for package in jsondata.keys():
package_scores.append(jsondata[package]['package_score'])
for binary in jsondata[package]['binary_scores']:
binary_scores.append(jsondata[package]['binary_scores'][binary])
p = sorted(package_scores)
b = sorted(binary_scores)
by_package = '' + \
'CentOS 7 CTL scores by package:\n' + \
' n: ' + str(len(p)) + '\n' + \
' max: ' + str(max(p)) + '\n' + \
' min: ' + str(min(p)) + '\n' + \
' mean: ' + str(np.mean(p)) + '\n' + \
' median: ' + str(np.median(p)) + '\n' + \
' stdev: ' + str(np.std(p))
by_binary = '' + \
'CentOS 7 CTL scores by binary:\n' + \
' n: ' + str(len(b)) + '\n' + \
' max: ' + str(max(b)) + '\n' + \
' min: ' + str(min(b)) + '\n' + \
' mean: ' + str(np.mean(b)) + '\n' + \
' median: ' + str(np.median(b)) + '\n' + \
' stdev: ' + str(np.std(b))
print(by_package)
print(by_binary)
pfit = stats.norm.pdf(p, np.mean(p), np.std(p))
pl.plot(p, pfit, 'o')
pl.hist(p, normed=True)
pl.text(-200, 0.0125, by_package, fontsize=9)
pl.show()