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

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

Issue 2812273002: Fix lint errors to enable stricter PyLint rules (Closed)
Patch Set: Rebased Created 3 years, 8 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 # 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 """APM module simulator. 9 """APM module simulator.
10 """ 10 """
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 output_path: base output path for the test data generator. 138 output_path: base output path for the test data generator.
139 config_filepath: APM configuration file to test. 139 config_filepath: APM configuration file to test.
140 """ 140 """
141 # Generate pairs of noisy input and reference signal files. 141 # Generate pairs of noisy input and reference signal files.
142 test_data_generators.Generate( 142 test_data_generators.Generate(
143 input_signal_filepath=input_filepath, 143 input_signal_filepath=input_filepath,
144 input_noise_cache_path=input_noise_cache_path, 144 input_noise_cache_path=input_noise_cache_path,
145 base_output_path=output_path) 145 base_output_path=output_path)
146 146
147 # For each test data pair, simulate a call and evaluate. 147 # For each test data pair, simulate a call and evaluate.
148 for test_data_generators_config_name in test_data_generators.config_names: 148 for config_name in test_data_generators.config_names:
149 logging.info(' - test data generator config: <%s>', 149 logging.info(' - test data generator config: <%s>', config_name)
150 test_data_generators_config_name)
151 150
152 # APM input and output signal paths. 151 # APM input and output signal paths.
153 noisy_signal_filepath = test_data_generators.noisy_signal_filepaths[ 152 noisy_signal_filepath = test_data_generators.noisy_signal_filepaths[
154 test_data_generators_config_name] 153 config_name]
155 evaluation_output_path = test_data_generators.apm_output_paths[ 154 evaluation_output_path = test_data_generators.apm_output_paths[
156 test_data_generators_config_name] 155 config_name]
157 156
158 # Simulate a call using the audio processing module. 157 # Simulate a call using the audio processing module.
159 self._audioproc_wrapper.Run( 158 self._audioproc_wrapper.Run(
160 config_filepath=config_filepath, 159 config_filepath=config_filepath,
161 input_filepath=noisy_signal_filepath, 160 input_filepath=noisy_signal_filepath,
162 output_path=evaluation_output_path) 161 output_path=evaluation_output_path)
163 162
164 # Reference signal path for the evaluation step. 163 # Reference signal path for the evaluation step.
165 reference_signal_filepath = ( 164 reference_signal_filepath = (
166 test_data_generators.reference_signal_filepaths[ 165 test_data_generators.reference_signal_filepaths[
167 test_data_generators_config_name]) 166 config_name])
168 167
169 # Evaluate. 168 # Evaluate.
170 self._evaluator.Run( 169 self._evaluator.Run(
171 evaluation_score_workers=self._evaluation_score_workers, 170 evaluation_score_workers=self._evaluation_score_workers,
172 apm_output_filepath=self._audioproc_wrapper.output_filepath, 171 apm_output_filepath=self._audioproc_wrapper.output_filepath,
173 reference_input_filepath=reference_signal_filepath, 172 reference_input_filepath=reference_signal_filepath,
174 output_path=evaluation_output_path) 173 output_path=evaluation_output_path)
175 174
176 @classmethod 175 @classmethod
177 def _CreatePathsCollection(cls, filepaths): 176 def _CreatePathsCollection(cls, filepaths):
178 """Creates a collection of file paths. 177 """Creates a collection of file paths.
179 178
180 Given a list of file paths, makes a collection with one item for each file 179 Given a list of file paths, makes a collection with one item for each file
181 path. The value is absolute path, the key is the file name without 180 path. The value is absolute path, the key is the file name without
182 extenstion. 181 extenstion.
183 182
184 Args: 183 Args:
185 filepaths: list of file paths. 184 filepaths: list of file paths.
186 185
187 Returns: 186 Returns:
188 A dict. 187 A dict.
189 """ 188 """
190 filepaths_collection = {} 189 filepaths_collection = {}
191 for filepath in filepaths: 190 for filepath in filepaths:
192 name = os.path.splitext(os.path.split(filepath)[1])[0] 191 name = os.path.splitext(os.path.split(filepath)[1])[0]
193 filepaths_collection[name] = os.path.abspath(filepath) 192 filepaths_collection[name] = os.path.abspath(filepath)
194 return filepaths_collection 193 return filepaths_collection
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698