You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to calculate the Tone-to-Noise ratio on a 200ms snapshot of a stationnary signal.
I get the following error:
File ~\Anaconda3\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
exec(code, globals, locals)
File d:\dev\alarm_new\identification\machine learning\postprocess_dataset.py:27
dataset_sliced = load_slice_compute(
File d:\dev\ml_tools\ml_tools\audio\machine_learning\load_slice_compute.py:116 in load_slice_compute
feature_vector.compute(snapshot_norm, sampling_rate, filter_signal, low, high, cepstrum_formula)
File d:\dev\ml_tools\ml_tools\audio\machine_learning\features.py:58 in compute
self._computation()
File d:\dev\ml_tools\ml_tools\audio\machine_learning\features.py:139 in _computation
result = eval(feature["function"])(self.signals[domain]["y"], function_args)
File d:\dev\ml_tools\ml_tools\audio\machine_learning\features_functions.py:1060 in ttn_ratio
t_tnr, tnr, prom, tones_freqs = tnr_ecma_st(signal, args_dict["fs"], prominence=True)
File ~\Anaconda3\lib\site-packages\mosqito\sq_metrics\tonality\tone_to_noise_ecma\tnr_ecma_st.py:39 in tnr_ecma_st
tones_freqs, tnr, prom, t_tnr = _tnr_main_calc(spectrum_db, freq_axis)
File ~\Anaconda3\lib\site-packages\mosqito\sq_metrics\tonality\tone_to_noise_ecma\_tnr_main_calc.py:76 in _tnr_main_calc
peak_index = _screening_for_tones(freqs, spec_db, "smoothed", 90, 11200)
File ~\Anaconda3\lib\site-packages\mosqito\sq_metrics\tonality\tone_to_noise_ecma\_screening_for_tones.py:55 in _screening_for_tones
smooth_spec = _spectrum_smoothing(freqs, spec_db.T, 24, low_freq, high_freq, freqs).T
File ~\Anaconda3\lib\site-packages\mosqito\sq_metrics\tonality\tone_to_noise_ecma\_spectrum_smoothing.py:65 in _spectrum_smoothing
smoothed_spectrum = np.delete(smoothed_spectrum, i, axis=1)
File <__array_function__ internals>:5 in delete
File ~\Anaconda3\lib\site-packages\numpy\lib\function_base.py:4523 in delete
raise IndexError(
IndexError: index 1 is out of bounds for axis 1 with size 1
After doing some probing in the scripts I noticed that the following (line 65 of _spectrum_smoothing) was the cause of the error: smoothed_spectrum = np.delete(smoothed_spectrum, i, axis=1)
At the second band, it enters the if condition at line 64 and because the smoothed_spectrum array was instantiated with a size of (168, 1), it can't delete along axis=1.
Shouldn't it be axis=0? as is the case for the following delete in line 66?
It works when I pass longer snapshots (I tried 400ms and more) but mainly because it doesn't pass the if condition.
The text was updated successfully, but these errors were encountered:
Thanks for this remark, your work is helping us with making mosqito more robust to all possible cases ;)
The correction has been included in PR#72 that will lead to the next coming release.
EDIT: merge done on 07/02/2024 including the correction
Hi,
I tried to calculate the Tone-to-Noise ratio on a 200ms snapshot of a stationnary signal.
I get the following error:
After doing some probing in the scripts I noticed that the following (line 65 of _spectrum_smoothing) was the cause of the error:
smoothed_spectrum = np.delete(smoothed_spectrum, i, axis=1)
At the second band, it enters the if condition at line 64 and because the smoothed_spectrum array was instantiated with a size of (168, 1), it can't delete along axis=1.
Shouldn't it be axis=0? as is the case for the following delete in line 66?
It works when I pass longer snapshots (I tried 400ms and more) but mainly because it doesn't pass the if condition.
The text was updated successfully, but these errors were encountered: