OLD | NEW |
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. The expected format is | 10 # This script is used to plot simulation dynamics. The expected format is |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 kalman_state = Figure("KalmanState") | 134 kalman_state = Figure("KalmanState") |
135 kalman_state.addSubplot(['kc', 'km'], "Time (s)", "Kalman gain") | 135 kalman_state.addSubplot(['kc', 'km'], "Time (s)", "Kalman gain") |
136 kalman_state.addSubplot(['slope_1/bps'], "Time (s)", "Slope") | 136 kalman_state.addSubplot(['slope_1/bps'], "Time (s)", "Slope") |
137 kalman_state.addSubplot(['var_noise'], "Time (s)", "Var noise") | 137 kalman_state.addSubplot(['var_noise'], "Time (s)", "Var noise") |
138 | 138 |
139 detector_state = Figure("DetectorState") | 139 detector_state = Figure("DetectorState") |
140 detector_state.addSubplot(['offset_ms'], "Time (s)", "Offset") | 140 detector_state.addSubplot(['offset_ms'], "Time (s)", "Offset") |
141 detector_state.addSubplot(['gamma_ms'], "Time (s)", "Gamma") | 141 detector_state.addSubplot(['gamma_ms'], "Time (s)", "Gamma") |
142 | 142 |
| 143 trendline_state = Figure("TrendlineState") |
| 144 trendline_state.addSubplot(["accumulated_delay_ms", "smoothed_delay_ms"], |
| 145 "Time (s)", "Delay (ms)") |
| 146 trendline_state.addSubplot(["trendline_slope"], "Time (s)", "Slope") |
| 147 |
143 # Select which figures to plot here. | 148 # Select which figures to plot here. |
144 figures = [receiver, detector_state] | 149 figures = [receiver, detector_state, trendline_state] |
145 | 150 |
146 # Add samples to the figures. | 151 # Add samples to the figures. |
147 for line in sys.stdin: | 152 for line in sys.stdin: |
148 if line.startswith("[ RUN ]"): | 153 if line.startswith("[ RUN ]"): |
149 test_name = re.search(r'\.(\w+)', line).group(1) | 154 test_name = re.search(r'\.(\w+)', line).group(1) |
150 if line.startswith("PLOT"): | 155 if line.startswith("PLOT"): |
151 try: | 156 try: |
152 (var_name, ssrc, alg_name, time, value) = parse_plot_line(line) | 157 (var_name, ssrc, alg_name, time, value) = parse_plot_line(line) |
153 for f in figures: | 158 for f in figures: |
154 # The sample will be ignored bv the figures that don't need it. | 159 # The sample will be ignored bv the figures that don't need it. |
155 f.addSample(var_name, ssrc, alg_name, time, value) | 160 f.addSample(var_name, ssrc, alg_name, time, value) |
156 except ParsePlotLineException as e: | 161 except ParsePlotLineException as e: |
157 print e.reason | 162 print e.reason |
158 print e.line | 163 print e.line |
159 | 164 |
160 # Plot figures. | 165 # Plot figures. |
161 for f in figures: | 166 for f in figures: |
162 fig = plt.figure(f.name) | 167 fig = plt.figure(f.name) |
163 f.plotFigure(fig) | 168 f.plotFigure(fig) |
164 if save_figure: | 169 if save_figure: |
165 fig.savefig(test_name + f.name + ".png") | 170 fig.savefig(test_name + f.name + ".png") |
166 plt.show() | 171 plt.show() |
167 | 172 |
168 if __name__ == '__main__': | 173 if __name__ == '__main__': |
169 main() | 174 main() |
OLD | NEW |