public static List <AcousticEvent> PruneOverlappingEvents(List <AcousticEvent> events, int percentOverlap) { double thresholdOverlap = percentOverlap / 100.0; int count = events.Count; for (int i = 0; i < count - 1; i++) { for (int j = i + 1; j < count; j++) { if (AcousticEvent.EventFractionalOverlap(events[i], events[j]) > thresholdOverlap) { //determine the event with highest score if (events[i].Score >= events[j].Score) { events[j].Name = null; } else { events[i].Name = null; } } } } List <AcousticEvent> pruned = new List <AcousticEvent>(); foreach (AcousticEvent ae in events) { if (ae.Name != null) { pruned.Add(ae); } } return(pruned); }