From d6589df1a0b542e9278ecad6bc091f07db56b7fd Mon Sep 17 00:00:00 2001 From: Vincent Lostanlen Date: Thu, 3 Oct 2019 14:33:53 -0400 Subject: [PATCH] set threshold to 20.0, min_peak_height to 20 --- birdvoxdetect/core.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/birdvoxdetect/core.py b/birdvoxdetect/core.py index d8e3c33..ecd91d6 100644 --- a/birdvoxdetect/core.py +++ b/birdvoxdetect/core.py @@ -41,7 +41,7 @@ def process_file( output_dir=None, export_clips=False, export_confidence=False, - threshold=30.0, + threshold=20.0, suffix="", clip_duration=1.0, logger_level=logging.INFO, @@ -142,6 +142,9 @@ def process_file( chunk_duration = 450 queue_length = 1 + # Define minimum peak height for BirdVoxDetect function. + min_peak_height = 10 + # Define number of chunks. sr = sound_file.samplerate chunk_length = int(chunk_duration * sr) @@ -273,7 +276,8 @@ def process_file( continue # Find peaks. - peak_locs, _ = scipy.signal.find_peaks(chunk_confidence) + peak_locs, _ = scipy.signal.find_peaks( + chunk_confidence, height=min_peak_height) peak_vals = chunk_confidence[peak_locs] # Threshold peaks. @@ -406,7 +410,8 @@ def process_file( continue # Find peaks. - peak_locs, _ = scipy.signal.find_peaks(chunk_confidence) + peak_locs, _ = scipy.signal.find_peaks( + chunk_confidence, height=min_peak_height) peak_vals = chunk_confidence[peak_locs] # Threshold peaks. @@ -520,7 +525,8 @@ def process_file( if threshold is not None: # Find peaks. - peak_locs, _ = scipy.signal.find_peaks(chunk_confidence) + peak_locs, _ = scipy.signal.find_peaks( + chunk_confidence, height=min_peak_height) peak_vals = chunk_confidence[peak_locs] # Threshold peaks.