Skip to content

Commit

Permalink
throw error if it is not a numpy array
Browse files Browse the repository at this point in the history
  • Loading branch information
livhe committed Jan 29, 2024
1 parent eb9da7b commit 73fc1ec
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions gaitmap/utils/array_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,10 @@ def bool_array_to_start_end_array(bool_array: np.ndarray) -> np.ndarray:
array([1, 1])
"""
# check if input is a Series. For a Series, start and end will just be the first and last index
if isinstance(bool_array, pd.Series):
# check if input is a numpy array. E.g. for a Series, start and end will just be the first and last index.
if not isinstance(bool_array, np.ndarray):
raise TypeError(
"Input must be boolean array! You provided a pandas Series."
"You can convert it to a numpy array with .values"
f"Input must be a numpy array!"
)

# check if input is actually a boolean array
Expand Down

0 comments on commit 73fc1ec

Please sign in to comment.