-
Notifications
You must be signed in to change notification settings - Fork 0
/
read_pipeline1_time.py
210 lines (178 loc) · 8.13 KB
/
read_pipeline1_time.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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
import numpy as np
import pandas as pd
import argparse
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
plt.rcParams["font.family"] = "Times New Roman"
parser = argparse.ArgumentParser(description='Configure the files before training the net.')
parser.add_argument('--iq_slice_len',default=131072, type=int, choices = [32768, 65536, 131072, 262144, 524288], help='Slice length for processing IQ files')
args = parser.parse_args()
print('Argument parser inputs', args)
#Processing files for Pipeline 1
# filename = 'D:/IARPA_DATA/Pipeline1_timing_for_SSCA/POWDER/P1_proc_BW5MHz.log'
# filename = 'D:/IARPA_DATA/Pipeline1_timing_for_SSCA/POWDER/P1_proc_BW10MHz.log'
# filename = 'D:/IARPA_DATA/Pipeline1_timing_for_SSCA/NWRA/P1_proc_BW5MHz_V.log'
# filename = 'D:/IARPA_DATA/Pipeline1_timing_for_SSCA/NWRA/P1_proc_BW10MHz_V.log'
filename = 'D:/IARPA_DATA/Pipeline1_timing_for_SSCA/NEU/P1_proc_Vini_2.log'
# data = pd.read_csv(filename, sep=' ', index_col=False, keep_default_na = False)
# data.fillna(0, inplace = True)
# print('The fisr BL:', data['BL'][0])
#
# args = parser.parse_args()
# print('Argument parser inputs', args)
#
#
# print("Size of block lenght", len(data['BL']))
# # for i, row in enumerate(data.values):
# # # print(i, row)
# # print(data['BL'][i])
# # if data['BL'][i] == args.iq_slice_len:
# # print (row)
calculate = False
total_time_per_file = 0
time_list_13 = []
time_list_26 = []
time_list_52 = []
# BLOCK LENGTH: 131072
with open(filename, encoding='utf8') as f:
total_count = 0
total_time = 0
#total_time_per_file = 0
for line in f:
one_line = line.strip()
if one_line[0] =='B': # should be 'V' incase of NEU dataset
oneline_list= one_line.split(' ')[3:4]
#oneline_np = np.array(oneline_list)
# print("The numpy array: ", oneline_np)
# oneline_np = np.expand_dims(oneline_np, axis=0)
print(oneline_list[0])
if total_time_per_file > 0:
time_list_13.append(total_time_per_file)
calculate = False
total_time_per_file = 0
# for x, elem in enumerate(oneline_list):
if str(args.iq_slice_len) == oneline_list[0].strip():
print("Hereeeeeeeeeeeeeeeeeeee:", oneline_list[0].strip())
#total_time_per_file = 0
calculate = True
# else:
# # print("Total time per file: ", total_time_per_file)
# calculate = False
else:
# print(one_line, calculate, total_time_per_file)
if calculate == True:
#print(one_line)
total_time_per_file += float(one_line)
# else:
# total_time += float(one_line)
# total_count += 1
# time_list.append(float(one_line))
# print("The required average time: ", total_time/total_count)
# print("The mean and standard daviation:",total_time, np.mean(np.array(time_list), axis =0), np.std(np.array(time_list), axis =0) )
print("The list: ", time_list_13)
#####################################################
# BLOCK LENGTH: 262144
with open(filename, encoding='utf8') as f:
total_count = 0
total_time = 0
#total_time_per_file = 0
for line in f:
one_line = line.strip()
if one_line[0] =='B': # should be 'V' incase of NEU dataset
oneline_list= one_line.split(' ')[3:4]
#oneline_np = np.array(oneline_list)
# print("The numpy array: ", oneline_np)
# oneline_np = np.expand_dims(oneline_np, axis=0)
print(oneline_list[0])
if total_time_per_file > 0:
time_list_26.append(total_time_per_file)
calculate = False
total_time_per_file = 0
# for x, elem in enumerate(oneline_list):
if str(262144) == oneline_list[0].strip():
print("Hereeeeeeeeeeeeeeeeeeee:", oneline_list[0].strip())
#total_time_per_file = 0
calculate = True
# else:
# # print("Total time per file: ", total_time_per_file)
# calculate = False
else:
# print(one_line, calculate, total_time_per_file)
if calculate == True:
#print(one_line)
total_time_per_file += float(one_line)
# else:
# total_time += float(one_line)
# total_count += 1
# time_list.append(float(one_line))
# print("The required average time: ", total_time/total_count)
# print("The mean and standard daviation:",total_time, np.mean(np.array(time_list), axis =0), np.std(np.array(time_list), axis =0) )
print("The list: ", time_list_26)
# x = np.linspace(0.1, 2 * np.pi, 41)
# y = np.exp(np.sin(x))
#####################################################
# BLOCK LENGTH: 524288
with open(filename, encoding='utf8') as f:
total_count = 0
total_time = 0
#total_time_per_file = 0
for line in f:
one_line = line.strip()
if one_line[0] =='B': # should be 'V' incase of NEU dataset
oneline_list= one_line.split(' ')[3:4]
#oneline_np = np.array(oneline_list)
# print("The numpy array: ", oneline_np)
# oneline_np = np.expand_dims(oneline_np, axis=0)
print(oneline_list[0])
if total_time_per_file > 0:
time_list_52.append(total_time_per_file)
calculate = False
total_time_per_file = 0
# for x, elem in enumerate(oneline_list):
if str(524288) == oneline_list[0].strip():
print("Hereeeeeeeeeeeeeeeeeeee:", oneline_list[0].strip())
#total_time_per_file = 0
calculate = True
# else:
# # print("Total time per file: ", total_time_per_file)
# calculate = False
else:
# print(one_line, calculate, total_time_per_file)
if calculate == True:
#print(one_line)
total_time_per_file += float(one_line)
# else:
# total_time += float(one_line)
# total_count += 1
# time_list.append(float(one_line))
# print("The required average time: ", total_time/total_count)
# print("The mean and standard daviation:",total_time, np.mean(np.array(time_list), axis =0), np.std(np.array(time_list), axis =0) )
print("The list: ", time_list_52)
print("The mean and std for 131072 block length: ", np.mean(np.array(time_list_13), axis =0), np.std(np.array(time_list_13), axis =0))
print("The mean and std for 262144 block length: ", np.mean(np.array(time_list_26), axis =0), np.std(np.array(time_list_26), axis =0))
print("The mean and std for 524288 block length: ", np.mean(np.array(time_list_52), axis =0), np.std(np.array(time_list_52), axis =0))
samples_to_plot = len(time_list_13)
# PLOTTING THE
fig, ax = plt.subplots()
mean_13 = sum(time_list_13[0:samples_to_plot])/len(time_list_13[0:samples_to_plot])
mean_26 = sum(time_list_26[0:samples_to_plot])/len(time_list_26[0:samples_to_plot])
mean_52 = sum(time_list_52[0:samples_to_plot])/len(time_list_52[0:samples_to_plot])
x_13, y_13, text_13 = samples_to_plot//2 -500, mean_13, "Mean (131072): "+"{:.2f}".format(mean_13) + " s"
x_26, y_26, text_26 = samples_to_plot//2 -500, mean_26+1, "Mean (262144): "+"{:.2f}".format(mean_26) + " s"
x_52, y_52, text_52 = samples_to_plot//2 -500, mean_52, "Mean (524288): "+"{:.2f}".format(mean_52) + " s"
plt.xticks(fontsize=15,rotation=0)
plt.yticks(fontsize=15)
plt.ylabel('Processing Time (s)', fontsize=15)
plt.xlabel('Frame Index', fontsize=15)
plt.plot(time_list_13[0:samples_to_plot], color ='g', label="131072")
# plt.plot(mean_list_13[0:250],'b', '-.')
plt.axhline(y = mean_13, color = 'g', linestyle = '-.',linewidth=3)
ax.text(x_13, y_13, text_13,fontsize=15)
plt.plot(time_list_26[0:samples_to_plot], color ='y', label="262144")
plt.axhline(y = mean_26, color = 'y', linestyle = '-.',linewidth=3)
ax.text(x_26, y_26, text_26,fontsize=15)
plt.plot(time_list_52[0:samples_to_plot], color ='m', label="524288")
ax.text(x_52, y_52, text_52,fontsize=15)
plt.axhline(y = mean_52, color = 'm', linestyle = '-.',linewidth=3)
plt.legend(fontsize=15)
plt.show()