# HG changeset patch # User Nicolas Saunier # Date 1431638324 -7200 # Node ID 784298512b60836f6ebd38a495bd45b487ae4a26 # Parent 6668f541b91591f58eb55515443bf61020d190eb minor modifications diff -r 6668f541b915 -r 784298512b60 python/moving.py --- a/python/moving.py Thu May 14 19:48:09 2015 +0200 +++ b/python/moving.py Thu May 14 23:18:44 2015 +0200 @@ -389,14 +389,16 @@ def getSYfromXY(p, splines, goodEnoughSplineDistance = 0.5): ''' Snap a point p to it's nearest subsegment of it's nearest spline (from the list splines). A spline is a list of points (class Point), most likely a trajectory. - Output: - ======= - [spline index, - subsegment leading point index, - snapped point, - subsegment distance, - spline distance, - orthogonal point offset] + Output: + ======= + [spline index, + subsegment leading point index, + snapped point, + subsegment distance, + spline distance, + orthogonal point offset] + + or None ''' minOffsetY = float('inf') #For each spline diff -r 6668f541b915 -r 784298512b60 python/utils.py --- a/python/utils.py Thu May 14 19:48:09 2015 +0200 +++ b/python/utils.py Thu May 14 23:18:44 2015 +0200 @@ -253,12 +253,11 @@ ''' Return a list of categories/values smoothed according to a window. halfWidth is the search radius on either side''' from copy import deepcopy - catgories = deepcopy(cat_list) - smoothed = catgories - for point in range(len(catgories)): + smoothed = deepcopy(cat_list) + for point in range(len(cat_list)): lower_bound_check = max(0,point-halfWidth) - upper_bound_check = min(len(catgories)-1,point+halfWidth+1) - window_values = catgories[lower_bound_check:upper_bound_check] + upper_bound_check = min(len(cat_list)-1,point+halfWidth+1) + window_values = cat_list[lower_bound_check:upper_bound_check] smoothed[point] = max(set(window_values), key=window_values.count) return smoothed