Eomys / MoSQITo

MoSQITo is a unified and modular development framework of key sound quality metrics favoring reproducible science and efficient shared scripting among engineers, teachers and researchers community.
Apache License 2.0
134 stars 44 forks source link

RunTime error when using tnr_ecma_tv #60

Open tcordaro opened 1 year ago

tcordaro commented 1 year ago

Hello, runMoqito.py.txt signal.txt

When running tnr_ecma_tv routine with the attached script and signal (runMoqito.py and signal.txt), I got the following issue: """ _python3.10/site-packages/mosqito/sq_metrics/tonality/tone_to_noise_ecma/_tnr_maincalc.py:188: RuntimeWarning: invalid value encountered in log10 Ln = 10 np.log10(10 (Ltot / 10) - 10 (Lt / 10)) + 10 np.log10( """ I have "played" a bit with the code and it seems that the routine is sensitive to the algorithm of peak detection _peak_level. When I changed the 10dB criterium to 9.75, the exception disappear. The exception is raised when Lt is larger than Ltot The issue is machine dependent (some machine do not raise exception) Thank for your help, Regards

wantysal commented 1 year ago

Hello,

Thanks for noticing this ! Indeed this error is sometimes raised, depending on the input spectrum. Please note that this adjustment of the peak level is not part of the ECMA, it was added to overcome the level approximation due to the spectrum resolution. We'll add a little test to check that Lt<Ltot in the next release, and explore this correction deeper to find a better model. Feel free to contribute to MOSQITO if you have an idea :)