comparison trafficintelligence/utils.py @ 1086:8734742c08c0

major refactoring of curvilinear trajectory projections
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Tue, 16 Oct 2018 12:46:29 -0400
parents c04550f957ab
children 0680387a89bb
comparison
equal deleted inserted replaced
1085:7853106677b7 1086:8734742c08c0
382 return sqrt((x2-x1)**2+(y2-y1)**2) 382 return sqrt((x2-x1)**2+(y2-y1)**2)
383 383
384 def crossProduct(l1, l2): 384 def crossProduct(l1, l2):
385 return l1[0]*l2[1]-l1[1]*l2[0] 385 return l1[0]*l2[1]-l1[1]*l2[0]
386 386
387 def cat_mvgavg(cat_list, halfWidth): 387 def filterCategoricalMovingWindow(cat_list, halfWidth):
388 ''' Return a list of categories/values smoothed according to a window. 388 ''' Return a list of categories/values smoothed according to a window.
389 halfWidth is the search radius on either side''' 389 halfWidth is the search radius on either side'''
390 smoothed = deepcopy(cat_list) 390 smoothed = deepcopy(cat_list)
391 for point in range(len(cat_list)): 391 for point in range(len(cat_list)):
392 lower_bound_check = max(0,point-halfWidth) 392 lower_bound_check = max(0,point-halfWidth)