OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 # Copyright (c) 2017 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 """Export the scores computed by the apm_quality_assessment.py script into an | 10 """Export the scores computed by the apm_quality_assessment.py script into an |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 # Ignore the score if required. | 127 # Ignore the score if required. |
128 if _ExcludeScore(config_name, input_name, noise_name, score_name, args): | 128 if _ExcludeScore(config_name, input_name, noise_name, score_name, args): |
129 logging.info('ignored score: %s %s %s %s', | 129 logging.info('ignored score: %s %s %s %s', |
130 config_name, input_name, noise_name, score_name) | 130 config_name, input_name, noise_name, score_name) |
131 continue | 131 continue |
132 | 132 |
133 # Get metadata. | 133 # Get metadata. |
134 score_path, _ = os.path.split(score_filepath) | 134 score_path, _ = os.path.split(score_filepath) |
135 audio_in_filepath, audio_ref_filepath = ( | 135 audio_in_filepath, audio_ref_filepath = ( |
136 data_access.Metadata.load_audio_in_ref_paths(score_path)) | 136 data_access.Metadata.load_audio_in_ref_paths(score_path)) |
137 audio_out_filepath = os.path.join( | 137 audio_out_filepath = os.path.abspath(os.path.join( |
138 score_path, audioproc_wrapper.AudioProcWrapper.OUTPUT_FILENAME) | 138 score_path, audioproc_wrapper.AudioProcWrapper.OUTPUT_FILENAME)) |
139 | 139 |
140 # Add the score to the nested dictionary. | 140 # Add the score to the nested dictionary. |
141 scores[score_name][config_name][input_name][noise_name][noise_params] = { | 141 scores[score_name][config_name][input_name][noise_name][noise_params] = { |
142 'score': data_access.ScoreFile.load(score_filepath), | 142 'score': data_access.ScoreFile.load(score_filepath), |
143 'audio_in_filepath': audio_in_filepath, | 143 'audio_in_filepath': audio_in_filepath, |
144 'audio_out_filepath': audio_out_filepath, | 144 'audio_out_filepath': audio_out_filepath, |
145 'audio_ref_filepath': audio_ref_filepath, | 145 'audio_ref_filepath': audio_ref_filepath, |
146 } | 146 } |
147 | 147 |
148 # Export. | 148 # Export. |
149 output_filepath = os.path.join(args.output_dir, _GetOutputFilename( | 149 output_filepath = os.path.join(args.output_dir, _GetOutputFilename( |
150 args.filename_suffix)) | 150 args.filename_suffix)) |
151 exporter = export.HtmlExport(output_filepath) | 151 exporter = export.HtmlExport(output_filepath) |
152 exporter.export(scores) | 152 exporter.export(scores) |
153 | 153 |
154 logging.info('output file successfully written in %s', output_filepath) | 154 logging.info('output file successfully written in %s', output_filepath) |
155 sys.exit(0) | 155 sys.exit(0) |
156 | 156 |
157 | 157 |
158 if __name__ == '__main__': | 158 if __name__ == '__main__': |
159 main() | 159 main() |
OLD | NEW |