Skip to content

Commit 86c39fb

Browse files
committed
[CC] correction of nseg in case of a signal <= 200ms
1 parent 213819e commit 86c39fb

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

mosqito/sq_metrics/roughness/roughness_dw/_roughness_dw_main_calc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
_ear_filter_coeff,
1212
)
1313
from mosqito.utils.conversion import freq2bark, db2amp, amp2db, bark2freq
14-
import matplotlib.pyplot as plt
1514

1615
def _roughness_dw_main_calc(spec, freq_axis, fs, gzi, hWeight):
1716
"""

mosqito/sq_metrics/roughness/roughness_dw/roughness_dw.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ def roughness_dw(signal, fs=None, overlap=0.5, is_sdt_output=False):
6767
sig, time = time_segmentation(
6868
signal, fs, nperseg=nperseg, noverlap=noverlap, is_ecma=False
6969
)
70-
nseg = sig.shape[1]
70+
if len(sig.shape) == 1:
71+
nseg = 1
72+
else:
73+
nseg = sig.shape[1]
7174

7275
spec, _ = spectrum(sig, fs, nfft="default", window="blackman", db=False)
7376

0 commit comments

Comments
 (0)