Mercurial Hosting > traffic-intelligence
diff trafficintelligence/ubc_utils.py @ 1030:aafbc0bab925
moved method around to avoid cross-dependencies
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 19 Jun 2018 10:04:52 -0400 |
parents | cc5cb04b04b0 |
children | e23828659a66 |
line wrap: on
line diff
--- a/trafficintelligence/ubc_utils.py Mon Jun 18 22:50:59 2018 -0400 +++ b/trafficintelligence/ubc_utils.py Tue Jun 19 10:04:52 2018 -0400 @@ -57,8 +57,8 @@ by just copying the corresponding trajectory and velocity data from the inFilename, and saving the characteristics in objects (first line) into outFilename''' - infile = storage.openCheck(inFilename) - outfile = storage.openCheck(outFilename,'w') + infile = utils.openCheck(inFilename) + outfile = utils.openCheck(outFilename,'w') if (inFilename.find('features') >= 0) or (not infile) or (not outfile): return @@ -86,8 +86,8 @@ def modifyTrajectoryFile(modifyLines, filenameIn, filenameOut): '''Reads filenameIn, replaces the lines with the result of modifyLines and writes the result in filenameOut''' - fileIn = storage.openCheck(filenameIn, 'r', True) - fileOut = storage.openCheck(filenameOut, "w", True) + fileIn = utils.openCheck(filenameIn, 'r', True) + fileOut = utils.openCheck(filenameOut, "w", True) lines = storage.getLines(fileIn) trajNum = 0 @@ -106,8 +106,8 @@ def copyTrajectoryFile(keepTrajectory, filenameIn, filenameOut): '''Reads filenameIn, keeps the trajectories for which the function keepTrajectory(trajNum, lines) is True and writes the result in filenameOut''' - fileIn = storage.openCheck(filenameIn, 'r', True) - fileOut = storage.openCheck(filenameOut, "w", True) + fileIn = utils.openCheck(filenameIn, 'r', True) + fileOut = utils.openCheck(filenameOut, "w", True) lines = storage.getLines(fileIn) trajNum = 0 @@ -125,7 +125,7 @@ def loadTrajectories(filename, nObjects = -1): '''Loads trajectories''' - file = storage.openCheck(filename) + file = utils.openCheck(filename) if (not file): return [] @@ -177,7 +177,7 @@ 'Loads interactions from the old UBC traffic event format' from events import Interaction from indicators import SeverityIndicator - file = storage.openCheck(filename) + file = utils.openCheck(filename) if (not file): return [] @@ -206,7 +206,7 @@ def loadCollisionPoints(filename, nPoints = -1): '''Loads collision points and returns a dict with keys as a pair of the numbers of the two interacting objects''' - file = storage.openCheck(filename) + file = utils.openCheck(filename) if (not file): return []