changeset 1182:0e5d37b0b9ff

bug corrections
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Fri, 01 Apr 2022 15:33:22 -0400
parents b3b1a5dfa17c
children 38f0d0ceac3f
files trafficintelligence/events.py trafficintelligence/moving.py trafficintelligence/storage.py
diffstat 3 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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
--- 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]