view python/offset-trajectories.py @ 211:ada6e8fbe4c6

2 Changes : 1) Modified storage.py to read prototype and matching trajectory indexes from db 2) Modified moving.py to give draw function **kwargs option (to matplotlib.plot)
author Francois Belisle <belisle.francois@gmail.com>
date Wed, 06 Jun 2012 13:24:04 -0400
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")