Skip to content

Commit

Permalink
Add check for length of input in preprocess_bout (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeEfstathiadis authored Dec 14, 2023
1 parent c51f7d5 commit 1e54660
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions forest/oak/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ def preprocess_bout(t_bout: np.ndarray, x_bout: np.ndarray, y_bout: np.ndarray,
- t_bout_interp: resampled timestamp (in Unix)
- vm_bout_interp: vector magnitude of acceleration
"""

if (
len(t_bout) < 2 or len(x_bout) < 2 or
len(y_bout) < 2 or len(z_bout) < 2
):
return np.array([]), np.array([])

t_bout_interp = t_bout - t_bout[0]
t_bout_interp = np.arange(t_bout_interp[0], t_bout_interp[-1], (1/fs))
t_bout_interp = t_bout_interp + t_bout[0]
Expand Down

0 comments on commit 1e54660

Please sign in to comment.