From 978672090941c9ede6b3c07a1e365b59797b9ef3 Mon Sep 17 00:00:00 2001 From: Daniel Johansson Date: Mon, 27 Nov 2017 17:36:15 +0100 Subject: [PATCH] Make it possible to import echo likelihood result without plotting This is a minor change to generated Python code used for testing the echo likelihood metric. Bug: webrtc:8573 Change-Id: Ifb2438fdd36c3ade8cd830df0d05917af0f77dec Reviewed-on: https://webrtc-review.googlesource.com/26281 Commit-Queue: Daniel Johansson Reviewed-by: Henrik Lundin Reviewed-by: Alessio Bazzica Cr-Commit-Position: refs/heads/master@{#20939} --- .../test/audio_processing_simulator.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/audio_processing/test/audio_processing_simulator.cc b/modules/audio_processing/test/audio_processing_simulator.cc index 416fd98849..af1024312f 100644 --- a/modules/audio_processing/test/audio_processing_simulator.cc +++ b/modules/audio_processing/test/audio_processing_simulator.cc @@ -55,12 +55,13 @@ void WriteEchoLikelihoodGraphFileHeader(std::ofstream* output_file) { void WriteEchoLikelihoodGraphFileFooter(std::ofstream* output_file) { (*output_file) << "])" << std::endl - << "x = np.arange(len(y))*.01" << std::endl - << "plt.plot(x, y)" << std::endl - << "plt.ylabel('Echo likelihood')" << std::endl - << "plt.xlabel('Time (s)')" << std::endl - << "plt.ylim([0,1])" << std::endl - << "plt.show()" << std::endl; + << "if __name__ == '__main__':" << std::endl + << " x = np.arange(len(y))*.01" << std::endl + << " plt.plot(x, y)" << std::endl + << " plt.ylabel('Echo likelihood')" << std::endl + << " plt.xlabel('Time (s)')" << std::endl + << " plt.ylim([0,1])" << std::endl + << " plt.show()" << std::endl; } } // namespace