-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript2.py
137 lines (120 loc) · 3.16 KB
/
script2.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
i=0
etat = []
protocole = []
mode = []
debit = []
snr = []
atten = []
FEC = []
CRC = []
HEC = []
protocole2 = []
mode2= []
upload= []
download= []
snr_down= []
snr_up= []
atten_down= []
atten_up= []
FEC_down= []
FEC_up= []
CRC_down= []
CRC_up= []
HEC_down= []
HEC_up= []
#
# protocole2 = ["protocole"]
# mode2= ["mode"]
# upload= ["upload"]
# download= ["donwload"]
# snr_down= ["snr_down"]
# snr_up= ["snr_up"]
# atten_down= ["attenuation descendante"]
# atten_up= ["attenuation montante"]
# FEC_down= ["FEC_download"]
# FEC_up= ["FEC_upload"]
# CRC_down= ["CRC_download"]
# CRC_up= ["CRC_upload"]
# HEC_down= ["HEC_download"]
# HEC_up= ["HEC_upload"]
while i<141:
string="C:/Users/Thibaut Wissocq/Desktop/free/file_"+str(i)+".txt"
mon_fichier = open(string,'r')
for lignes in mon_fichier:
# print lignes
# if " Etat " in lignes:
# print str(lignes)
# etat.append(str(lignes)
if "Protocole" in lignes:
# print str(lignes)
protocole.append(lignes)
elif "Mode " in lignes:
# print str(lignes)
mode.append(lignes)
elif "ATM" in lignes:
# print str(lignes)
debit.append(lignes)
elif "Marge de bruit" in lignes:
# print str(lignes)
snr.append(lignes)
elif "nuation" in lignes:
# print str(lignes)
atten.append(lignes)
elif "FEC" in lignes:
# print str(lignes)
FEC.append(lignes)
elif "CRC" in lignes:
# print str(lignes)
CRC.append(lignes)
elif "HEC" in lignes:
# print str(lignes)
HEC.append(lignes)
i+=1
for len in range(1,140):
str2 = protocole[len].rstrip('\n').split(' ')
for i in range(str2.count('')):
str2.remove('')
str2.append(" ")
protocole2.append(str2[1])
str2 = mode[len].rstrip('\n').split(' ')
for i in range(str2.count('')):
str2.remove('')
mode2.append(str2[1])
str2 = debit[len].rstrip('\n').split(' ')
for i in range(str2.count('')):
str2.remove('')
download.append(float(str2[1].rstrip(' kb/s')))
upload.append(float(str2[2].rstrip(' kb/s')))
str2 = snr[len].rstrip('\n').split(' ')
for i in range(str2.count('')):
str2.remove('')
snr_down.append(str2[1].rstrip(' dB'))
snr_up.append(str2[2].rstrip(' dB'))
str2 = atten[len].rstrip('\n').split(' ')
for i in range(str2.count('')):
str2.remove('')
atten_down.append(str2[1].rstrip(' dB'))
atten_up.append(str2[2].rstrip(' dB'))
str2 = FEC[len].rstrip('\n').split(' ')
for i in range(str2.count('')):
str2.remove('')
FEC_down.append(str2[1])
FEC_up.append(str2[2])
str2 = HEC[len].rstrip('\n').split(' ')
for i in range(str2.count('')):
str2.remove('')
HEC_down.append(str2[1])
HEC_up.append(str2[2])
str2 = CRC[len].rstrip('\n').split(' ')
for i in range(str2.count('')):
str2.remove('')
CRC_down.append(str2[1])
CRC_up.append(str2[2])
liste = [protocole2, mode2, download, upload, snr_down, snr_up, atten_down, atten_up, FEC_down, FEC_up, HEC_down, HEC_up, CRC_down, CRC_up]
import csv
with open("output.csv", "wb") as f:
writer = csv.writer(f)
writer.writerows(liste)
import matplotlib.pyplot as plt
plt.plot(download, 'ro')
plt.show()