Skip to content

Commit

Permalink
Fixed bug in when removing enclosed events
Browse files Browse the repository at this point in the history
Also changed name of parameter RemoveTemporallyEnclosedEvents to RemoveEnclosedEvents.
  • Loading branch information
towsey authored and atruskie committed Mar 5, 2021
1 parent 477a542 commit f4b6008
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ PostProcessing:
# MaxActivityDecibels: 12

# 6: In the case of sets of nested/enclosed events, filter/remove all but the outermost event.
RemoveTemporallyEnclosedEvents: true
RemoveEnclosedEvents: true

# Options to save results files
# 1: Available options for saving spectrograms (case-sensitive): [False/Never | True/Always | WhenEventsDetected]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ PostProcessing:
MaxActivityDecibels: null

# 6: In the case of sets of nested/enclosed events, filter/remove all but the outermost event.
RemoveTemporallyEnclosedEvents: true
RemoveEnclosedEvents: true


# Various options to save results files
Expand Down
13 changes: 7 additions & 6 deletions src/AnalysisPrograms/Recognizers/GenericRecognizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,18 +154,19 @@ public override RecognizerResults Recognize(
postEvents.AddRange(ppEvents);
}

// Running profiles with multiple dB thresholds can produce enclosed or temporally nested (Russian doll) events.
// Remove all but the outermost event.
if (configuration.PostProcessing.RemoveTemporallyEnclosedEvents)
// Running profiles with multiple dB thresholds can produce enclosed/nested events.
// Remove all but the outermost events.
if (configuration.PostProcessing.RemoveEnclosedEvents)
{
Log.Debug($"\nREMOVE EVENTS ENCLOSED BY LONGER EVENTS.");
Log.Debug($"\nREMOVE ENCLOSED EVENTS.");
Log.Debug($"Event count BEFORE removing enclosed events = {postEvents.Count}.");
results.NewEvents = CompositeEvent.RemoveEnclosedEvents(postEvents);
Log.Debug($"Event count AFTER removing enclosed events = {postEvents.Count}.");
}
else
{
Log.Debug($"\nEVENTS ENCLOSED BY LONGER EVENTS WERE NOT REMOVED.");
Log.Debug($"\nENCLOSED EVENTS WERE NOT REMOVED - {postEvents.Count} events returned.");
results.NewEvents = postEvents;
}

// Write out the events to log.
Expand All @@ -176,7 +177,7 @@ public override RecognizerResults Recognize(
{
counter++;
var spEvent = (SpectralEvent)ev;
Log.Debug($" Event[{counter}]: Start={spEvent.EventStartSeconds:f1}; Duration={spEvent.EventDurationSeconds:f2}; Bandwidth={spEvent.BandWidthHertz} Hz");
Log.Debug($" Event[{counter}]: Start={spEvent.EventStartSeconds:f1}; End={spEvent.EventEndSeconds:f1}; Duration={spEvent.EventDurationSeconds:f2}; Bandwidth={spEvent.BandWidthHertz} Hz");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/AudioAnalysisTools/Events/Types/EventPostProcessing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public class PostProcessingConfig
/// Russian doll events!
/// Setting this boolean true removes all but the outermost of any set of encloseed events.
/// </summary>
public bool RemoveTemporallyEnclosedEvents { get; set; }
public bool RemoveEnclosedEvents { get; set; }
}

/// <summary>
Expand Down

0 comments on commit f4b6008

Please sign in to comment.