# HG changeset patch # User Nicolas Saunier # Date 1648841602 14400 # Node ID 0e5d37b0b9ffa7d5d70ba3781eaeaf840b3c12a6 # Parent b3b1a5dfa17c3ef81ff8bf569978f25077b5fafb bug corrections diff -r b3b1a5dfa17c -r 0e5d37b0b9ff trafficintelligence/events.py --- a/trafficintelligence/events.py Mon Mar 28 23:12:15 2022 -0400 +++ b/trafficintelligence/events.py Fri Apr 01 15:33:22 2022 -0400 @@ -92,7 +92,7 @@ 's', 's'] - timeIndicators = ['Time to Collision', 'predicted Post Encroachment Time'] + mostSevereIsMinIndicators = ['Distance', 'Time to Collision', 'predicted Post Encroachment Time'] def __init__(self, num = None, timeInterval = None, roaduserNum1 = None, roaduserNum2 = None, roadUser1 = None, roadUser2 = None): moving.STObject.__init__(self, num, timeInterval) diff -r b3b1a5dfa17c -r 0e5d37b0b9ff trafficintelligence/moving.py --- a/trafficintelligence/moving.py Mon Mar 28 23:12:15 2022 -0400 +++ b/trafficintelligence/moving.py Fri Apr 01 15:33:22 2022 -0400 @@ -1569,7 +1569,7 @@ Caution about previously filtered data''' if speeds is None: speeds = self.getSpeeds(nInstantsIgnoredAtEnds) - return savgol_filter(speeds, window_length, polyorder, 1, delta, axis, mode, cval) + return savgol_filter(speeds, min(window_length, len(speeds)), polyorder, 1, delta, axis, mode, cval) def getSpeedIndicator(self): from indicators import SeverityIndicator diff -r b3b1a5dfa17c -r 0e5d37b0b9ff trafficintelligence/storage.py --- a/trafficintelligence/storage.py Mon Mar 28 23:12:15 2022 -0400 +++ b/trafficintelligence/storage.py Fri Apr 01 15:33:22 2022 -0400 @@ -542,7 +542,7 @@ indicatorTypeNum = row[5] indicatorName = events.Interaction.indicatorNames[indicatorTypeNum] indicatorValues = {row[6]:row[7]} - interactions[-1].indicators[indicatorName] = indicators.SeverityIndicator(indicatorName, indicatorValues, mostSevereIsMax = not indicatorName in events.Interaction.timeIndicators) + interactions[-1].indicators[indicatorName] = indicators.SeverityIndicator(indicatorName, indicatorValues, mostSevereIsMax = not indicatorName in events.Interaction.mostSevereIsMinIndicators) else: indicatorValues[row[6]] = row[7] interactions[-1].indicators[indicatorName].timeInterval.last = row[6]