-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplot_lim_bands.py
70 lines (53 loc) · 1.5 KB
/
plot_lim_bands.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from __future__ import division
import pdb
import sys
from csv import reader
from collections import defaultdict
import math
import numpy as np
import os
import matplotlib.pyplot as plt
import pickle
import pdb
def cdf_plot(a, bandwidth):
a = np.array(map(float, a))
max_val = int(math.ceil(np.amax(a, axis = 0)))
z = max_val + 1
cum = [0]*z
for i in xrange(max_val + 1):
for j in xrange(len(a)):
if a[j] <= i:
cum[i] = cum[i] + 1
max_cum = np.amax(cum, axis = 0)
#pdb.set_trace()
cum2 = [float(x/max_cum) for x in cum]
x = [i for i in xrange(z)]
plt.style.use('ggplot')
plt.title('Circuit Performance Ordered by Limiting Bandwidth', y=1.08)
plt.ylabel('CDF')
plt.xlabel('Response Times')
plt.legend(loc='upper center', bbox_to_anchor=(0.5, 1.05),
ncol=3, fancybox=True, shadow=True)
plt.grid(True,color='k')
lab_el = 'Limiting Bandwidth ' + str(bandwidth)
plt.plot(x,cum2, linewidth = 2, label = lab_el)
#plt.show()
def get_times():
times = [[0]*10 for i in xrange(10)]
bandwidths = [0*10]
fp_bandwidths = {}
####getting bandwidths
with open('bandwidth_2.pickle', 'rb') as f:
fp_bandwidths = bandwidths = pickle.load(f)
with open('lim_bands.pickle', 'rb') as f:
times = pickle.load(f)
bandwidths = [fp_bandwidths[i][0] for i in xrange(10)]
for i in xrange(10):
cdf_plot(times[i], bandwidths[i])
plt.show()
def main():
#filename = sys.argv[1]
#country = sys.argv[2]
get_times()
if __name__ == "__main__":
main()