comparison python/tests/moving.txt @ 918:3a06007a4bb7

modularized save trajectories, added slice to Trajectory, etc
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Wed, 05 Jul 2017 12:19:59 -0400
parents e2452abba0e7
children d8ab183a7351
comparison
equal deleted inserted replaced
917:89cc05867c4c 918:3a06007a4bb7
169 >>> features = storage.loadTrajectoriesFromSqlite('../samples/laurier.sqlite', 'feature') 169 >>> features = storage.loadTrajectoriesFromSqlite('../samples/laurier.sqlite', 'feature')
170 >>> for o in objects: o.setFeatures(features) 170 >>> for o in objects: o.setFeatures(features)
171 >>> objects[0].hasFeatures() 171 >>> objects[0].hasFeatures()
172 True 172 True
173 173
174 >>> o1 = MovingObject.generate(Point(-5.,0.), Point(1.,0.), TimeInterval(0,10)) 174 >>> o1 = MovingObject.generate(1, Point(-5.,0.), Point(1.,0.), TimeInterval(0,10))
175 >>> o2 = MovingObject.generate(Point(0.,-5.), Point(0.,1.), TimeInterval(0,10)) 175 >>> o2 = MovingObject.generate(2, Point(0.,-5.), Point(0.,1.), TimeInterval(0,10))
176 >>> MovingObject.computePET(o1, o2, 0.1) 176 >>> MovingObject.computePET(o1, o2, 0.1)
177 (0.0, 5, 5) 177 (0.0, 5, 5)
178 >>> o2 = MovingObject.generate(Point(0.,-5.), Point(0.,1.), TimeInterval(5,15)) 178 >>> o2 = MovingObject.generate(2, Point(0.,-5.), Point(0.,1.), TimeInterval(5,15))
179 >>> MovingObject.computePET(o1, o2, 0.1) 179 >>> MovingObject.computePET(o1, o2, 0.1)
180 (5.0, 5, 10) 180 (5.0, 5, 10)
181 >>> o2 = MovingObject.generate(Point(0.,-5.), Point(0.,1.), TimeInterval(15,30)) 181 >>> o2 = MovingObject.generate(2, Point(0.,-5.), Point(0.,1.), TimeInterval(15,30))
182 >>> MovingObject.computePET(o1, o2, 0.1) 182 >>> MovingObject.computePET(o1, o2, 0.1)
183 (15.0, 5, 20) 183 (15.0, 5, 20)
184 184
185 >>> t = CurvilinearTrajectory(S = [1., 2., 3., 5.], Y = [0.5, 0.5, 0.6, 0.7], lanes = ['1']*4) 185 >>> t = CurvilinearTrajectory(S = [1., 2., 3., 5.], Y = [0.5, 0.5, 0.6, 0.7], lanes = ['1']*4)
186 >>> t.differentiate() # doctest:+ELLIPSIS 186 >>> t.differentiate() # doctest:+ELLIPSIS
189 [1.0, 0.0, '1'] [1.0, 0.099..., '1'] [2.0, 0.099..., '1'] [2.0, 0.099..., '1'] 189 [1.0, 0.0, '1'] [1.0, 0.099..., '1'] [2.0, 0.099..., '1'] [2.0, 0.099..., '1']
190 >>> t = CurvilinearTrajectory(S = [1.], Y = [0.5], lanes = ['1']) 190 >>> t = CurvilinearTrajectory(S = [1.], Y = [0.5], lanes = ['1'])
191 >>> t.differentiate().empty() 191 >>> t.differentiate().empty()
192 True 192 True
193 193
194 >>> o1 = MovingObject.generate(Point(0., 2.), Point(0., 1.), TimeInterval(0,2)) 194 >>> o1 = MovingObject.generate(1, Point(0., 2.), Point(0., 1.), TimeInterval(0,2))
195 >>> o1.classifyUserTypeSpeedMotorized(0.5, np.median) 195 >>> o1.classifyUserTypeSpeedMotorized(0.5, np.median)
196 >>> userTypeNames[o1.getUserType()] 196 >>> userTypeNames[o1.getUserType()]
197 'car' 197 'car'
198 >>> o1.classifyUserTypeSpeedMotorized(1.5, np.median) 198 >>> o1.classifyUserTypeSpeedMotorized(1.5, np.median)
199 >>> userTypeNames[o1.getUserType()] 199 >>> userTypeNames[o1.getUserType()]
200 'pedestrian' 200 'pedestrian'
201 201
202 >>> o1 = MovingObject.generate(Point(0.,0.), Point(1.,0.), TimeInterval(0,10)) 202 >>> o1 = MovingObject.generate(1, Point(0.,0.), Point(1.,0.), TimeInterval(0,10))
203 >>> gt1 = BBMovingObject(1, TimeInterval(0,10), MovingObject.generate(Point(0.2,0.6), Point(1.,0.), TimeInterval(0,10)), MovingObject.generate(Point(-0.2,-0.4), Point(1.,0.), TimeInterval(0,10))) 203 >>> gt1 = BBMovingObject(1, TimeInterval(0,10), MovingObject.generate(1, Point(0.2,0.6), Point(1.,0.), TimeInterval(0,10)), MovingObject.generate(2, Point(-0.2,-0.4), Point(1.,0.), TimeInterval(0,10)))
204 >>> gt1.computeCentroidTrajectory() 204 >>> gt1.computeCentroidTrajectory()
205 >>> computeClearMOT([gt1], [], 0.2, 0, 10) 205 >>> computeClearMOT([gt1], [], 0.2, 0, 10)
206 (None, 0.0, 11, 0, 0, 11) 206 (None, 0.0, 11, 0, 0, 11)
207 >>> computeClearMOT([], [o1], 0.2, 0, 10) 207 >>> computeClearMOT([], [o1], 0.2, 0, 10)
208 (None, None, 0, 0, 11, 0) 208 (None, None, 0, 0, 11, 0)