From aecccbc9dc567ade8cf54ce1478633c954f6407c Mon Sep 17 00:00:00 2001 From: towsey Date: Sat, 17 Oct 2020 16:44:58 +1100 Subject: [PATCH] Update EventFilters.cs Issue #390 Added the analysis threshold as an argument to method dealing sideband activity. THis was an experiment. In the end did not use the argument but left , just in case might be used in future. --- src/AudioAnalysisTools/Events/EventFilters.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/AudioAnalysisTools/Events/EventFilters.cs b/src/AudioAnalysisTools/Events/EventFilters.cs index 400a865df..d1918dfee 100644 --- a/src/AudioAnalysisTools/Events/EventFilters.cs +++ b/src/AudioAnalysisTools/Events/EventFilters.cs @@ -300,6 +300,7 @@ public static (int Count, double AveragePeriod, double SdPeriod) GetPeriodicity( /// A list of filtered events. public static List FilterEventsOnSidebandActivity( List events, + double analysisThreshold, BaseSonogram spectrogram, int lowerHertzBuffer, int upperHertzBuffer, @@ -330,6 +331,7 @@ public static List FilterEventsOnSidebandActivity( var lowerSidebandMatrix = GetLowerEventSideband(ev, spectrogramData, lowerHertzBuffer, lowerBinGap, converter); retainEvent1 = IsSidebandActivityBelowThreshold( avEventDecibels, + analysisThreshold, lowerSidebandMatrix, decibelThreshold); } @@ -339,6 +341,7 @@ public static List FilterEventsOnSidebandActivity( var upperSidebandMatrix = GetUpperEventSideband(ev, spectrogramData, upperHertzBuffer, upperBinGap, converter); retainEvent2 = IsSidebandActivityBelowThreshold( avEventDecibels, + analysisThreshold, upperSidebandMatrix, decibelThreshold); } @@ -356,6 +359,7 @@ public static List FilterEventsOnSidebandActivity( public static bool IsSidebandActivityBelowThreshold( double avEventDecibels, + double analysisThreshold, double[,] sidebandMatrix, double sidebandThreshold) { @@ -364,6 +368,7 @@ public static bool IsSidebandActivityBelowThreshold( var averageMatrixDecibels = averageColDecibels.Average(); // Is the average acoustic activity in the sideband below the user set threshold? + //bool avBgBelowThreshold = averageMatrixDecibels < analysisThreshold; bool avBgBelowThreshold = averageMatrixDecibels < sidebandThreshold; if (!avBgBelowThreshold) {