-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcluster_intervals.py
42 lines (38 loc) · 1.16 KB
/
cluster_intervals.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
from interval_utils import get_times
import pylab
from sys import argv
def scatter_times(name, sheets):
means = []
medians = []
delays = []
mean_points = []
med_points = []
for sheet, delay in sheets:
delays.append(delay)
times = get_times(sheet)
mean = pylab.mean(times)
median = pylab.median(times)
means.append(mean)
medians.append(median)
mean_points.append((mean, sheet))
med_points.append((median, sheet))
print "----------mean points-----------"
for mean, sheet in sorted(mean_points):
print mean, sheet
print "----------median points-----------"
for median, sheet in sorted(med_points):
print median, sheet
pylab.scatter(delays, means, color='r')
pylab.scatter(delays, medians, color='b')
print "show"
pylab.show()
if __name__ == '__main__':
name = argv[1]
datasets = argv[2:]
assert len(datasets) % 2 == 0
sheets = []
for i in xrange(0, len(datasets) - 1, 2):
sheet = datasets[i]
delay = float(datasets[i + 1])
sheets.append((sheet, delay))
scatter_times(name, sheets)