Skip to content

Commit

Permalink
Fixed tests associated with the previous changes
Browse files Browse the repository at this point in the history
Issue #390
  • Loading branch information
towsey authored and atruskie committed Nov 1, 2020
1 parent 7150e80 commit e82f81a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class AustBitternTests : OutputDirectoryTest
/// The canonical recording used for this recognizer is a 30 second recording made by Liz Znidersic at Medeas Cove, St Helens, 2016-12-17.
/// </summary>
private static readonly FileInfo TestAsset = PathHelper.ResolveAsset("Recordings", "medeas_cove_2-2_1831_471228_20161217_232352_30_0.wav");
//private static readonly FileInfo TestAsset = new FileInfo(@"C:\Ecoacoustics\WavFiles\TestNoiseRecordings\West_Knoll_St_Bees_WindRain_20080917-133000.wav");
private static readonly FileInfo ConfigFile = PathHelper.ResolveConfigFile("RecognizerConfigFiles", "Towsey.BotaurusPoiciloptilus.yml");
private static readonly BotaurusPoiciloptilus Recognizer = new BotaurusPoiciloptilus();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,8 @@ public void TestRecognizer()
Assert.AreEqual(22.3680000000000, ev.EventEndSeconds, TestHelper.AllowedDelta);
Assert.AreEqual(4743, ev.BandWidthHertz);

// This event should contain 13 component events
var componentEvents = ev.ComponentEvents;
Assert.AreEqual(13, componentEvents.Count);
Assert.AreEqual(3, 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public void TestRecognizer()
Assert.AreEqual(6.1648979591836737, secondEvent.EventEndSeconds);
Assert.AreEqual(441, secondEvent.LowFrequencyHertz);
Assert.AreEqual(735, secondEvent.HighFrequencyHertz);
Assert.AreEqual(22.388932023970227, secondEvent.Score, TestHelper.AllowedDelta);
Assert.AreEqual(0.0092984503451215648, secondEvent.ScoreNormalized, TestHelper.AllowedDelta);
Assert.AreEqual(18.753868577301958, secondEvent.Score, TestHelper.AllowedDelta);
Assert.AreEqual(0.34061938340960607, secondEvent.ScoreNormalized, TestHelper.AllowedDelta);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void TestRecognizer()
Assert.AreEqual(2542, ev.LowFrequencyHertz);
Assert.AreEqual(3100, ev.HighFrequencyHertz);
Assert.AreEqual(17.916490813192297, ev.Score, TestHelper.AllowedDelta);
Assert.AreEqual(0.077654864863397136, ev.ScoreNormalized, TestHelper.AllowedDelta);
Assert.AreEqual(0.0776548648633971, ev.ScoreNormalized, TestHelper.AllowedDelta);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void TestBlobAlgorithm()
{
UpperHertzBuffer = 0,
LowerHertzBuffer = 0,
DecibelBuffer = 0,
MaxAverageSidebandDecibels = 0,
},
},
};
Expand Down Expand Up @@ -190,7 +190,7 @@ public void TestOscillationAlgorithm()
{
UpperHertzBuffer = 0,
LowerHertzBuffer = 0,
DecibelBuffer = 0,
MaxAverageSidebandDecibels = 0,
},
},
};
Expand Down Expand Up @@ -253,7 +253,7 @@ public void TestWhistleAlgorithm()
{
UpperHertzBuffer = 0,
LowerHertzBuffer = 0,
DecibelBuffer = 0,
MaxAverageSidebandDecibels = 0,
},
},
};
Expand Down Expand Up @@ -1000,7 +1000,7 @@ public void TestAedAlgorithm()
{
UpperHertzBuffer = 0,
LowerHertzBuffer = 0,
DecibelBuffer = 0,
MaxAverageSidebandDecibels = 0,
},
},
};
Expand Down Expand Up @@ -1088,7 +1088,7 @@ public void TestMultipleAlgorithms()
{
UpperHertzBuffer = 0,
LowerHertzBuffer = 0,
DecibelBuffer = 0,
MaxAverageSidebandDecibels = 0,
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace Acoustics.Test.AnalysisPrograms.Recognizers
using System;
using System.IO;
using Acoustics.Test.TestHelpers;
using Acoustics.Tools.Wav;
using global::AnalysisPrograms.Recognizers;
using global::AudioAnalysisTools;
using global::AudioAnalysisTools.Events.Types;
using global::AudioAnalysisTools.WavTools;
using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand All @@ -21,9 +21,8 @@ public class PowerfulOwlTests : OutputDirectoryTest
{
/// <summary>
/// The canonical recording used for this recognizer contains three calls, each with two syllables.
/// However the calls are loud and each is followed by an echo which is picked up as another syllable.
/// In addition, there is a false-positive hit near start of recording.
/// The config file could easily be adjusted to remove the extra hits,
/// However the calls are loud and two of them are followed by an echo which is picked up as another syllable.
/// The config file could be adjusted to remove the extra hits,
/// but the config has been optimised on ten recordings, provided by Kristen Thompson, that contain a variety of loud and soft calls.
/// </summary>
private static readonly FileInfo TestAsset = PathHelper.ResolveAsset("Recordings", "Powerful3AndBoobook0_ksh3_1773_510819_20171109_174311_30_0.wav");
Expand Down Expand Up @@ -52,21 +51,22 @@ public void TestRecognizer()
this.SaveTestOutput(
outputDirectory => GenericRecognizer.SaveDebugSpectrogram(results, null, outputDirectory, Recognizer.SpeciesName));

Assert.AreEqual(7, events.Count);
Assert.AreEqual(5, events.Count);
Assert.IsNull(scoreTrack);
Assert.AreEqual(5, plots.Count);
Assert.AreEqual(2580, sonogram.FrameCount);

Assert.IsInstanceOfType(events[1], typeof(CompositeEvent));
Assert.IsInstanceOfType(events[1], typeof(ChirpEvent));

var secondEvent = (CompositeEvent)events[3];
//Note: due to combining and filtering of events etc, they are not in temporal order
var secondEvent = (CompositeEvent)events[4];

Assert.AreEqual(28.28190476, secondEvent.EventStartSeconds, 1E-06);
Assert.AreEqual(29.18748299, secondEvent.EventEndSeconds, 1E-06);
Assert.AreEqual(399, secondEvent.LowFrequencyHertz);
Assert.AreEqual(26.842267573, secondEvent.EventStartSeconds, 1E-06);
Assert.AreEqual(27.945215419, secondEvent.EventEndSeconds, 1E-06);
Assert.AreEqual(357, secondEvent.LowFrequencyHertz);
Assert.AreEqual(483, secondEvent.HighFrequencyHertz);
Assert.AreEqual(20.55114869, secondEvent.Score, 1E-06);
Assert.AreEqual(0.137214817, secondEvent.ScoreNormalized, 1E-06);
Assert.AreEqual(47.93789051, secondEvent.Score, 1E-06);
Assert.AreEqual(0.0797182258673, secondEvent.ScoreNormalized, 1E-06);
}
}
}

0 comments on commit e82f81a

Please sign in to comment.