@@ -234,12 +234,11 @@ def extract_with_length(self, bounds):
234234 raise Exception ("One bounds must be positiv" )
235235 return self .__extract_with_mask (track_mask .repeat (self .nb_obs_by_track ))
236236
237- def loess_filter (self , window , xfield , yfield , inplace = True ):
237+ def loess_filter (self , half_window , xfield , yfield , inplace = True ):
238238 track = self .obs ["track" ]
239239 x = self .obs [xfield ]
240240 y = self .obs [yfield ]
241- window = window
242- result = track_loess_filter (window , x , y , track )
241+ result = track_loess_filter (half_window , x , y , track )
243242 if inplace :
244243 self .obs [yfield ] = result
245244
@@ -312,7 +311,7 @@ def compute_mask_from_id(tracks, first_index, number_of_obs, mask):
312311
313312
314313@njit (cache = True )
315- def track_loess_filter (window , x , y , track ):
314+ def track_loess_filter (half_window , x , y , track ):
316315 """
317316 Apply a loess filter on y field
318317 Args:
@@ -334,17 +333,17 @@ def track_loess_filter(window, x, y, track):
334333 if i != 0 :
335334 i_previous = i - 1
336335 dx = x [i ] - x [i_previous ]
337- while dx < window and i_previous != 0 and cur_track == track [i_previous ]:
338- w = (1 - (dx / window ) ** 3 ) ** 3
336+ while dx < half_window and i_previous != 0 and cur_track == track [i_previous ]:
337+ w = (1 - (dx / half_window ) ** 3 ) ** 3
339338 y_sum += y [i_previous ] * w
340339 w_sum += w
341340 i_previous -= 1
342341 dx = x [i ] - x [i_previous ]
343342 if i != last :
344343 i_next = i + 1
345344 dx = x [i_next ] - x [i ]
346- while dx < window and i_next != last and cur_track == track [i_next ]:
347- w = (1 - (dx / window ) ** 3 ) ** 3
345+ while dx < half_window and i_next != last and cur_track == track [i_next ]:
346+ w = (1 - (dx / half_window ) ** 3 ) ** 3
348347 y_sum += y [i_next ] * w
349348 w_sum += w
350349 i_next += 1
0 commit comments