Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions timbral_models/Timbral_Warmth.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ def timbral_warmth(fname, dev_output=False, phase_correction=False, clip_output=
HF decay
- linear regression of the values above the warmth region
'''
above_WR_spec = np.log10(spec[WR_upper_f_limit_idx:])
# Sometimes when there are zero values in the spec array (the intensity is null),
# the np.log10 raises a warning.
# Because the log10 is used to reduce the range of the values,
# when a value is zero, zero should be returned :
above_WR_spec = np.array([value if value == 0 else np.log10(value) for value in spec[WR_upper_f_limit_idx:]])
above_WR_freq = np.log10(freq[WR_upper_f_limit_idx:])
np.ones_like(above_WR_freq)
metrics = np.array([above_WR_freq, np.ones_like(above_WR_freq)])
Expand All @@ -225,7 +229,6 @@ def timbral_warmth(fname, dev_output=False, phase_correction=False, clip_output=
decay_score = model.score(metrics.transpose(), above_WR_spec)
all_decay_score.append(decay_score)


'''
get mean values
'''
Expand Down