changeset 603:c7ece0f0ced9

refine
author Mohamed Gomaa
date Sat, 04 May 2013 18:01:43 -0400
parents 480c8edf177e
children 1a92d28e2d05
files python/poly_utils.py
diffstat 1 files changed, 9 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/python/poly_utils.py	Thu May 02 11:37:24 2013 -0400
+++ b/python/poly_utils.py	Sat May 04 18:01:43 2013 -0400
@@ -6,26 +6,18 @@
 import numpy as np
 
 __metaclass__ = type
+from indicators import SeverityIndicator
 
-# inputs variables	
-#dirname= 'G:/0-phdstart/Code/trial/indicatorsNew/'
-#extension= '-indicatorsNew.csv'
-#indicatorsNames= {1:'Distance',2:'Cosine',3:'collision Course Angle',4:'Velocity Cosine',5:'Velocity Angle',6:'Speed Differential',7:'Collision Probability',8:'Severity Index',9:'TTC'}
-''' min Distance case'''
-dirname= 'G:/0-phdstart/Code/trial/minDistanceIndicator/'
-extension= '-minDistanceInd.csv'
-indicatorsNames= {1:'minDistance'}
 
-def loadNewInteractions(videoFilename,interactionType, roaduserNum1,roaduserNum2, selectedIndicators=[]):
+def loadNewInteractions(videoFilename,interactionType,dirname, extension, indicatorsNames, roaduserNum1,roaduserNum2, selectedIndicators=[]):
     '''Loads interactions from the POLY traffic event format'''
     from events import Interaction 
-    from indicators import SeverityIndicator
-    #filename= dirname + videoFilename + extension
-    filename= dirname + interactionType+ '-' + videoFilename + extension # case of min distance todo: change the saving format to be matched with all outputs
+    filename= dirname + videoFilename + extension
+    #filename= dirname + interactionType+ '-' + videoFilename + extension # case of min distance todo: change the saving format to be matched with all outputs
     file = utils.openCheck(filename)
     if (not file):
         return []
-    interactions = []
+    #interactions = []
     interactionNum = 0
     data= np.loadtxt(filename)
     indicatorFrameNums= data[:,0]
@@ -43,7 +35,9 @@
             values[t] = [data[i,index] for index in selectedIndicators]
         inter.addIndicator(SeverityIndicator('selectedIndicators', values))	
 		
-    interactions.append(inter)
+    #interactions.append(inter)
     file.close()
-    return interactions
+    #return interactions
+    return inter
 
+