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

Side by Side Diff: webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/simulation.py

Issue 2720203003: Single simulation runner (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/signal_processing.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 1 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
2 # 2 #
3 # Use of this source code is governed by a BSD-style license 3 # Use of this source code is governed by a BSD-style license
4 # that can be found in the LICENSE file in the root of the source 4 # that can be found in the LICENSE file in the root of the source
5 # tree. An additional intellectual property rights grant can be found 5 # tree. An additional intellectual property rights grant can be found
6 # in the file PATENTS. All contributing project authors may 6 # in the file PATENTS. All contributing project authors may
7 # be found in the AUTHORS file in the root of the source tree. 7 # be found in the AUTHORS file in the root of the source tree.
8 8
9 import logging 9 import logging
10 import os 10 import os
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 self._simulate(noise_generator, input_filepath, 92 self._simulate(noise_generator, input_filepath,
93 input_noise_cache_path, output_path, config_filepath) 93 input_noise_cache_path, output_path, config_filepath)
94 94
95 def _simulate(self, noise_generator, input_filepath, input_noise_cache_path, 95 def _simulate(self, noise_generator, input_filepath, input_noise_cache_path,
96 output_path, config_filepath): 96 output_path, config_filepath):
97 """ 97 """
98 Simulates a given combination of APM configurations, probing signals, and 98 Simulates a given combination of APM configurations, probing signals, and
99 noise generators. It iterates over the noise generator internal 99 noise generators. It iterates over the noise generator internal
100 configurations. 100 configurations.
101 """ 101 """
102 # TODO(alessio): implement. 102 # Generate pairs of noisy input and reference signal files.
103 pass 103 noise_generator.generate(
104 input_signal_filepath=input_filepath,
ivoc 2017/03/01 23:22:33 Please use spaces around the '=', this happens sev
AleBzk 2017/03/02 08:30:08 Thanks for your comment. Python has its own style
ivoc 2017/03/02 19:16:26 Ok, then we should keep it this way.
105 input_noise_cache_path=input_noise_cache_path,
106 base_output_path=output_path)
107
108 # For each input-reference pair, simulate a call and evaluate.
109 for noise_generator_config_name in noise_generator.config_names:
110 logging.info(' - noise config: <%s>', noise_generator_config_name)
111
112 # APM input and output signal paths.
113 noisy_signal_filepath = noise_generator.noisy_signal_filepaths[
114 noise_generator_config_name]
115 evaluation_output_path = noise_generator.output_paths[
116 noise_generator_config_name]
117
118 # Simulate a call using the audio processing module.
119 self._audioproc_wrapper.run(
120 config_filepath=config_filepath,
121 input_filepath=noisy_signal_filepath,
122 output_path=evaluation_output_path)
123
124 # Reference signal path for the evaluation step.
125 reference_signal_filepath = noise_generator.reference_signal_filepaths[
126 noise_generator_config_name]
127
128 # Evaluate.
129 self._evaluator.run(
130 evaluation_score_workers=self._evaluation_score_workers,
131 apm_output_filepath=self._audioproc_wrapper.output_filepath,
132 reference_input_filepath=reference_signal_filepath,
133 output_path=evaluation_output_path)
104 134
105 @classmethod 135 @classmethod
106 def _get_paths_collection(cls, filepaths): 136 def _get_paths_collection(cls, filepaths):
107 """ 137 """
108 Given a list of file paths, makes a collection with one pair for each item 138 Given a list of file paths, makes a collection with one pair for each item
109 in the list where the key is the file name without extension and the value 139 in the list where the key is the file name without extension and the value
110 is the path. 140 is the path.
111 """ 141 """
112 filepaths_collection = {} 142 filepaths_collection = {}
113 for filepath in filepaths: 143 for filepath in filepaths:
114 name = os.path.splitext(os.path.split(filepath)[1])[0] 144 name = os.path.splitext(os.path.split(filepath)[1])[0]
115 filepaths_collection[name] = os.path.abspath(filepath) 145 filepaths_collection[name] = os.path.abspath(filepath)
116 return filepaths_collection 146 return filepaths_collection
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/test/py_quality_assessment/quality_assessment/signal_processing.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698