Mercurial > hg > nsaunier > traffic-intelligence
comparison trafficintelligence/tests/prediction.txt @ 1287:76f5693b530c
updated tests for numpy 2
| author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
|---|---|
| date | Sat, 20 Jul 2024 20:35:21 -0400 |
| parents | a095d4fbb2ea |
| children |
comparison
equal
deleted
inserted
replaced
| 1284:8e30c9a6ac6f | 1287:76f5693b530c |
|---|---|
| 24 >>> acceleration = lambda: random.uniform(-0.5,0.5) | 24 >>> acceleration = lambda: random.uniform(-0.5,0.5) |
| 25 >>> steering = lambda: random.uniform(-0.1,0.1) | 25 >>> steering = lambda: random.uniform(-0.1,0.1) |
| 26 >>> et = PredictedTrajectoryRandomControl(moving.Point(0,0),moving.Point(1,1), acceleration, steering, maxSpeed = 2) | 26 >>> et = PredictedTrajectoryRandomControl(moving.Point(0,0),moving.Point(1,1), acceleration, steering, maxSpeed = 2) |
| 27 >>> p = et.predictPosition(500) | 27 >>> p = et.predictPosition(500) |
| 28 >>> max(et.getPredictedSpeeds()) <= 2. | 28 >>> max(et.getPredictedSpeeds()) <= 2. |
| 29 True | 29 np.True_ |
| 30 | 30 |
| 31 >>> p = moving.Point(3,4) | 31 >>> p = moving.Point(3,4) |
| 32 >>> sp = SafetyPoint(p, 0.1, 0) | 32 >>> sp = SafetyPoint(p, 0.1, 0) |
| 33 >>> print(sp) | 33 >>> print(sp) |
| 34 3 4 0.1 0 | 34 3 4 0.1 0 |
| 51 | 51 |
| 52 >>> proto = storage.loadTrajectoriesFromSqlite('../samples/laurier.sqlite', 'feature', [1204])[0] | 52 >>> proto = storage.loadTrajectoriesFromSqlite('../samples/laurier.sqlite', 'feature', [1204])[0] |
| 53 >>> proto.getPositions().computeCumulativeDistances() | 53 >>> proto.getPositions().computeCumulativeDistances() |
| 54 >>> et = PredictedTrajectoryPrototype(proto.getPositionAt(10)+moving.Point(0.5, 0.5), proto.getVelocityAt(10)*0.9, proto, True) | 54 >>> et = PredictedTrajectoryPrototype(proto.getPositionAt(10)+moving.Point(0.5, 0.5), proto.getVelocityAt(10)*0.9, proto, True) |
| 55 >>> absolute(et.initialSpeed - proto.getVelocityAt(10).norm2()*0.9) < 1e-5 | 55 >>> absolute(et.initialSpeed - proto.getVelocityAt(10).norm2()*0.9) < 1e-5 |
| 56 True | 56 np.True_ |
| 57 >>> for t in range(int(proto.length())): x=et.predictPosition(t) | 57 >>> for t in range(int(proto.length())): x=et.predictPosition(t) |
| 58 >>> traj = et.getPredictedTrajectory() | 58 >>> traj = et.getPredictedTrajectory() |
| 59 >>> traj.computeCumulativeDistances() | 59 >>> traj.computeCumulativeDistances() |
| 60 >>> absolute(array(traj.distances).mean() - et.initialSpeed < 1e-3) | 60 >>> absolute(array(traj.distances).mean() - et.initialSpeed < 1e-3) |
| 61 True | 61 np.True_ |
| 62 | 62 |
| 63 >>> et = PredictedTrajectoryPrototype(proto.getPositionAt(10)+moving.Point(0.6, 0.6), proto.getVelocityAt(10)*0.7, proto, False) | 63 >>> et = PredictedTrajectoryPrototype(proto.getPositionAt(10)+moving.Point(0.6, 0.6), proto.getVelocityAt(10)*0.7, proto, False) |
| 64 >>> absolute(et.initialSpeed - proto.getVelocityAt(10).norm2()*0.7) < 1e-5 | 64 >>> absolute(et.initialSpeed - proto.getVelocityAt(10).norm2()*0.7) < 1e-5 |
| 65 True | 65 np.True_ |
| 66 >>> proto = moving.MovingObject.generate(1, moving.Point(-5.,0.), moving.Point(1.,0.), moving.TimeInterval(0,10)) | 66 >>> proto = moving.MovingObject.generate(1, moving.Point(-5.,0.), moving.Point(1.,0.), moving.TimeInterval(0,10)) |
| 67 >>> et = PredictedTrajectoryPrototype(proto.getPositionAt(0)+moving.Point(0., 1.), proto.getVelocityAt(0)*0.5, proto, False) | 67 >>> et = PredictedTrajectoryPrototype(proto.getPositionAt(0)+moving.Point(0., 1.), proto.getVelocityAt(0)*0.5, proto, False) |
| 68 >>> for t in range(int(proto.length()/0.5)): x=et.predictPosition(t) | 68 >>> for t in range(int(proto.length()/0.5)): x=et.predictPosition(t) |
| 69 >>> et.predictPosition(10) # doctest:+ELLIPSIS | 69 >>> et.predictPosition(10) # doctest:+ELLIPSIS |
| 70 (0.0...,1.0...) | 70 (0.0...,1.0...) |
