sonusai 1.0.5__py3-none-any.whl → 1.0.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sonusai/__init__.py CHANGED
@@ -16,9 +16,9 @@ commands_doc = """
16
16
  genmix Generate mixture and truth data
17
17
  genmixdb Generate a mixture database
18
18
  lsdb List information about a mixture database
19
+ metrics_summary Summarize generated metrics in a mixture database
19
20
  mkwav Make WAV files from a mixture database
20
21
  onnx_predict Run ONNX predict on a trained model
21
- summarize_metric_spenh Summarize speech enhancement and analysis results
22
22
  vars List custom SonusAI variables
23
23
  """
24
24
 
@@ -26,19 +26,31 @@ commands_doc = """
26
26
  logger = logging.getLogger("sonusai")
27
27
  logger.setLevel(logging.DEBUG)
28
28
  formatter = logging.Formatter("%(message)s")
29
+ formatter_db = logging.Formatter("%(asctime)s %(message)s")
29
30
  console_handler = RichHandler(show_level=False, show_path=False, show_time=False)
30
31
  console_handler.setLevel(logging.DEBUG)
31
32
  console_handler.setFormatter(formatter)
32
33
  logger.addHandler(console_handler)
33
34
 
35
+ logger_db = logging.getLogger("sonusai_db")
36
+ logger_db.setLevel(logging.DEBUG)
34
37
 
35
38
  # create file handler
36
39
  def create_file_handler(filename: str) -> None:
40
+ from pathlib import Path
41
+
37
42
  fh = logging.FileHandler(filename=filename, mode="w")
38
43
  fh.setLevel(logging.DEBUG)
39
44
  fh.setFormatter(formatter)
40
45
  logger.addHandler(fh)
41
46
 
47
+ filename_db = Path(filename)
48
+ filename_db = filename_db.parent / (filename_db.stem + "_dbtrace" + filename_db.suffix)
49
+ fh = logging.FileHandler(filename=filename_db, mode="w")
50
+ fh.setLevel(logging.DEBUG)
51
+ fh.setFormatter(formatter_db)
52
+ logger_db.addHandler(fh)
53
+
42
54
 
43
55
  # update console handler
44
56
  def update_console_handler(verbose: bool) -> None:
sonusai/genmixdb.py CHANGED
@@ -30,6 +30,7 @@ def genmixdb(
30
30
  logging: bool = True,
31
31
  show_progress: bool = False,
32
32
  test: bool = False,
33
+ verbose: bool = False,
33
34
  save_json: bool = False,
34
35
  no_par: bool = False,
35
36
  ) -> None:
@@ -69,11 +70,11 @@ def genmixdb(
69
70
 
70
71
  mixdb = MixtureDatabase(location, test)
71
72
 
72
- populate_top_table(location, config, test)
73
- populate_class_label_table(location, config, test)
74
- populate_class_weights_threshold_table(location, config, test)
75
- populate_spectral_mask_table(location, config, test)
76
- populate_truth_parameters_table(location, config, test)
73
+ populate_top_table(location, config, test, verbose)
74
+ populate_class_label_table(location, config, test, verbose)
75
+ populate_class_weights_threshold_table(location, config, test, verbose)
76
+ populate_spectral_mask_table(location, config, test, verbose)
77
+ populate_truth_parameters_table(location, config, test, verbose)
77
78
 
78
79
  seed(config["seed"])
79
80
 
@@ -94,7 +95,7 @@ def genmixdb(
94
95
  if logging:
95
96
  logger.info("Populating source file table")
96
97
 
97
- populate_source_file_table(location, source_files, test)
98
+ populate_source_file_table(location, source_files, test, verbose)
98
99
 
99
100
  if logging:
100
101
  logger.info("Sources summary")
@@ -129,7 +130,7 @@ def genmixdb(
129
130
  if logging:
130
131
  logger.info("Populating impulse response file table")
131
132
 
132
- populate_impulse_response_file_table(location, ir_files, test)
133
+ populate_impulse_response_file_table(location, ir_files, test, verbose)
133
134
 
134
135
  if logging:
135
136
  logger.debug("List of impulse responses:")
@@ -219,6 +220,7 @@ def genmixdb(
219
220
  location=location,
220
221
  mixtures=mixtures,
221
222
  test=test,
223
+ verbose=verbose,
222
224
  logging=logging,
223
225
  show_progress=show_progress,
224
226
  )
@@ -330,6 +332,7 @@ def main() -> None:
330
332
  save_mix=save_mix,
331
333
  show_progress=True,
332
334
  save_json=save_json,
335
+ verbose=verbose,
333
336
  no_par=no_par,
334
337
  )
335
338
 
@@ -90,8 +90,8 @@ def _process_mixture(
90
90
  def main() -> None:
91
91
  from docopt import docopt
92
92
 
93
- from . import __version__ as sai_version
94
- from .utils.docstring import trim_docstring
93
+ from sonusai import __version__ as sai_version
94
+ from sonusai.utils import trim_docstring
95
95
 
96
96
  args = docopt(trim_docstring(__doc__), version=sai_version, options_first=True)
97
97
 
@@ -107,14 +107,14 @@ def main() -> None:
107
107
 
108
108
  import psutil
109
109
 
110
- from . import create_file_handler
111
- from . import initial_log_messages
112
- from . import logger
113
- from . import update_console_handler
114
- from .mixture.mixdb import MixtureDatabase
115
- from .utils.create_timestamp import create_timestamp
116
- from .utils.parallel import par_track
117
- from .utils.parallel import track
110
+ from sonusai import create_file_handler
111
+ from sonusai import initial_log_messages
112
+ from sonusai import logger
113
+ from sonusai import update_console_handler
114
+ from sonusai.mixture import MixtureDatabase
115
+ from sonusai.utils import create_timestamp
116
+ from sonusai.utils import par_track
117
+ from sonusai.utils import track
118
118
 
119
119
  mixdb = MixtureDatabase(location)
120
120
  print(f"Found SonusAI mixture database with {mixdb.num_mixtures} mixtures.")
@@ -17,10 +17,10 @@ def config_file(location: str) -> str:
17
17
  return join(location, "config.yml")
18
18
 
19
19
 
20
- def initialize_db(location: str, test: bool = False) -> None:
20
+ def initialize_db(location: str, test: bool = False, verbose: bool = False) -> None:
21
21
  from .mixdb import db_connection
22
22
 
23
- con = db_connection(location=location, create=True, test=test)
23
+ con = db_connection(location=location, create=True, test=test, verbose=verbose)
24
24
 
25
25
  con.execute("""
26
26
  CREATE TABLE truth_config(
@@ -156,14 +156,14 @@ def initialize_db(location: str, test: bool = False) -> None:
156
156
  con.close()
157
157
 
158
158
 
159
- def populate_top_table(location: str, config: dict, test: bool = False) -> None:
159
+ def populate_top_table(location: str, config: dict, test: bool = False, verbose: bool = False) -> None:
160
160
  """Populate top table"""
161
161
  import json
162
162
 
163
163
  from .constants import MIXDB_VERSION
164
164
  from .mixdb import db_connection
165
165
 
166
- con = db_connection(location=location, readonly=False, test=test)
166
+ con = db_connection(location=location, readonly=False, test=test, verbose=verbose)
167
167
  con.execute(
168
168
  """
169
169
  INSERT INTO top (id, asr_configs, class_balancing, feature, mixid_width, num_classes,
@@ -187,11 +187,11 @@ def populate_top_table(location: str, config: dict, test: bool = False) -> None:
187
187
  con.close()
188
188
 
189
189
 
190
- def populate_class_label_table(location: str, config: dict, test: bool = False) -> None:
190
+ def populate_class_label_table(location: str, config: dict, test: bool = False, verbose: bool = False) -> None:
191
191
  """Populate class_label table"""
192
192
  from .mixdb import db_connection
193
193
 
194
- con = db_connection(location=location, readonly=False, test=test)
194
+ con = db_connection(location=location, readonly=False, test=test, verbose=verbose)
195
195
  con.executemany(
196
196
  "INSERT INTO class_label (label) VALUES (?)",
197
197
  [(item,) for item in config["class_labels"]],
@@ -200,7 +200,12 @@ def populate_class_label_table(location: str, config: dict, test: bool = False)
200
200
  con.close()
201
201
 
202
202
 
203
- def populate_class_weights_threshold_table(location: str, config: dict, test: bool = False) -> None:
203
+ def populate_class_weights_threshold_table(
204
+ location: str,
205
+ config: dict,
206
+ test: bool = False,
207
+ verbose: bool = False,
208
+ ) -> None:
204
209
  """Populate class_weights_threshold table"""
205
210
  from .mixdb import db_connection
206
211
 
@@ -216,7 +221,7 @@ def populate_class_weights_threshold_table(location: str, config: dict, test: bo
216
221
  if len(class_weights_threshold) != num_classes:
217
222
  raise ValueError(f"invalid class_weights_threshold length: {len(class_weights_threshold)}")
218
223
 
219
- con = db_connection(location=location, readonly=False, test=test)
224
+ con = db_connection(location=location, readonly=False, test=test, verbose=verbose)
220
225
  con.executemany(
221
226
  "INSERT INTO class_weights_threshold (threshold) VALUES (?)",
222
227
  [(item,) for item in class_weights_threshold],
@@ -225,12 +230,12 @@ def populate_class_weights_threshold_table(location: str, config: dict, test: bo
225
230
  con.close()
226
231
 
227
232
 
228
- def populate_spectral_mask_table(location: str, config: dict, test: bool = False) -> None:
233
+ def populate_spectral_mask_table(location: str, config: dict, test: bool = False, verbose: bool = False) -> None:
229
234
  """Populate spectral_mask table"""
230
235
  from .config import get_spectral_masks
231
236
  from .mixdb import db_connection
232
237
 
233
- con = db_connection(location=location, readonly=False, test=test)
238
+ con = db_connection(location=location, readonly=False, test=test, verbose=verbose)
234
239
  con.executemany(
235
240
  """
236
241
  INSERT INTO spectral_mask (f_max_width, f_num, t_max_percent, t_max_width, t_num) VALUES (?, ?, ?, ?, ?)
@@ -250,12 +255,12 @@ def populate_spectral_mask_table(location: str, config: dict, test: bool = False
250
255
  con.close()
251
256
 
252
257
 
253
- def populate_truth_parameters_table(location: str, config: dict, test: bool = False) -> None:
258
+ def populate_truth_parameters_table(location: str, config: dict, test: bool = False, verbose: bool = False) -> None:
254
259
  """Populate truth_parameters table"""
255
260
  from .config import get_truth_parameters
256
261
  from .mixdb import db_connection
257
262
 
258
- con = db_connection(location=location, readonly=False, test=test)
263
+ con = db_connection(location=location, readonly=False, test=test, verbose=verbose)
259
264
  con.executemany(
260
265
  """
261
266
  INSERT INTO truth_parameters (category, name, parameters) VALUES (?, ?, ?)
@@ -273,17 +278,22 @@ def populate_truth_parameters_table(location: str, config: dict, test: bool = Fa
273
278
  con.close()
274
279
 
275
280
 
276
- def populate_source_file_table(location: str, files: list[SourceFile], test: bool = False) -> None:
281
+ def populate_source_file_table(
282
+ location: str,
283
+ files: list[SourceFile],
284
+ test: bool = False,
285
+ verbose: bool = False,
286
+ ) -> None:
277
287
  """Populate source file table"""
278
288
  import json
279
289
  from pathlib import Path
280
290
 
281
291
  from .mixdb import db_connection
282
292
 
283
- _populate_truth_config_table(location, files, test)
284
- _populate_speaker_table(location, files, test)
293
+ _populate_truth_config_table(location, files, test, verbose)
294
+ _populate_speaker_table(location, files, test, verbose)
285
295
 
286
- con = db_connection(location=location, readonly=False, test=test)
296
+ con = db_connection(location=location, readonly=False, test=test, verbose=verbose)
287
297
 
288
298
  cur = con.cursor()
289
299
  textgrid_metadata_tiers: set[str] = set()
@@ -342,13 +352,18 @@ def populate_source_file_table(location: str, files: list[SourceFile], test: boo
342
352
  con.close()
343
353
 
344
354
 
345
- def populate_impulse_response_file_table(location: str, files: list[ImpulseResponseFile], test: bool = False) -> None:
355
+ def populate_impulse_response_file_table(
356
+ location: str,
357
+ files: list[ImpulseResponseFile],
358
+ test: bool = False,
359
+ verbose: bool = False,
360
+ ) -> None:
346
361
  """Populate impulse response file table"""
347
362
  from .mixdb import db_connection
348
363
 
349
- _populate_impulse_response_tag_table(location, files, test)
364
+ _populate_impulse_response_tag_table(location, files, test, verbose)
350
365
 
351
- con = db_connection(location=location, readonly=False, test=test)
366
+ con = db_connection(location=location, readonly=False, test=test, verbose=verbose)
352
367
 
353
368
  cur = con.cursor()
354
369
  for file in files:
@@ -368,12 +383,12 @@ def populate_impulse_response_file_table(location: str, files: list[ImpulseRespo
368
383
  con.close()
369
384
 
370
385
 
371
- def update_mixid_width(location: str, num_mixtures: int, test: bool = False) -> None:
386
+ def update_mixid_width(location: str, num_mixtures: int, test: bool = False, verbose: bool = False) -> None:
372
387
  """Update the mixid width"""
373
388
  from ..utils.max_text_width import max_text_width
374
389
  from .mixdb import db_connection
375
390
 
376
- con = db_connection(location=location, readonly=False, test=test)
391
+ con = db_connection(location=location, readonly=False, test=test, verbose=verbose)
377
392
  con.execute("UPDATE top SET mixid_width=? WHERE ? = id", (max_text_width(num_mixtures), 1))
378
393
  con.commit()
379
394
  con.close()
@@ -423,6 +438,7 @@ def populate_mixture_table(
423
438
  location: str,
424
439
  mixtures: list[Mixture],
425
440
  test: bool = False,
441
+ verbose: bool = False,
426
442
  logging: bool = False,
427
443
  show_progress: bool = False,
428
444
  ) -> None:
@@ -433,7 +449,7 @@ def populate_mixture_table(
433
449
  from .helpers import from_source
434
450
  from .mixdb import db_connection
435
451
 
436
- con = db_connection(location=location, readonly=False, test=test)
452
+ con = db_connection(location=location, readonly=False, test=test, verbose=verbose)
437
453
 
438
454
  # Populate source table
439
455
  if logging:
@@ -845,7 +861,12 @@ def _get_textgrid_tiers_from_source_file(file: str) -> list[str]:
845
861
  return sorted(tg.tierNames)
846
862
 
847
863
 
848
- def _populate_speaker_table(location: str, source_files: list[SourceFile], test: bool = False) -> None:
864
+ def _populate_speaker_table(
865
+ location: str,
866
+ source_files: list[SourceFile],
867
+ test: bool = False,
868
+ verbose: bool = False,
869
+ ) -> None:
849
870
  """Populate speaker table"""
850
871
  import json
851
872
  from pathlib import Path
@@ -870,7 +891,7 @@ def _populate_speaker_table(location: str, source_files: list[SourceFile], test:
870
891
  new_columns.append(column)
871
892
  new_columns = sorted(set(new_columns))
872
893
 
873
- con = db_connection(location=location, readonly=False, test=test)
894
+ con = db_connection(location=location, readonly=False, test=test, verbose=verbose)
874
895
 
875
896
  for new_column in new_columns:
876
897
  con.execute(f"ALTER TABLE speaker ADD COLUMN {new_column} TEXT")
@@ -902,13 +923,18 @@ def _populate_speaker_table(location: str, source_files: list[SourceFile], test:
902
923
  con.close()
903
924
 
904
925
 
905
- def _populate_truth_config_table(location: str, source_files: list[SourceFile], test: bool = False) -> None:
926
+ def _populate_truth_config_table(
927
+ location: str,
928
+ source_files: list[SourceFile],
929
+ test: bool = False,
930
+ verbose: bool = False,
931
+ ) -> None:
906
932
  """Populate truth_config table"""
907
933
  import json
908
934
 
909
935
  from .mixdb import db_connection
910
936
 
911
- con = db_connection(location=location, readonly=False, test=test)
937
+ con = db_connection(location=location, readonly=False, test=test, verbose=verbose)
912
938
 
913
939
  # Populate truth_config table
914
940
  truth_configs: list[str] = []
@@ -926,11 +952,16 @@ def _populate_truth_config_table(location: str, source_files: list[SourceFile],
926
952
  con.close()
927
953
 
928
954
 
929
- def _populate_impulse_response_tag_table(location: str, files: list[ImpulseResponseFile], test: bool = False) -> None:
955
+ def _populate_impulse_response_tag_table(
956
+ location: str,
957
+ files: list[ImpulseResponseFile],
958
+ test: bool = False,
959
+ verbose: bool = False,
960
+ ) -> None:
930
961
  """Populate ir_tag table"""
931
962
  from .mixdb import db_connection
932
963
 
933
- con = db_connection(location=location, readonly=False, test=test)
964
+ con = db_connection(location=location, readonly=False, test=test, verbose=verbose)
934
965
 
935
966
  con.executemany(
936
967
  "INSERT INTO ir_tag (tag) VALUES (?)",
sonusai/mixture/mixdb.py CHANGED
@@ -58,6 +58,8 @@ def db_connection(
58
58
  from os import remove
59
59
  from os.path import exists
60
60
 
61
+ from .. import logger_db
62
+
61
63
  name = db_file(location, test)
62
64
  if create and exists(name):
63
65
  remove(name)
@@ -71,18 +73,19 @@ def db_connection(
71
73
  connection = sqlite3.connect("file:" + name, uri=True, timeout=20)
72
74
 
73
75
  if verbose:
74
- connection.set_trace_callback(print)
76
+ connection.set_trace_callback(logger_db.debug)
75
77
 
76
78
  return connection
77
79
 
78
80
 
79
81
  class SQLiteContextManager:
80
- def __init__(self, location: str, test: bool = False) -> None:
82
+ def __init__(self, location: str, test: bool = False, verbose: bool = False) -> None:
81
83
  self.location = location
82
84
  self.test = test
85
+ self.verbose = verbose
83
86
 
84
87
  def __enter__(self) -> Cursor:
85
- self.con = db_connection(location=self.location, test=self.test)
88
+ self.con = db_connection(location=self.location, test=self.test, verbose=self.verbose)
86
89
  self.cur = self.con.cursor()
87
90
  return self.cur
88
91
 
@@ -91,7 +94,7 @@ class SQLiteContextManager:
91
94
 
92
95
 
93
96
  class MixtureDatabase:
94
- def __init__(self, location: str, test: bool = False, use_cache: bool = True) -> None:
97
+ def __init__(self, location: str, test: bool = False, verbose: bool = False, use_cache: bool = True) -> None:
95
98
  import json
96
99
  from os.path import exists
97
100
 
@@ -99,12 +102,13 @@ class MixtureDatabase:
99
102
 
100
103
  self.location = location
101
104
  self.test = test
105
+ self.verbose = verbose
102
106
  self.use_cache = use_cache
103
107
 
104
108
  if not exists(db_file(self.location, self.test)):
105
109
  raise OSError(f"Could not find mixture database in {self.location}")
106
110
 
107
- self.db = partial(SQLiteContextManager, self.location, self.test)
111
+ self.db = partial(SQLiteContextManager, self.location, self.test, self.verbose)
108
112
 
109
113
  # Check config.yml to see if asr_configs has changed and update database if needed
110
114
  config = load_config(self.location)
@@ -113,7 +117,7 @@ class MixtureDatabase:
113
117
  old_asr_configs = c.execute("SELECT asr_configs FROM top").fetchone()
114
118
 
115
119
  if old_asr_configs is not None and new_asr_configs != old_asr_configs[0]:
116
- con = db_connection(location=self.location, readonly=False, test=self.test)
120
+ con = db_connection(location=self.location, readonly=False, test=self.test, verbose=self.verbose)
117
121
  con.execute("UPDATE top SET asr_configs = ? WHERE ? = id", (new_asr_configs,))
118
122
  con.commit()
119
123
  con.close()
@@ -2176,7 +2180,7 @@ class MixtureDatabase:
2176
2180
 
2177
2181
  # Check for metrics dependencies and add them even if not explicitly requested.
2178
2182
  if metric.startswith("mxwer"):
2179
- dependencies = ("mxasr." + metric[6:], "tasr." + metric[6:])
2183
+ dependencies = ("mxasr." + metric[6:], "sasr." + metric[6:])
2180
2184
  for dependency in dependencies:
2181
2185
  result[dependency] = calc(dependency)
2182
2186
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: sonusai
3
- Version: 1.0.5
3
+ Version: 1.0.7
4
4
  Summary: Framework for building deep neural network models for sound, speech, and voice AI
5
5
  Home-page: https://aaware.com
6
6
  License: GPL-3.0-only
@@ -1,4 +1,4 @@
1
- sonusai/__init__.py,sha256=7kXYJuI8EPKezlFD7djImNolS1JMyyltgq_vqlDUCek,3261
1
+ sonusai/__init__.py,sha256=XSjulPEFTHCTNAte0z0Ie0e-3w9uVX5j5mR9QfE_r40,3710
2
2
  sonusai/aawscd_probwrite.py,sha256=QZLMQrmPr3OjZ06buyYDwlnk9YPCpyr4KHkBjPsiqjU,3700
3
3
  sonusai/audiofe.py,sha256=0DNpntK0WpzNZeyHX8_wC-pDtrgvLkJZFPXz-PspdrY,19448
4
4
  sonusai/calc_metric_spenh.py,sha256=0Md6hRFUH9lGnsvoydqne99O7Gi0ieG9vMU_1PnASBg,50019
@@ -23,7 +23,7 @@ sonusai/doc.py,sha256=ZgFSSI56oNDb-yC3xi-RHMClMjryR2VrgGyi3ggX8gM,1098
23
23
  sonusai/genft.py,sha256=jGjtjQQEuPunROkoDOYZ7gdyZEa09EMCVhpHrkBZ7A0,5571
24
24
  sonusai/genmetrics.py,sha256=sbcqbjI4YOJd5_Lzor4Re_TK6GUQ5zJuYbhDux8odI0,6184
25
25
  sonusai/genmix.py,sha256=U62GPgejGfnDfRgXUosmnVVWvTV07sg46JQEIew0nPg,5744
26
- sonusai/genmixdb.py,sha256=_YPIwBn_yqbE6Nik0j_-3vT0lO35Jemq_xDsA7zoCi4,11132
26
+ sonusai/genmixdb.py,sha256=9T-qn8_Bekc-P7kOY4pV8w-CHixDvSbZPds7wt_mDYU,11272
27
27
  sonusai/ir_metric.py,sha256=nxS_mARPSZG5Y0G3L8HysOnkPj4v-RGxAxAVBYe-gJI,19600
28
28
  sonusai/lsdb.py,sha256=86t6PpsyardRa6VcSJ-KyU1NiTmlg59VUlcSTptJbn0,5078
29
29
  sonusai/main.py,sha256=72feJv5XEVJE_CQatmNIL1VD9ca-Mo0QNDbXxLrHrbQ,2619
@@ -44,7 +44,7 @@ sonusai/metrics/class_summary.py,sha256=mQbMxQ8EtFIN7S2h7A4Dk0X4XF_CIxKk3W8zZMmp
44
44
  sonusai/metrics/confusion_matrix_summary.py,sha256=lhd8TyHVMC03khX85h_D75XElmawx56KkqpX3X2O2gQ,3133
45
45
  sonusai/metrics/one_hot.py,sha256=aKc-xYd4zWIjbmoQikIcQ6BJB1k-68XKTg8eJCacHTU,13906
46
46
  sonusai/metrics/snr_summary.py,sha256=qKHctpmvGeu2cmjTG7iQPX1lvVUEtEnCIKwUGu6VrEQ,5773
47
- sonusai/metrics_summary.py,sha256=qfQ_NAW4ilgyISRHxSuewTK-u_eo4bkjOjLNX-qd1z4,12197
47
+ sonusai/metrics_summary.py,sha256=pQ5kNwweQM6LdP6TpJE7kV3Z9BYUd96IfEjnZLfSpQI,12211
48
48
  sonusai/mixture/__init__.py,sha256=_vepE2uhAGKHIujPWxfGDeaWHP5yKLf5BjXkU9ZereA,1258
49
49
  sonusai/mixture/audio.py,sha256=JyrVtVPLH3aTXFgyl446f5uVHxlFRa4aBaSPYaMdg80,5814
50
50
  sonusai/mixture/class_balancing.py,sha256=lubicVCzxs4TMh2dZSsuIffkLkk1gmwjmwtrtQ27BVQ,3638
@@ -54,12 +54,12 @@ sonusai/mixture/data_io.py,sha256=DV48sFcP2Qp3NBzvcnlptQOXU3aUEcAeLuh3XOtC5jI,53
54
54
  sonusai/mixture/db_datatypes.py,sha256=VvNtbOgt5WSeSnBoVcNGC5gs_7hX_38pDUPjy5KRbG4,1471
55
55
  sonusai/mixture/effects.py,sha256=ghMO-WiSMQc1CvafD0wkt_DGsM2A6Hi_oZS6j-jeZh8,11784
56
56
  sonusai/mixture/feature.py,sha256=7GJvFhfqeqerfjy9Vq9aKt-cecgYblK0IypNNo5hgwY,2285
57
- sonusai/mixture/generation.py,sha256=rsn2BO95UoXR_tX1IjcwCeYqVPzkohxQSTt5FsMKyhg,32179
57
+ sonusai/mixture/generation.py,sha256=2VQ41uc1OLFpDKwu0TlcdtxSXwiTJFr_B6_E20pheIY,32844
58
58
  sonusai/mixture/helpers.py,sha256=dmyHwf1C5dZjYOd11kVV16KI33CaM-dU_fyaxOrrKt8,11642
59
59
  sonusai/mixture/ir_delay.py,sha256=aiC23HMWQ08-v5wORgMx1_DOJSdh4kunULqiQ-SGuMo,2026
60
60
  sonusai/mixture/ir_effects.py,sha256=PqiqD4PS42-7kD6ESnsZi2a3tnKCFa4E0xqUujRBvGg,2152
61
61
  sonusai/mixture/log_duration_and_sizes.py,sha256=3ekS27IMKlnxIkQAmprzmBnzHOpRjZh3d7maL2VqWQU,927
62
- sonusai/mixture/mixdb.py,sha256=77GjuedI8a2l6MvQCrz2gDBIZNvwduOQ0ERA-4dXK28,86099
62
+ sonusai/mixture/mixdb.py,sha256=zGFagqRIV9uX2QiP795lyN29AarGnZgeKTdUIBcuyfY,86305
63
63
  sonusai/mixture/pad_audio.py,sha256=KNxVQAejA0hblLOnMJgLS6lFaeE0n3tWQ5rclaHBnIY,1015
64
64
  sonusai/mixture/resample.py,sha256=jXqH6FrZ0mlhQ07XqPx88TT9elu3HHVLw7Q0a7Lh5M4,221
65
65
  sonusai/mixture/sox_effects.py,sha256=tndS9qrh3eJOTUPrufyWHCt3UqjbPuh81I4Lo4MNmDg,5328
@@ -88,7 +88,6 @@ sonusai/speech/timit.py,sha256=73T1eOQcA1FfvpCGN8gC4iP56vt4KWcDjLnlkVgdZ9U,4099
88
88
  sonusai/speech/types.py,sha256=4eKVPAktpkIrZ2qoVp2iT45zxTVNocQEGT6O_Zlub_w,214
89
89
  sonusai/speech/vctk.py,sha256=WInvRRRkZCW6t_NcZAJffJzgCbyetal-j2w0kKX5SDw,1527
90
90
  sonusai/speech/voxceleb.py,sha256=Uu1kB1krf8hess1yuvGbYfV_VgYhklEyoz4I7KfrVpw,2658
91
- sonusai/summarize_metric_spenh.py,sha256=Zha0PZGZ_NznPeHh8rjVIaWR7ac4MEIlijci1uikiT0,1870
92
91
  sonusai/utils/__init__.py,sha256=4XB-62-4Dg_XgZ6Ip2fEOBJ0_oQff6jndYl2rlzl6XE,2699
93
92
  sonusai/utils/asl_p56.py,sha256=zH82RI7h399ZYFOOiOC35iv_qi0KhXpmG5uItWB8n78,3854
94
93
  sonusai/utils/asr.py,sha256=w5xSBpA2wibzsiCWzdSm1m3LwNd54dcJMMLBWN33FJs,2818
@@ -132,7 +131,7 @@ sonusai/utils/tokenized_shell_vars.py,sha256=EDrrAgz5lJ0RBAjLcTJt1MeyjhbNZiqXkym
132
131
  sonusai/utils/write_audio.py,sha256=IHzrJoFtFcea_J6wo6QSiojRkgnNOzAEcg-z0rFV7nU,810
133
132
  sonusai/utils/yes_or_no.py,sha256=0h1okjXmDNbJp7rZJFR2V-HFU1GJDm3YFTUVmYExkOU,263
134
133
  sonusai/vars.py,sha256=m8pdgfR4A6A9TCGf_rok6jPAT5BgrEsYXTSISIh1nrI,1163
135
- sonusai-1.0.5.dist-info/METADATA,sha256=Q1nZTGYPe4eF4Zs8HEQWp5dKsINA8_CmHUQxfT57uJM,2652
136
- sonusai-1.0.5.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
137
- sonusai-1.0.5.dist-info/entry_points.txt,sha256=zMNjEphEPO6B3cD1GNpit7z-yA9tUU5-j3W2v-UWstU,92
138
- sonusai-1.0.5.dist-info/RECORD,,
134
+ sonusai-1.0.7.dist-info/METADATA,sha256=eyPTvxuqs2NwuNq2Rp5JsQOeCCZxol44M6EIWlxW3Ng,2652
135
+ sonusai-1.0.7.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
136
+ sonusai-1.0.7.dist-info/entry_points.txt,sha256=zMNjEphEPO6B3cD1GNpit7z-yA9tUU5-j3W2v-UWstU,92
137
+ sonusai-1.0.7.dist-info/RECORD,,
@@ -1,65 +0,0 @@
1
- """sonusai summarize_metric_spenh
2
-
3
- usage: summarize_metric_spenh [-hr] [-s SORT] LOC
4
-
5
- options:
6
- -h, --help
7
- -s SORT, --sort SORT Sort by SORT column. [default: MIXID]
8
- -r, --reverse Reverse sort order.
9
-
10
- Summarize speech enhancement metrics results using data generated by SonusAI calc_metric_spenh.
11
-
12
- Inputs:
13
- LOC A SonusAI calc_metric_spenh results directory.
14
-
15
- """
16
-
17
-
18
- def summarize_metric_spenh(location: str, by: str = "MIXID", reverse: bool = False) -> str:
19
- import glob
20
-
21
- import pandas as pd
22
-
23
- files = sorted(glob.glob(location + "/*_metric_spenh.txt"))
24
- need_header = True
25
- header = ["MIXID"]
26
- data = []
27
- for file in files:
28
- with open(file) as f:
29
- for i, line in enumerate(f):
30
- if i == 1 and need_header:
31
- need_header = False
32
- header.extend(line.strip().split())
33
- elif i == 2:
34
- data.append(line.strip().split())
35
- break
36
-
37
- df = pd.DataFrame(data, columns=header) # pyright: ignore [reportArgumentType]
38
- df[header[0:-2]] = df[header[0:-2]].apply(pd.to_numeric, errors="coerce")
39
- return df.sort_values(by=by, ascending=not reverse).to_string(index=False)
40
-
41
-
42
- def main():
43
- from docopt import docopt
44
-
45
- from sonusai import __version__ as sai_version
46
- from sonusai.utils import trim_docstring
47
-
48
- args = docopt(trim_docstring(__doc__), version=sai_version, options_first=True)
49
-
50
- by = args["--sort"]
51
- reverse = args["--reverse"]
52
- location = args["LOC"]
53
-
54
- print(summarize_metric_spenh(location, by, reverse))
55
-
56
-
57
- if __name__ == "__main__":
58
- from sonusai import exception_handler
59
- from sonusai.utils import register_keyboard_interrupt
60
-
61
- register_keyboard_interrupt()
62
- try:
63
- main()
64
- except Exception as e:
65
- exception_handler(e)