Skip to content

Commit

Permalink
fix: wrong index when comparing;
Browse files Browse the repository at this point in the history
  • Loading branch information
WenjieDu committed Jun 17, 2024
1 parent d041eb2 commit 1f8d102
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pypots/data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ def sliding_window(time_series, window_len, sliding_len=None):
start_indices = np.asarray(range(total_len // sliding_len)) * sliding_len

# remove the last one if left length is not enough
if total_len - start_indices[-1] * sliding_len < window_len:
to_drop = math.ceil(window_len / sliding_len) - 1
if total_len - start_indices[-1] < window_len:
to_drop = math.ceil(window_len / sliding_len)
left_len = total_len - start_indices[-1]
start_indices = start_indices[:-to_drop]
logger.warning(
Expand Down

0 comments on commit 1f8d102

Please sign in to comment.