Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: webrtc/modules/remote_bitrate_estimator/test/plot_dynamics.py

Issue 1253473004: BWE Simulation Framework: Standard plot logging (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added missing comma in python script Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 # Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 # 3 #
4 # Use of this source code is governed by a BSD-style license 4 # Use of this source code is governed by a BSD-style license
5 # that can be found in the LICENSE file in the root of the source 5 # that can be found in the LICENSE file in the root of the source
6 # tree. An additional intellectual property rights grant can be found 6 # tree. An additional intellectual property rights grant can be found
7 # in the file PATENTS. All contributing project authors may 7 # in the file PATENTS. All contributing project authors may
8 # be found in the AUTHORS file in the root of the source tree. 8 # be found in the AUTHORS file in the root of the source tree.
9 9
10 # This script is used to plot simulation dynamics. 10 # This script is used to plot simulation dynamics.
(...skipping 30 matching lines...) Expand all
41 return self._subplot 41 return self._subplot
42 42
43 def getYMax(self): 43 def getYMax(self):
44 return self._y_max 44 return self._y_max
45 45
46 def getNumberOfFlows(self): 46 def getNumberOfFlows(self):
47 return len(self._samples) 47 return len(self._samples)
48 48
49 49
50 def addSample(self, line): 50 def addSample(self, line):
51 groups = re.search(r'/\d_(\w+)#\d@(\w*)', line) 51 groups = re.search(r'/\d_(\w+)#\w@(\S*)', line)
52 var_name = groups.group(1) 52 var_name = groups.group(1)
53 alg_name = groups.group(2) 53 alg_name = groups.group(2)
54 54
55 if alg_name not in self._samples.keys(): 55 if alg_name not in self._samples.keys():
56 self._samples[alg_name] = {} 56 self._samples[alg_name] = {}
57 57
58 if var_name not in self._samples[alg_name].keys(): 58 if var_name not in self._samples[alg_name].keys():
59 self._samples[alg_name][var_name] = [] 59 self._samples[alg_name][var_name] = []
60 60
61 sample = re.search(r'(\d+\.\d+)\t([-]?\d+\.\d+)', line) 61 sample = re.search(r'(\d+\.\d+)\t([-]?\d+\.\d+)', line)
62
62 s = (sample.group(1),sample.group(2)) 63 s = (sample.group(1),sample.group(2))
63 self._samples[alg_name][var_name].append(s) 64 self._samples[alg_name][var_name].append(s)
64 65
65 def plotVar(v, ax, show_legend, show_x_label): 66 def plotVar(v, ax, show_legend, show_x_label):
66 if show_x_label: 67 if show_x_label:
67 ax.set_xlabel(v.getXLabel(), fontsize='large') 68 ax.set_xlabel(v.getXLabel(), fontsize='large')
68 ax.set_ylabel(v.getYLabel(), fontsize='large') 69 ax.set_ylabel(v.getYLabel(), fontsize='large')
69 70
70 for alg in v._samples.keys(): 71 for alg in v._samples.keys():
71 i = 1 72 i = 1
(...skipping 19 matching lines...) Expand all
91 'TCP2':'#AAAAAA', 92 'TCP2':'#AAAAAA',
92 'TCP3':'#AAAAAA', 93 'TCP3':'#AAAAAA',
93 'TCP4':'#AAAAAA', 94 'TCP4':'#AAAAAA',
94 'TCP5':'#AAAAAA', 95 'TCP5':'#AAAAAA',
95 'TCP6':'#AAAAAA', 96 'TCP6':'#AAAAAA',
96 'TCP7':'#AAAAAA', 97 'TCP7':'#AAAAAA',
97 'TCP8':'#AAAAAA', 98 'TCP8':'#AAAAAA',
98 'TCP9':'#AAAAAA', 99 'TCP9':'#AAAAAA',
99 'TCP10':'#AAAAAA',} 100 'TCP10':'#AAAAAA',}
100 101
101 plt.setp(line, color=colormap[alg + str(i)]) 102 key = alg + str(i)
103 if key in colormap:
104 plt.setp(line, color=colormap[key])
105 else:
106 plt.setp(line, color='#654321')
107
102 if alg.startswith('Available'): 108 if alg.startswith('Available'):
103 plt.setp(line, linestyle='--') 109 plt.setp(line, linestyle='--')
104 plt.grid(True) 110 plt.grid(True)
105 111
106 x1, x2, y1, y2 = plt.axis() 112 x1, x2, y1, y2 = plt.axis()
107 if v.getYMax() >= 0: 113 if v.getYMax() >= 0:
108 y2 = v.getYMax() 114 y2 = v.getYMax()
109 plt.axis((0, x2, 0, y2)) 115 plt.axis((0, x2, 0, y2))
110 i += 1 116 i += 1
111 117
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 n = var[-1].getSubplot() 151 n = var[-1].getSubplot()
146 i = 0 152 i = 0
147 for v in var: 153 for v in var:
148 ax = fig.add_subplot(n, 1, v.getSubplot()) 154 ax = fig.add_subplot(n, 1, v.getSubplot())
149 plotVar(v, ax, i == 0, i == n - 1) 155 plotVar(v, ax, i == 0, i == n - 1)
150 i += 1 156 i += 1
151 157
152 #fig.savefig(test_name+".jpg") 158 #fig.savefig(test_name+".jpg")
153 plt.show() 159 plt.show()
154 160
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698