-
Notifications
You must be signed in to change notification settings - Fork 1
/
countDuration.py
57 lines (41 loc) · 1.15 KB
/
countDuration.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
import utilities
import random_generator
import numpy as np
import os
from sklearn.preprocessing import normalize
import random
import matplotlib.pyplot as plt
import pickle
import features
if __name__ == '__main__':
currentPath = os.getcwd()
oldpath = "../../alllogs/"
files = utilities.get_all_files(oldpath)
current_path = os.path.join(currentPath, oldpath)
duration_list = []
total_time = 0
daycount = 14
for afile in files:
if daycount == 0:
break
daycount -= 1
print afile
for individual_files in os.listdir(os.path.join(current_path, afile)):
# print individual_files
with open(os.path.join(os.path.join(current_path, afile), individual_files), 'r') as f:
content = f.readlines()
count = len(content)
# print count
# if count > 300:
# print count, content
# print "\n\n\n"
# raw_input()
for line in content:
val = features.duration(line)
if val != None:
duration_list.append(val)
# print count_list
# print sum(count_list) / len(count_list)
# print max(count_list), min(count_list)
print duration_list
pickle.dump(duration_list, open("durations.p", "wb"))