Mercurial Hosting > traffic-intelligence
view python/offset-trajectories.py @ 289:e56c34c1ebac
refactored and commented functions (saving data is now outside of the computation functions)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Tue, 29 Jan 2013 11:21:42 -0500 |
parents | 41a5853ec495 |
children |
line wrap: on
line source
#! /usr/bin/env python import sys import ubc_utils import utils if len(sys.argv) < 3: print("Usage: %s filename offsetframes") sys.exit() nFrames = int(sys.argv[2]) def modifyLines(objectNum, lines): result = lines tmp = lines[0].split(" ") firstInstant = int(tmp[1])+nFrames lastInstant = int(tmp[2])+nFrames tmp[1] = str(firstInstant) tmp[2] = str(lastInstant) result[0] = " ".join(tmp) return result ubc_utils.modifyTrajectoryFile(modifyLines, sys.argv[1], sys.argv[1]+".new")