diff --git a/src/AnalysisPrograms/Recognizers/GenericRecognizer.cs b/src/AnalysisPrograms/Recognizers/GenericRecognizer.cs index ab3178139..8299a8223 100644 --- a/src/AnalysisPrograms/Recognizers/GenericRecognizer.cs +++ b/src/AnalysisPrograms/Recognizers/GenericRecognizer.cs @@ -357,7 +357,7 @@ public override RecognizerResults Recognize( // Such combinations will increase bandwidth of the event and this property can be used later to weed out unlikely events. var sequenceConfig = configuration.SyllableSequence; - if (sequenceConfig.CombinePossibleSyllableSequence) + if (sequenceConfig.NotNull() && sequenceConfig.CombinePossibleSyllableSequence) { // Must first convert events to spectral events. var spectralEvents1 = allResults.NewEvents.Cast().ToList(); diff --git a/tests/Acoustics.Test/AnalysisPrograms/Recognizers/GenericRecognizerTests.cs b/tests/Acoustics.Test/AnalysisPrograms/Recognizers/GenericRecognizerTests.cs index 61dc2f147..edb2420cb 100644 --- a/tests/Acoustics.Test/AnalysisPrograms/Recognizers/GenericRecognizerTests.cs +++ b/tests/Acoustics.Test/AnalysisPrograms/Recognizers/GenericRecognizerTests.cs @@ -135,6 +135,18 @@ public void TestOscillationAlgorithm() }, }; + config.CombineOverlappingEvents = false; + + // filter on bandwidth + config.ExpectedBandwidth = 350; + config.BandwidthStandardDeviation = 20; + + // filter on acousstic activity in nside bands. + // zero indicates no filtering. + config.NeighbourhoodUpperHertzBuffer = 0; + config.NeighbourhoodLowerHertzBuffer = 0; + config.NeighbourhoodDecibelBuffer = 0; + var results = recognizer.Recognize(recording, config, 100.Seconds(), null, this.TestOutputDirectory, null); Assert.AreEqual(1, results.NewEvents.Count); @@ -144,6 +156,7 @@ public void TestOscillationAlgorithm() Assert.AreEqual(113.15, @event.EventEndSeconds, 0.5); Assert.AreEqual(700, @event.LowFrequencyHertz, 0.1); Assert.AreEqual(1050, @event.HighFrequencyHertz, 0.1); + Assert.AreEqual(350, @event.BandWidthHertz); Assert.AreEqual("LowerBandDTMF_z", @event.Profile); Assert.AreEqual("DTMF", @event.Name); } @@ -176,6 +189,18 @@ public void TestWhistleAlgorithm() }, }; + config.CombineOverlappingEvents = false; + + // filter on bandwidth + config.ExpectedBandwidth = 90; + config.BandwidthStandardDeviation = 10; + + // filter on acousstic activity in nside bands. + // zero indicates no filtering. + config.NeighbourhoodUpperHertzBuffer = 0; + config.NeighbourhoodLowerHertzBuffer = 0; + config.NeighbourhoodDecibelBuffer = 0; + var results = recognizer.Recognize(recording, config, 100.Seconds(), null, this.TestOutputDirectory, null); Assert.AreEqual(1, results.NewEvents.Count);