Skip to content

Commit

Permalink
Fix bugs introduced in feedback logging patch
Browse files Browse the repository at this point in the history
@towsey introduced two bugs when changing the filter events on duration|bandwidth function in 53945d0. Both were caused by less/greater than operators not being less/greater than or equal.
  • Loading branch information
atruskie committed Apr 9, 2021
1 parent 8843d23 commit d2fab48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/AudioAnalysisTools/Events/EventFilters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static List<EventCommon> FilterOnBandwidth(List<EventCommon> events, doub
{
count++;
var bandwidth = ((SpectralEvent)ev).BandWidthHertz;
if ((bandwidth > minBandwidth) && (bandwidth < maxBandwidth))
if ((bandwidth >= minBandwidth) && (bandwidth <= maxBandwidth))
{
Log.Debug($" Event[{count}] accepted: Actual bandwidth = {bandwidth}");
filteredEvents.Add(ev);
Expand Down Expand Up @@ -176,7 +176,7 @@ public static List<EventCommon> FilterOnDuration(List<EventCommon> events, doubl
{
count++;
var duration = ((SpectralEvent)ev).EventDurationSeconds;
if ((duration > minimumDurationSeconds) && (duration < maximumDurationSeconds))
if ((duration >= minimumDurationSeconds) && (duration <= maximumDurationSeconds))
{
Log.Debug($" Event[{count}] accepted: Actual duration = {duration:F3}s");
filteredEvents.Add(ev);
Expand Down
13 changes: 0 additions & 13 deletions tests/Acoustics.Test/Shared/CsvTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,19 +481,6 @@ public void TestInvariantCultureIsUsedMatrix()
Assert.AreEqual(expected, actual);
}

[TestMethod]
public void TestIntervalTopologyRoundTrip()
{
var topology = Topology.Exclusive;

var file = this.TestOutputDirectory.CombineFile("timespan_roundtrip.csv");
Csv.WriteToCsv(file, new[] { new CsvTestClass2() { SomeNumber = 3, SomeTopology = topology } });

var actual = Csv.ReadFromCsv<CsvTestClass2>(file).ToArray();

Assert.AreEqual(Topology.Exclusive, actual.First().SomeTopology);
}

[TestMethod]
public void EnumsAreConvertible()
{
Expand Down

0 comments on commit d2fab48

Please sign in to comment.