Mercurial Hosting > traffic-intelligence
comparison python/tests/prediction.txt @ 998:933670761a57
updated code to python 3 (tests pass and scripts run, but non-executed parts of code are probably still not correct)
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Sun, 27 May 2018 23:22:48 -0400 |
parents | 05d4302bf67e |
children |
comparison
equal
deleted
inserted
replaced
997:4f3387a242a1 | 998:933670761a57 |
---|---|
49 >>> proto = storage.loadTrajectoriesFromSqlite('../samples/laurier.sqlite', 'feature', [1204])[0] | 49 >>> proto = storage.loadTrajectoriesFromSqlite('../samples/laurier.sqlite', 'feature', [1204])[0] |
50 >>> proto.getPositions().computeCumulativeDistances() | 50 >>> proto.getPositions().computeCumulativeDistances() |
51 >>> et = PredictedTrajectoryPrototype(proto.getPositionAt(10)+moving.Point(0.5, 0.5), proto.getVelocityAt(10)*0.9, proto, True) | 51 >>> et = PredictedTrajectoryPrototype(proto.getPositionAt(10)+moving.Point(0.5, 0.5), proto.getVelocityAt(10)*0.9, proto, True) |
52 >>> absolute(et.initialSpeed - proto.getVelocityAt(10).norm2()*0.9) < 1e-5 | 52 >>> absolute(et.initialSpeed - proto.getVelocityAt(10).norm2()*0.9) < 1e-5 |
53 True | 53 True |
54 >>> for t in xrange(int(proto.length())): x=et.predictPosition(t) | 54 >>> for t in range(int(proto.length())): x=et.predictPosition(t) |
55 >>> traj = et.getPredictedTrajectory() | 55 >>> traj = et.getPredictedTrajectory() |
56 >>> traj.computeCumulativeDistances() | 56 >>> traj.computeCumulativeDistances() |
57 >>> absolute(array(traj.distances).mean() - et.initialSpeed < 1e-3) | 57 >>> absolute(array(traj.distances).mean() - et.initialSpeed < 1e-3) |
58 True | 58 True |
59 | 59 |
60 >>> et = PredictedTrajectoryPrototype(proto.getPositionAt(10)+moving.Point(0.6, 0.6), proto.getVelocityAt(10)*0.7, proto, False) | 60 >>> et = PredictedTrajectoryPrototype(proto.getPositionAt(10)+moving.Point(0.6, 0.6), proto.getVelocityAt(10)*0.7, proto, False) |
61 >>> absolute(et.initialSpeed - proto.getVelocityAt(10).norm2()*0.7) < 1e-5 | 61 >>> absolute(et.initialSpeed - proto.getVelocityAt(10).norm2()*0.7) < 1e-5 |
62 True | 62 True |
63 >>> proto = moving.MovingObject.generate(1, moving.Point(-5.,0.), moving.Point(1.,0.), moving.TimeInterval(0,10)) | 63 >>> proto = moving.MovingObject.generate(1, moving.Point(-5.,0.), moving.Point(1.,0.), moving.TimeInterval(0,10)) |
64 >>> et = PredictedTrajectoryPrototype(proto.getPositionAt(0)+moving.Point(0., 1.), proto.getVelocityAt(0)*0.5, proto, False) | 64 >>> et = PredictedTrajectoryPrototype(proto.getPositionAt(0)+moving.Point(0., 1.), proto.getVelocityAt(0)*0.5, proto, False) |
65 >>> for t in xrange(int(proto.length()/0.5)): x=et.predictPosition(t) | 65 >>> for t in range(int(proto.length()/0.5)): x=et.predictPosition(t) |
66 >>> et.predictPosition(10) # doctest:+ELLIPSIS | 66 >>> et.predictPosition(10) # doctest:+ELLIPSIS |
67 (0.0...,1.0...) | 67 (0.0...,1.0...) |
68 >>> et.predictPosition(12) # doctest:+ELLIPSIS | 68 >>> et.predictPosition(12) # doctest:+ELLIPSIS |
69 (1.0...,1.0...) | 69 (1.0...,1.0...) |
70 | 70 |