diff --git a/tests/Acoustics.Test/AnalysisPrograms/Recognizers/AustralPipitTests.cs b/tests/Acoustics.Test/AnalysisPrograms/Recognizers/AustralPipitTests.cs index 216cbec45..9d057826b 100644 --- a/tests/Acoustics.Test/AnalysisPrograms/Recognizers/AustralPipitTests.cs +++ b/tests/Acoustics.Test/AnalysisPrograms/Recognizers/AustralPipitTests.cs @@ -7,6 +7,7 @@ namespace Acoustics.Test.AnalysisPrograms.Recognizers using System; using System.Collections.Generic; using System.IO; + using System.Linq; using Acoustics.Test.TestHelpers; using Acoustics.Tools.Wav; using global::AnalysisPrograms.Recognizers; @@ -56,17 +57,30 @@ public void TestRecognizer() this.SaveTestOutput( outputDirectory => GenericRecognizer.SaveDebugSpectrogram(results, null, outputDirectory, Recognizer.SpeciesName)); - Assert.AreEqual(5, events.Count); + //this test returns two false-positives with the current component parameters. + Assert.AreEqual(7, events.Count); Assert.IsNull(scoreTrack); Assert.AreEqual(1, plots.Count); Assert.AreEqual(1874, sonogram.FrameCount); - Assert.IsInstanceOfType(events[1], typeof(CompositeEvent)); - var ev = (CompositeEvent)events[1]; + Assert.IsInstanceOfType(events[2], typeof(CompositeEvent)); + var ev = (CompositeEvent)events[2]; + // event 2 should be a composite event. Assert.AreEqual(16.656, ev.EventStartSeconds); - Assert.AreEqual(17.024, ev.EventEndSeconds); - Assert.AreEqual(3689, ev.BandWidthHertz); + Assert.AreEqual(17.008, ev.EventEndSeconds); + Assert.AreEqual(3596, ev.BandWidthHertz); + + // event 2 should contain 5 component events + var componentEvents = ev.ComponentEvents; + Assert.AreEqual(5, componentEvents.Count); + + // This tests that the component tracks are correctly combined. + //THis can also be tested somewhere else, starting with just the comosite event in json file. + var points = EventExtentions.GetCompositeTrack(componentEvents).ToArray(); + Assert.AreEqual(16.672, points[1].Seconds.Minimum); + Assert.AreEqual(5425, points[1].Hertz.Minimum); + Assert.AreEqual(23.71245325, points[1].Value, 0.001); } } } \ No newline at end of file diff --git a/tests/Acoustics.Test/AnalysisPrograms/Recognizers/CisticolaTests.cs b/tests/Acoustics.Test/AnalysisPrograms/Recognizers/CisticolaTests.cs index c952d594e..27fc61dd0 100644 --- a/tests/Acoustics.Test/AnalysisPrograms/Recognizers/CisticolaTests.cs +++ b/tests/Acoustics.Test/AnalysisPrograms/Recognizers/CisticolaTests.cs @@ -27,8 +27,8 @@ public class CisticolaTests : OutputDirectoryTest /// /// The canonical recording used for this recognizer is a 31 second recording . /// - //private static readonly FileInfo TestAsset = PathHelper.ResolveAsset("Recordings", "ms1_2559_630118_20170402_075841_30_0.wav"); - private static readonly FileInfo TestAsset = new FileInfo(@"C:\Ecoacoustics\WavFiles\TestNoiseRecordings\Cisticola\ms1_2559_628362_20170408_074841_30_0.wav"); + private static readonly FileInfo TestAsset = PathHelper.ResolveAsset("Recordings", "ms1_2559_630118_20170402_075841_30_0.wav"); + //private static readonly FileInfo TestAsset = new FileInfo(@"C:\Ecoacoustics\WavFiles\TestNoiseRecordings\Cisticola\ms1_2559_628362_20170408_074841_30_0.wav"); private static readonly FileInfo ConfigFile = PathHelper.ResolveConfigFile("RecognizerConfigFiles", "Towsey.CisticolaExilis.yml"); private static readonly CisticolaExilis Recognizer = new CisticolaExilis(); @@ -58,21 +58,23 @@ public void TestRecognizer() this.SaveTestOutput( outputDirectory => GenericRecognizer.SaveDebugSpectrogram(results, null, outputDirectory, Recognizer.SpeciesName)); - Assert.AreEqual(8, events.Count); + // this test returns with two false-negatives. + // It is possible to get all positive events but creates excess FPs on test data. + Assert.AreEqual(17, events.Count); Assert.IsNull(scoreTrack); Assert.AreEqual(1, plots.Count); - Assert.AreEqual(2667, sonogram.FrameCount); + Assert.AreEqual(3747, sonogram.FrameCount); - Assert.IsInstanceOfType(events[1], typeof(CompositeEvent)); + Assert.IsInstanceOfType(events[3], typeof(CompositeEvent)); - var secondEvent = (CompositeEvent)events[1]; + var secondEvent = (CompositeEvent)events[3]; - Assert.AreEqual(5.375419501133787, secondEvent.EventStartSeconds); - Assert.AreEqual(6.0720181405895692, secondEvent.EventEndSeconds); - Assert.AreEqual(483, secondEvent.LowFrequencyHertz); - Assert.AreEqual(735, secondEvent.HighFrequencyHertz); - Assert.AreEqual(20.901882476071698, secondEvent.Score, TestHelper.AllowedDelta); - Assert.AreEqual(0.20786700431266195, secondEvent.ScoreNormalized, TestHelper.AllowedDelta); + Assert.AreEqual(7.28, secondEvent.EventStartSeconds); + Assert.AreEqual(7.432, secondEvent.EventEndSeconds); + Assert.AreEqual(2542, secondEvent.LowFrequencyHertz); + Assert.AreEqual(3100, secondEvent.HighFrequencyHertz); + Assert.AreEqual(17.91649081319, secondEvent.Score, TestHelper.AllowedDelta); + Assert.AreEqual(0.07765486486, secondEvent.ScoreNormalized, TestHelper.AllowedDelta); } } } \ No newline at end of file