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

Fix DeprecationWarning regarding conversion of array to scalar #83

Closed hakostra closed 8 months ago

hakostra commented 9 months ago

Using a recent version of numpy the following deprecation warning is given:

mosqito/sq_metrics/sharpness/sharpness_din/sharpness_din_from_loudness.py:69: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)

This commit fix this warning by using flatiter (https://numpy.org/doc/stable/reference/generated/numpy.flatiter.html) to extract the first (and only) element from the array in the case it is scalar.