comparison python/storage.py @ 783:f1040d739bbf dev

added check to avoid issue if there are more cuvilinear trajectories than objects
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 02 Mar 2016 17:50:05 -0500
parents 1b22d81ef5ff
children 30bd0f2223b7
comparison
equal deleted inserted replaced
782:08f82be22816 783:f1040d739bbf
269 269
270 objNum = None 270 objNum = None
271 for row in cursor: 271 for row in cursor:
272 if objNum != row[0]: 272 if objNum != row[0]:
273 objNum = row[0] 273 objNum = row[0]
274 objects[objNum].curvilinearPositions = moving.CurvilinearTrajectory() 274 if objNum < len(objects):
275 objects[objNum].curvilinearPositions = moving.CurvilinearTrajectory()
276 else:
277 print('There are more curvilinear trajectories than objects')
278 break
275 objects[objNum].curvilinearPositions.addPositionSYL(row[2],row[3],row[4]) 279 objects[objNum].curvilinearPositions.addPositionSYL(row[2],row[3],row[4])
276 280
277 def saveTrajectoriesToSqlite(outputFilename, objects, trajectoryType, withFeatures = False): 281 def saveTrajectoriesToSqlite(outputFilename, objects, trajectoryType, withFeatures = False):
278 '''Writes features, ie the trajectories positions (and velocities if exist) 282 '''Writes features, ie the trajectories positions (and velocities if exist)
279 with their instants to a specified sqlite file 283 with their instants to a specified sqlite file