Skip to content

Commit

Permalink
avoid nan error
Browse files Browse the repository at this point in the history
  • Loading branch information
gferraro committed Jun 10, 2021
1 parent 1230645 commit 1be45ef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Melt/identify_species.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,10 @@ def identify_species(recording, metadata, models):
start = limit - slices_per_sample
start_times.append(start / slices_per_second)
sample = npspec[:, start:limit]

sample = librosa.amplitude_to_db(sample, ref=np.max)
sample = sample / abs(sample.min()) + 1.0
if sample.min() != 0:
sample = sample / abs(sample.min()) + 1.0
samples.append(sample.reshape(sample.shape + (1,)))
samples = np.array(samples)

Expand Down

0 comments on commit 1be45ef

Please sign in to comment.