-
Notifications
You must be signed in to change notification settings - Fork 0
/
iperfresultsplot.py
48 lines (36 loc) · 1.3 KB
/
iperfresultsplot.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
import numpy as np
import matplotlib.pyplot as plt
# Read the data from the text file using NumPy
data1 = np.genfromtxt('ue1_run1', skip_header=4, usecols=(4, 5, 6,))
data2 = np.genfromtxt('ue2_run1', skip_header=4, usecols=(4, 5, 6,))
# Extract the columns into separate variables
transfer1 = data1[:, 0]
#transfer_unit = data[:, 1]
bandwidth1 = data1[:, 2]
#bandwidth_unit = data[:, 3]
transfer2 = data2[:, 0]
bandwidth2 = data2[:, 2]
for i in range(len(transfer1)):
if transfer1[i] > 10:
transfer1[i] /= 1024
if bandwidth1[i] > 90:
bandwidth1[i] /= 1024
for i in range(len(transfer2)):
if transfer2[i] > 10:
transfer2[i] /= 1024
if bandwidth2[i] > 90:
bandwidth2[i] /= 1024
#print(bandwidth)
#print(transfer)
# Plot the data
plt.plot( bandwidth1, label='Bandwidth1', linewidth=1)
plt.plot( transfer1, label='Transfer1', linewidth=1)
plt.plot( bandwidth2, label = 'Bandwidth2', linewidth=1)
plt.plot( transfer2, label = 'Transfer2', linewidth=1)
plt.xlabel('Time (sec)')
plt.ylabel('Throughput')
plt.legend(['Bandwidth1 - Mbits/sec', 'Transfer1 - MBytes', 'Bandwidth2 - Mbits/sec', 'Transfer2 - MBytes'])
#plt.savefig('Rate_Leg_Mali_SharesController.png')
#plt.savefig('Rate_Leg_Mali_SharesController.eps')
#plt.savefig('Rate_Leg_Mali_SharesController.pdf')
plt.show()