diff python/utils.py @ 659:784298512b60

minor modifications
author Nicolas Saunier <nicolas.saunier@polymtl.ca>
date Thu, 14 May 2015 23:18:44 +0200
parents c9a0b72979fd
children 15e244d2a1b5
line wrap: on
line diff
--- 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