sonusai 0.18.9__py3-none-any.whl → 0.19.5__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.
Files changed (118) hide show
  1. sonusai/__init__.py +20 -29
  2. sonusai/aawscd_probwrite.py +18 -18
  3. sonusai/audiofe.py +93 -80
  4. sonusai/calc_metric_spenh.py +395 -321
  5. sonusai/data/genmixdb.yml +5 -11
  6. sonusai/{gentcst.py → deprecated/gentcst.py} +146 -149
  7. sonusai/{plot.py → deprecated/plot.py} +177 -131
  8. sonusai/{tplot.py → deprecated/tplot.py} +124 -102
  9. sonusai/doc/__init__.py +1 -1
  10. sonusai/doc/doc.py +112 -177
  11. sonusai/doc.py +10 -10
  12. sonusai/genft.py +93 -77
  13. sonusai/genmetrics.py +59 -46
  14. sonusai/genmix.py +116 -104
  15. sonusai/genmixdb.py +194 -153
  16. sonusai/lsdb.py +56 -66
  17. sonusai/main.py +23 -20
  18. sonusai/metrics/__init__.py +2 -0
  19. sonusai/metrics/calc_audio_stats.py +29 -24
  20. sonusai/metrics/calc_class_weights.py +7 -7
  21. sonusai/metrics/calc_optimal_thresholds.py +5 -7
  22. sonusai/metrics/calc_pcm.py +3 -3
  23. sonusai/metrics/calc_pesq.py +10 -7
  24. sonusai/metrics/calc_phase_distance.py +3 -3
  25. sonusai/metrics/calc_sa_sdr.py +10 -8
  26. sonusai/metrics/calc_segsnr_f.py +15 -17
  27. sonusai/metrics/calc_speech.py +105 -47
  28. sonusai/metrics/calc_wer.py +35 -32
  29. sonusai/metrics/calc_wsdr.py +10 -7
  30. sonusai/metrics/class_summary.py +30 -27
  31. sonusai/metrics/confusion_matrix_summary.py +25 -22
  32. sonusai/metrics/one_hot.py +91 -57
  33. sonusai/metrics/snr_summary.py +53 -46
  34. sonusai/mixture/__init__.py +19 -14
  35. sonusai/mixture/audio.py +4 -6
  36. sonusai/mixture/augmentation.py +37 -43
  37. sonusai/mixture/class_count.py +5 -14
  38. sonusai/mixture/config.py +292 -225
  39. sonusai/mixture/constants.py +41 -30
  40. sonusai/mixture/data_io.py +155 -0
  41. sonusai/mixture/datatypes.py +111 -108
  42. sonusai/mixture/db_datatypes.py +54 -70
  43. sonusai/mixture/eq_rule_is_valid.py +6 -9
  44. sonusai/mixture/feature.py +40 -38
  45. sonusai/mixture/generation.py +522 -389
  46. sonusai/mixture/helpers.py +217 -272
  47. sonusai/mixture/log_duration_and_sizes.py +16 -13
  48. sonusai/mixture/mixdb.py +669 -477
  49. sonusai/mixture/soundfile_audio.py +12 -17
  50. sonusai/mixture/sox_audio.py +91 -112
  51. sonusai/mixture/sox_augmentation.py +8 -9
  52. sonusai/mixture/spectral_mask.py +4 -6
  53. sonusai/mixture/target_class_balancing.py +41 -36
  54. sonusai/mixture/targets.py +69 -67
  55. sonusai/mixture/tokenized_shell_vars.py +23 -23
  56. sonusai/mixture/torchaudio_audio.py +14 -15
  57. sonusai/mixture/torchaudio_augmentation.py +23 -27
  58. sonusai/mixture/truth.py +48 -26
  59. sonusai/mixture/truth_functions/__init__.py +26 -0
  60. sonusai/mixture/truth_functions/crm.py +56 -38
  61. sonusai/mixture/truth_functions/datatypes.py +37 -0
  62. sonusai/mixture/truth_functions/energy.py +85 -59
  63. sonusai/mixture/truth_functions/file.py +30 -30
  64. sonusai/mixture/truth_functions/phoneme.py +14 -7
  65. sonusai/mixture/truth_functions/sed.py +71 -45
  66. sonusai/mixture/truth_functions/target.py +69 -106
  67. sonusai/mkwav.py +52 -85
  68. sonusai/onnx_predict.py +46 -43
  69. sonusai/queries/__init__.py +3 -1
  70. sonusai/queries/queries.py +100 -59
  71. sonusai/speech/__init__.py +2 -0
  72. sonusai/speech/l2arctic.py +24 -23
  73. sonusai/speech/librispeech.py +16 -17
  74. sonusai/speech/mcgill.py +22 -21
  75. sonusai/speech/textgrid.py +32 -25
  76. sonusai/speech/timit.py +45 -42
  77. sonusai/speech/vctk.py +14 -13
  78. sonusai/speech/voxceleb.py +26 -20
  79. sonusai/summarize_metric_spenh.py +11 -10
  80. sonusai/utils/__init__.py +4 -3
  81. sonusai/utils/asl_p56.py +1 -1
  82. sonusai/utils/asr.py +37 -17
  83. sonusai/utils/asr_functions/__init__.py +2 -0
  84. sonusai/utils/asr_functions/aaware_whisper.py +18 -12
  85. sonusai/utils/audio_devices.py +12 -12
  86. sonusai/utils/braced_glob.py +6 -8
  87. sonusai/utils/calculate_input_shape.py +1 -4
  88. sonusai/utils/compress.py +2 -2
  89. sonusai/utils/convert_string_to_number.py +1 -3
  90. sonusai/utils/create_timestamp.py +1 -1
  91. sonusai/utils/create_ts_name.py +2 -2
  92. sonusai/utils/dataclass_from_dict.py +1 -1
  93. sonusai/utils/docstring.py +6 -6
  94. sonusai/utils/energy_f.py +9 -7
  95. sonusai/utils/engineering_number.py +56 -54
  96. sonusai/utils/get_label_names.py +8 -10
  97. sonusai/utils/human_readable_size.py +2 -2
  98. sonusai/utils/model_utils.py +3 -5
  99. sonusai/utils/numeric_conversion.py +2 -4
  100. sonusai/utils/onnx_utils.py +43 -32
  101. sonusai/utils/parallel.py +40 -27
  102. sonusai/utils/print_mixture_details.py +25 -22
  103. sonusai/utils/ranges.py +12 -12
  104. sonusai/utils/read_predict_data.py +11 -9
  105. sonusai/utils/reshape.py +19 -26
  106. sonusai/utils/seconds_to_hms.py +1 -1
  107. sonusai/utils/stacked_complex.py +8 -16
  108. sonusai/utils/stratified_shuffle_split.py +29 -27
  109. sonusai/utils/write_audio.py +2 -2
  110. sonusai/utils/yes_or_no.py +3 -3
  111. sonusai/vars.py +14 -14
  112. {sonusai-0.18.9.dist-info → sonusai-0.19.5.dist-info}/METADATA +20 -21
  113. sonusai-0.19.5.dist-info/RECORD +125 -0
  114. {sonusai-0.18.9.dist-info → sonusai-0.19.5.dist-info}/WHEEL +1 -1
  115. sonusai/mixture/truth_functions/data.py +0 -58
  116. sonusai/utils/read_mixture_data.py +0 -14
  117. sonusai-0.18.9.dist-info/RECORD +0 -125
  118. {sonusai-0.18.9.dist-info → sonusai-0.19.5.dist-info}/entry_points.txt +0 -0
@@ -41,6 +41,7 @@ options:
41
41
  A multi-page plot TARGET-tplot.pdf or CONFIG-tplot.pdf is generated.
42
42
 
43
43
  """
44
+
44
45
  import signal
45
46
 
46
47
 
@@ -49,7 +50,7 @@ def signal_handler(_sig, _frame):
49
50
 
50
51
  from sonusai import logger
51
52
 
52
- logger.info('Canceled due to keyboard interrupt')
53
+ logger.info("Canceled due to keyboard interrupt")
53
54
  sys.exit(1)
54
55
 
55
56
 
@@ -57,13 +58,15 @@ signal.signal(signal.SIGINT, signal_handler)
57
58
 
58
59
 
59
60
  # TODO: re-work for modern mixdb API
60
- def tplot(root: str = None,
61
- config_file: str = None,
62
- target_file: str = None,
63
- model_file: str = None,
64
- feature: str = None,
65
- thresholds: str = None,
66
- verbose: bool = False) -> None:
61
+ def tplot(
62
+ root: str | None = None,
63
+ config_file: str | None = None,
64
+ target_file: str | None = None,
65
+ model_file: str | None = None,
66
+ feature: str | None = None,
67
+ thresholds: str | None = None,
68
+ verbose: bool = False,
69
+ ) -> None:
67
70
  import json
68
71
  import os
69
72
 
@@ -86,68 +89,71 @@ def tplot(root: str = None,
86
89
  figsize = (11, 8.5)
87
90
 
88
91
  if config_file is None and target_file is None and root is None:
89
- raise SonusAIError('Error: No config provided.')
92
+ raise SonusAIError("Error: No config provided.")
90
93
 
91
- target_path = ''
94
+ target_path = ""
92
95
  config = get_default_config()
93
96
 
94
97
  if root is not None:
95
98
  leaf = os.getcwd()
96
99
  target_path = os.path.basename(leaf)
97
100
  config = update_config_from_hierarchy(root=root, leaf=leaf, config=config)
98
- logger.debug(f'Hierarchical config for {leaf} using {root} as the root')
101
+ logger.debug(f"Hierarchical config for {leaf} using {root} as the root")
99
102
 
100
103
  if config_file is not None:
101
104
  target_path = config_file
102
105
  config = update_config_from_file(config_file, config)
103
- logger.debug(f'Config from {config_file}')
106
+ logger.debug(f"Config from {config_file}")
104
107
 
105
108
  if target_file is not None:
106
109
  target_path = target_file
107
110
  if not os.path.exists(target_file):
108
- raise SonusAIError(f'{target_file} does not exist.')
111
+ raise SonusAIError(f"{target_file} does not exist.")
109
112
 
110
- config['targets'] = [{'name': target_file}]
111
- logger.debug(f'Targets from {target_file}')
113
+ config["targets"] = [{"name": target_file}]
114
+ logger.debug(f"Targets from {target_file}")
112
115
 
113
116
  if config_file is None:
114
- target_config = f'{os.path.splitext(target_file)[0]}.yml'
117
+ target_config = f"{os.path.splitext(target_file)[0]}.yml"
115
118
  if os.path.exists(target_config):
116
119
  config = update_config_from_file(target_config, config)
117
- logger.debug(f'Config from {target_config}')
120
+ logger.debug(f"Config from {target_config}")
118
121
  else:
119
- target_config = 'config.yml'
122
+ target_config = "config.yml"
120
123
  if os.path.exists(target_config):
121
124
  config = update_config_from_file(target_config, config)
122
- logger.debug(f'Config from {target_config}')
125
+ logger.debug(f"Config from {target_config}")
123
126
  elif root is None:
124
- raise SonusAIError(f'Error: Could not determine config for {target_file}.')
127
+ raise SonusAIError(f"Error: Could not determine config for {target_file}.")
125
128
 
126
129
  file_base = os.path.splitext(target_path)[0]
127
130
  file_name = os.path.split(file_base)[1]
128
- output = f'./{file_name}-tplot.pdf'
131
+ output = f"./{file_name}-tplot.pdf"
129
132
 
130
- if len(config['truth_settings']) > 1:
131
- raise SonusAIError(f'Number of truth_settings is more than one. This is not supported yet.')
133
+ if len(config["truth_settings"]) > 1:
134
+ raise SonusAIError("Number of truth_settings is more than one. This is not supported yet.")
132
135
 
133
136
  if thresholds is not None:
134
137
  thresholds = json.loads(thresholds)
135
- if thresholds != config['truth_settings'][0]['config']['thresholds']:
136
- config['truth_settings'][0]['config']['thresholds'] = thresholds
137
- logger.debug(f'Override SED thresholds with {thresholds}')
138
+ if thresholds != config["truth_settings"][0]["config"]["thresholds"]:
139
+ config["truth_settings"][0]["config"]["thresholds"] = thresholds
140
+ logger.debug(f"Override SED thresholds with {thresholds}")
138
141
 
139
- if feature is not None:
140
- if feature != config['feature']:
141
- config['feature'] = feature
142
- logger.debug(f'Override feature with {feature}')
142
+ if feature is not None and feature != config["feature"]:
143
+ config["feature"] = feature
144
+ logger.debug(f"Override feature with {feature}")
143
145
 
144
- logger.debug('')
146
+ logger.debug("")
145
147
 
146
148
  # Run genmixdb, genmix, and genft
147
- mixdb = genmixdb(config=config, logging=verbose) # type: ignore
149
+ mixdb = genmixdb(config=config, logging=verbose)
148
150
  num_mixtures = mixdb.num_mixtures # Number of mixtures
149
- logger.info(f'Generating data for {num_mixtures} mixture plots')
150
- audio_data = genmix(mixdb=mixdb, compute_segsnr=False, compute_truth=False, )
151
+ logger.info(f"Generating data for {num_mixtures} mixture plots")
152
+ audio_data = genmix(
153
+ mixdb=mixdb,
154
+ compute_segsnr=False,
155
+ compute_truth=False,
156
+ )
151
157
  feature_data = genft(mixdb=mixdb, compute_segsnr=False)
152
158
 
153
159
  # If model provided, read and check it
@@ -158,62 +164,64 @@ def tplot(root: str = None,
158
164
  # model is an in-memory ModelProto
159
165
  model = onnx.load(model_file)
160
166
  if len(model.metadata_props) < 5:
161
- logger.warn('Model metadata indicates this is not an Aaware model, ignoring.')
167
+ logger.warn("Model metadata indicates this is not an Aaware model, ignoring.")
162
168
  else:
163
- if model.metadata_props[4].key != 'feature':
164
- logger.warn('Model metadata does not have Aaware feature, ignoring.')
169
+ if model.metadata_props[4].key != "feature":
170
+ logger.warn("Model metadata does not have Aaware feature, ignoring.")
165
171
  else:
166
172
  model_feature = model.metadata_props[4].value
167
- logger.debug(f'Model feature is {model_feature}')
173
+ logger.debug(f"Model feature is {model_feature}")
168
174
  # TODO Check and read other params, flatten, addch, etc.
169
- logger.info(f'Running prediction with {model_file}')
175
+ logger.info(f"Running prediction with {model_file}")
170
176
  predict = Predict(model_file)
171
177
  predict_data = predict.execute(feature_data.feature)
172
178
 
173
179
  num_samples = audio_data.mixture.shape[0] # Total number of samples over all mixtures
174
180
  num_features = feature_data.feature.shape[0] # Total number of feature frames over all mixtures
175
181
 
176
- logger.info(f'Plotting {num_mixtures} target-truth results to {output}')
177
- pdf = PdfPages(f'{output}')
182
+ logger.info(f"Plotting {num_mixtures} target-truth results to {output}")
183
+ pdf = PdfPages(f"{output}")
178
184
  for m in range(num_mixtures):
179
- mixture_begin = mixdb['mixtures'][m]['i_sample_offset']
180
- feature_begin = mixdb['mixtures'][m]['o_frame_offset']
185
+ mixture_begin = mixdb["mixtures"][m]["i_sample_offset"]
186
+ feature_begin = mixdb["mixtures"][m]["o_frame_offset"]
181
187
  # For each target/mixture, get index endpoint (mix,noise,target sample,...)
182
188
  if m == num_mixtures - 1:
183
189
  mixture_end = num_samples
184
190
  feature_end = num_features
185
191
  else:
186
- mixture_end = mixdb['mixtures'][m + 1]['i_sample_offset']
192
+ mixture_end = mixdb["mixtures"][m + 1]["i_sample_offset"]
187
193
  # out frames are possibly decimated/stride-combined
188
- feature_end = mixdb['mixtures'][m + 1]['o_frame_offset']
194
+ feature_end = mixdb["mixtures"][m + 1]["o_frame_offset"]
189
195
 
190
196
  # Trim waveform data
191
197
  mixture_trimmed = audio_data.mixture[mixture_begin:mixture_end]
192
198
  target_trimmed = sum(audio_data.targets)[mixture_begin:mixture_end]
193
199
 
194
200
  # Provide subset defined by mixture using truth_index array of indices (multichannel truth)
195
- target_record = mixdb['targets'][mixdb['mixtures'][m]['target_id']]
196
- truth_settings = target_record['truth_settings']
201
+ target_record = mixdb["targets"][mixdb["mixtures"][m]["target_id"]]
202
+ truth_settings = target_record["truth_settings"]
197
203
  if len(truth_settings) > 1:
198
- raise SonusAIError(f'Number of truth_settings is more than one. This is not supported yet.')
204
+ raise SonusAIError("Number of truth_settings is more than one. This is not supported yet.")
199
205
 
200
- truth_index = np.array(truth_settings[0]['index']) - 1
206
+ truth_index = np.array(truth_settings[0]["index"]) - 1
201
207
  truth_f_trimmed = feature_data.truth_f[feature_begin:feature_end, truth_index]
202
208
 
203
209
  if predict_data.shape[0] > 0:
204
210
  predict_data_trimmed = predict_data[feature_begin:feature_end, :]
205
211
  # Prediction Activity analysis to select top prediction class
206
212
  # true if active in any frame
207
- predict_activity = np.any(predict_data_trimmed >= mixdb['class_weights_threshold'], axis=0)
213
+ predict_activity = np.any(predict_data_trimmed >= mixdb["class_weights_threshold"], axis=0)
208
214
  predict_activity_index = np.array([i for i, x in enumerate(predict_activity) if x]) + 1
209
- logger.info(f'Prediction active in classes based on threshold {mixdb["class_weights_threshold"]}:\n'
210
- f'{predict_activity_index}')
215
+ logger.info(
216
+ f'Prediction active in classes based on threshold {mixdb["class_weights_threshold"]}:\n'
217
+ f'{predict_activity_index}'
218
+ )
211
219
  predict_mean = np.mean(predict_data_trimmed, axis=0)
212
220
  top_active_classes = np.argsort(predict_mean)[::-1] + 1
213
- logger.info(f'Top 10 active prediction classes by mean:\n{top_active_classes[0:10]}')
221
+ logger.info(f"Top 10 active prediction classes by mean:\n{top_active_classes[0:10]}")
214
222
  # plot most active prediction
215
223
  predict_data_trimmed = predict_data_trimmed[:, top_active_classes[0] - 1]
216
- logger.info(f'Plotting prediction class {top_active_classes[0]}')
224
+ logger.info(f"Plotting prediction class {top_active_classes[0]}")
217
225
 
218
226
  # Setup plot of target waveform with truth on top
219
227
  # TODO
@@ -227,8 +235,10 @@ def tplot(root: str = None,
227
235
  x_seconds = np.arange(num_plot_samples, dtype=np.float32) / sonusai.mixture.SAMPLE_RATE
228
236
  # Reshape/extend truth to #samples in waveform
229
237
  num_plot_classes = truth_f_trimmed.shape[1] # Number of plot truth classes
230
- y_truth_f = np.reshape(np.tile(np.expand_dims(truth_f_trimmed, 1), [1, num_plot_samples_per_feature, 1]),
231
- [num_plot_samples, num_plot_classes])
238
+ y_truth_f = np.reshape(
239
+ np.tile(np.expand_dims(truth_f_trimmed, 1), [1, num_plot_samples_per_feature, 1]),
240
+ [num_plot_samples, num_plot_classes],
241
+ )
232
242
 
233
243
  fig, ax0 = plt.subplots(1, 1, constrained_layout=True, figsize=figsize)
234
244
  ax = np.array([ax0], dtype=object)
@@ -236,16 +246,16 @@ def tplot(root: str = None,
236
246
 
237
247
  # Plot the time-domain waveforms then truth/prediction on second axis
238
248
  if mixture_trimmed.shape[0] > 0:
239
- color = 'mistyrose'
240
- mix_plot, = ax[0].plot(x_seconds, mixture_trimmed[0:num_plot_samples], color=color, label='MIX')
241
- ax[0].tick_params(axis='y', labelcolor='red')
249
+ color = "mistyrose"
250
+ (mix_plot,) = ax[0].plot(x_seconds, mixture_trimmed[0:num_plot_samples], color=color, label="MIX")
251
+ ax[0].tick_params(axis="y", labelcolor="red")
242
252
  plots.append(mix_plot)
243
253
 
244
254
  if target_trimmed.shape[0] > 0:
245
- color = 'tab:blue'
246
- tt_plot, = ax[0].plot(x_seconds, target_trimmed[0:num_plot_samples], color=color, label='TAR')
247
- ax[0].set_ylabel('ampl', color=color)
248
- ax[0].tick_params(axis='y', labelcolor=color)
255
+ color = "tab:blue"
256
+ (tt_plot,) = ax[0].plot(x_seconds, target_trimmed[0:num_plot_samples], color=color, label="TAR")
257
+ ax[0].set_ylabel("ampl", color=color)
258
+ ax[0].tick_params(axis="y", labelcolor=color)
249
259
  plots.append(tt_plot)
250
260
 
251
261
  ax2 = ax[0].twinx() # instantiate 2nd y-axis that shares the same x-axis
@@ -253,40 +263,45 @@ def tplot(root: str = None,
253
263
  # Plot first truth
254
264
  # TODO Support multi-channel
255
265
  if truth_f_trimmed.shape[0] > 0:
256
- color = 'tab:green'
257
- label2 = f'truth{truth_index[0] + 1}'
266
+ color = "tab:green"
267
+ label2 = f"truth{truth_index[0] + 1}"
258
268
  # we already handled the x-label with ax1
259
269
  ax2.set_ylabel(label2, color=color)
260
270
  # logger.info(f'Mixture num {m}, truth_index={truth_index}')
261
- tr_plot, = ax2.plot(x_seconds, y_truth_f[:, 0], color=color, label=label2)
271
+ (tr_plot,) = ax2.plot(x_seconds, y_truth_f[:, 0], color=color, label=label2)
262
272
  ax2.set_ylim([-0.05, 1.05])
263
- ax2.tick_params(axis='y', labelcolor=color)
273
+ ax2.tick_params(axis="y", labelcolor=color)
264
274
  plots.append(tr_plot)
265
275
 
266
276
  if predict_data.shape[0] > 0:
267
- color = 'tab:brown'
268
- label2 = f'prcl{top_active_classes[0]}'
277
+ color = "tab:brown"
278
+ label2 = f"prcl{top_active_classes[0]}"
269
279
  # we already handled the x-label with ax1
270
280
  ax2.set_ylabel(label2, color=color)
271
281
  predict_extended = np.reshape(
272
- np.tile(np.expand_dims(predict_data_trimmed, 1), [1, num_plot_samples_per_feature, 1]),
273
- [num_plot_samples, num_plot_classes])
274
- pr_plot, = ax2.plot(x_seconds, predict_extended, color=color, label=label2)
282
+ np.tile(
283
+ np.expand_dims(predict_data_trimmed, 1),
284
+ [1, num_plot_samples_per_feature, 1],
285
+ ),
286
+ [num_plot_samples, num_plot_classes],
287
+ )
288
+ (pr_plot,) = ax2.plot(x_seconds, predict_extended, color=color, label=label2)
275
289
  ax2.set_ylim([-0.05, 1.05])
276
- ax2.tick_params(axis='y', labelcolor=color)
290
+ ax2.tick_params(axis="y", labelcolor=color)
277
291
  plots.append(pr_plot)
278
292
 
279
- ax[0].set_xlabel('time (s)') # set only on last/bottom plot
293
+ ax[0].set_xlabel("time (s)") # set only on last/bottom plot
280
294
 
281
295
  # Get actual mixture target config parameters
282
- target_augmentations = mixdb['target_augmentations'][mixdb['mixtures'][m]['target_augmentation_index']]
296
+ target_augmentations = mixdb["target_augmentations"][mixdb["mixtures"][m]["target_augmentation_index"]]
283
297
  fig.suptitle(
284
298
  f'{m + 1} of {num_mixtures}: {target_path}\n'
285
299
  f'{target_record["name"]}\n'
286
300
  f'Target augmentations: {target_augmentations}\n'
287
301
  f'Truth indices: {truth_settings[0]["index"]}\n'
288
302
  f'Global Truth Function:Config {truth_settings[0]["function"]} : {truth_settings[0]["config"]}',
289
- fontsize=10)
303
+ fontsize=10,
304
+ )
290
305
  pdf.savefig(fig)
291
306
  plt.close(fig)
292
307
 
@@ -294,21 +309,26 @@ def tplot(root: str = None,
294
309
  last_page = plt.figure(figsize=figsize)
295
310
  last_page.clf()
296
311
 
297
- option_text = \
298
- f'Function parameters:\n' \
299
- f' root {root}\n' \
300
- f' config {config_file}\n' \
301
- f' target {target_file}\n' \
302
- f' model {model_file}\n' \
303
- f' feature {feature}\n' \
304
- f' sedthr {thresholds}\n\n' \
305
- f'----------------------------------------\n\n'
306
- last_page.text(0.05, 0.95, option_text + yaml.dump(config),
307
- transform=last_page.transFigure,
308
- family='monospace',
309
- size=10,
310
- ha="left",
311
- va="top")
312
+ option_text = (
313
+ f"Function parameters:\n"
314
+ f" root {root}\n"
315
+ f" config {config_file}\n"
316
+ f" target {target_file}\n"
317
+ f" model {model_file}\n"
318
+ f" feature {feature}\n"
319
+ f" sedthr {thresholds}\n\n"
320
+ f"----------------------------------------\n\n"
321
+ )
322
+ last_page.text(
323
+ 0.05,
324
+ 0.95,
325
+ option_text + yaml.dump(config),
326
+ transform=last_page.transFigure,
327
+ family="monospace",
328
+ size=10,
329
+ ha="left",
330
+ va="top",
331
+ )
312
332
  pdf.savefig()
313
333
  plt.close()
314
334
  pdf.close()
@@ -325,19 +345,21 @@ def main() -> None:
325
345
 
326
346
  args = docopt(trim_docstring(__doc__), version=sonusai.__version__, options_first=True)
327
347
 
328
- verbose = args['--verbose']
329
- create_file_handler('tplot.log')
348
+ verbose = args["--verbose"]
349
+ create_file_handler("tplot.log")
330
350
  update_console_handler(verbose)
331
- initial_log_messages('tplot')
351
+ initial_log_messages("tplot")
332
352
 
333
- tplot(root=args['--root'],
334
- config_file=args['--config'],
335
- target_file=args['--target'],
336
- model_file=args['--model'],
337
- feature=args['--feature'],
338
- thresholds=args['--sedthr'],
339
- verbose=verbose)
353
+ tplot(
354
+ root=args["--root"],
355
+ config_file=args["--config"],
356
+ target_file=args["--target"],
357
+ model_file=args["--model"],
358
+ feature=args["--feature"],
359
+ thresholds=args["--sedthr"],
360
+ verbose=verbose,
361
+ )
340
362
 
341
363
 
342
- if __name__ == '__main__':
364
+ if __name__ == "__main__":
343
365
  main()
sonusai/doc/__init__.py CHANGED
@@ -1 +1 @@
1
- from .doc import *
1
+ from .doc import * # noqa: F403