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

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

Issue 2811953002: APM QA unit tests, fake POLQA binary and minor fixes (Closed)
Patch Set: comments addressed 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 """
11 11
12 import logging 12 import logging
13 import os 13 import os
14 14
15 from . import audioproc_wrapper
16 from . import data_access 15 from . import data_access
17 from . import eval_scores 16 from . import eval_scores
18 from . import eval_scores_factory 17 from . import eval_scores_factory
19 from . import evaluation
20 from . import test_data_generation 18 from . import test_data_generation
21 from . import test_data_generation_factory 19 from . import test_data_generation_factory
22 20
23 21
24 class ApmModuleSimulator(object): 22 class ApmModuleSimulator(object):
25 """APM module simulator class. 23 """APM module simulator class.
26 """ 24 """
27 25
28 _TEST_DATA_GENERATOR_CLASSES = ( 26 _TEST_DATA_GENERATOR_CLASSES = (
29 test_data_generation.TestDataGenerator.REGISTERED_CLASSES) 27 test_data_generation.TestDataGenerator.REGISTERED_CLASSES)
30 _EVAL_SCORE_WORKER_CLASSES = eval_scores.EvaluationScore.REGISTERED_CLASSES 28 _EVAL_SCORE_WORKER_CLASSES = eval_scores.EvaluationScore.REGISTERED_CLASSES
31 29
32 def __init__(self, aechen_ir_database_path, polqa_tool_path): 30 def __init__(self, aechen_ir_database_path, polqa_tool_bin_path,
31 ap_wrapper, evaluator):
33 # Init. 32 # Init.
34 self._audioproc_wrapper = audioproc_wrapper.AudioProcWrapper() 33 self._audioproc_wrapper = ap_wrapper
35 self._evaluator = evaluation.ApmModuleEvaluator() 34 self._evaluator = evaluator
36 35
37 # Instance factory objects. 36 # Instance factory objects.
38 self._test_data_generator_factory = ( 37 self._test_data_generator_factory = (
39 test_data_generation_factory.TestDataGeneratorFactory( 38 test_data_generation_factory.TestDataGeneratorFactory(
40 aechen_ir_database_path=aechen_ir_database_path)) 39 aechen_ir_database_path=aechen_ir_database_path))
41 self._evaluation_score_factory = ( 40 self._evaluation_score_factory = (
42 eval_scores_factory.EvaluationScoreWorkerFactory( 41 eval_scores_factory.EvaluationScoreWorkerFactory(
43 polqa_tool_path=polqa_tool_path)) 42 polqa_tool_bin_path=polqa_tool_bin_path))
44 43
45 # Properties for each run. 44 # Properties for each run.
46 self._base_output_path = None 45 self._base_output_path = None
47 self._test_data_generators = None 46 self._test_data_generators = None
48 self._evaluation_score_workers = None 47 self._evaluation_score_workers = None
49 self._config_filepaths = None 48 self._config_filepaths = None
50 self._input_filepaths = None 49 self._input_filepaths = None
51 50
52 def Run(self, config_filepaths, input_filepaths, test_data_generator_names, 51 def Run(self, config_filepaths, input_filepaths, test_data_generator_names,
53 eval_score_names, output_dir): 52 eval_score_names, output_dir):
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 filepaths: list of file paths. 185 filepaths: list of file paths.
187 186
188 Returns: 187 Returns:
189 A dict. 188 A dict.
190 """ 189 """
191 filepaths_collection = {} 190 filepaths_collection = {}
192 for filepath in filepaths: 191 for filepath in filepaths:
193 name = os.path.splitext(os.path.split(filepath)[1])[0] 192 name = os.path.splitext(os.path.split(filepath)[1])[0]
194 filepaths_collection[name] = os.path.abspath(filepath) 193 filepaths_collection[name] = os.path.abspath(filepath)
195 return filepaths_collection 194 return filepaths_collection
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698