/// <inheritdoc /> public virtual SummaryIndexBase[] ConvertEventsToSummaryIndices(IEnumerable <EventBase> events, TimeSpan unitTime, TimeSpan duration, double scoreThreshold) { if (duration == TimeSpan.Zero) { return(null); } double units = duration.TotalSeconds / unitTime.TotalSeconds; // get whole minutes int unitCount = (int)(units / 1); // add fractional minute if (units % 1 > 0.0) { unitCount += 1; } // to store event counts var eventsPerUnitTime = new int[unitCount]; // to store counts of high scoring events var bigEvsPerUnitTime = new int[unitCount]; foreach (var anEvent in events) { // note: absolute determines what value is used // EventStartSeconds (relative to ~~segment~~, 2017-09: RELATIVE TO RECORDING) // StartOffset (relative to recording) double eventStart = anEvent.EventStartSeconds; double eventScore = anEvent.Score; var timeUnit = (int)(eventStart / unitTime.TotalSeconds); // NOTE: eventScore filter replaced with greater then as opposed to not equal to if (eventScore >= 0.0) { eventsPerUnitTime[timeUnit]++; } if (eventScore > scoreThreshold) { bigEvsPerUnitTime[timeUnit]++; } } var indices = new SummaryIndexBase[eventsPerUnitTime.Length]; for (int i = 0; i < eventsPerUnitTime.Length; i++) { var newIndex = new EventIndex { ResultStartSeconds = unitTime.Multiply(i).TotalSeconds, EventsTotal = eventsPerUnitTime[i], EventsTotalThresholded = bigEvsPerUnitTime[i], SegmentDurationSeconds = unitTime.TotalSeconds, }; indices[i] = newIndex; } return(indices); }
public static void CorrectSummaryIndex(AnalysisResult2 result, SummaryIndexBase indexToBeFixed, int totalSummaryIndicesSoFar, int totalSumaryIndicesInJustThisResultSoFar) { indexToBeFixed.RankOrder = totalSummaryIndicesSoFar; }