diff python/traffic_engineering.py @ 665:15e244d2a1b5

corrected bug with circular import for VideoFilenameAddable, moved to base module
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 20 May 2015 13:57:47 +0200
parents 3b13ec964476
children 3666342dabe2
line wrap: on
line diff
--- a/python/traffic_engineering.py	Wed May 20 12:04:22 2015 +0200
+++ b/python/traffic_engineering.py	Wed May 20 13:57:47 2015 +0200
@@ -1,11 +1,9 @@
 #! /usr/bin/env python
 ''' Traffic Engineering Tools and Examples'''
 
-from math import ceil
-
 import prediction
 
-__metaclass__ = type
+from math import ceil
 
 
 #########################
@@ -26,7 +24,7 @@
         totalTime += h
     return headways
 
-class RoadUser:
+class RoadUser(object):
     '''Simple example of inheritance to plot different road users '''
     def __init__(self, position, velocity):
         'Both fields are 2D numpy arrays'
@@ -61,7 +59,7 @@
 # fundamental diagram
 #########################
 
-class FundamentalDiagram:
+class FundamentalDiagram(object):
     ''' '''
     def __init__(self, name):
         self.name = name
@@ -119,7 +117,7 @@
 # intersection
 #########################
 
-class FourWayIntersection:
+class FourWayIntersection(object):
     '''Simple class for simple intersection outline'''
     def __init__(self, dimension, coordX, coordY):
         self.dimension = dimension
@@ -144,7 +142,7 @@
 # traffic signals
 #########################
 
-class Volume:
+class Volume(object):
     '''Class to represent volumes with varied vehicule types '''
     def __init__(self, volume, types = ['pc'], proportions = [1], equivalents = [1], nLanes = 1):
         '''mvtEquivalent is the equivalent if the movement is right of left turn'''
@@ -172,7 +170,7 @@
             v += p*e
         return v*self.volume
 
-class IntersectionMovement:
+class IntersectionMovement(object):
     '''Represents an intersection movement
     with a volume, a type (through, left or right)
     and an equivalent for movement type'''
@@ -183,7 +181,7 @@
     def getTVUVolume(self):
         return self.mvtEquivalent*self.volume.getPCUVolume()    
 
-class LaneGroup:
+class LaneGroup(object):
     '''Class that represents a group of mouvements'''
 
     def __init__(self, movements, nLanes):
@@ -203,7 +201,7 @@
     'degree of saturation can be used as the peak hour factor too'
     return lostTime/(1-criticalCharge/degreeSaturation)
 
-class Cycle:
+class Cycle(object):
     '''Class to compute optimal cycle and the split of effective green times'''
     def __init__(self, phases, lostTime, saturationVolume):
         '''phases is a list of phases