Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timbral_Warmth.py:217: RuntimeWarning: divide by zero encountered in log10 #12

Open
olivecha opened this issue Apr 1, 2021 · 0 comments

Comments

@olivecha
Copy link

olivecha commented Apr 1, 2021

The error occurs when there is a zero in the array :

spec[WR_upper_f_limit_idx:]

a working fix is replacing the line 217 with :

 above_WR_spec = [value if value == 0 else np.log10(value) for value in spec[WR_upper_f_limit_idx:]]
olivecha added a commit to olivecha/timbral_models that referenced this issue Aug 20, 2021
When there are zero values in the spectrogram array (the intensity is null) the np.log10 raises an Error (because log10(0) = -inf). Because the log10 is used to reduce the range of the values, when a value is zero, zero should be returned.
olivecha added a commit to olivecha/timbral_models that referenced this issue Aug 20, 2021
olivecha added a commit to olivecha/timbral_models that referenced this issue Aug 20, 2021
When there are zero values in the spectrogram array (the intensity is null) the np.log10 raises an Error (because log10(0) = -inf). Because the log10 is used to reduce the range of the values, when a value is zero, zero should be returned.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant