Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for the bool_array_to_start_end_array function #57

Merged
merged 5 commits into from
Jan 30, 2024

Conversation

livhe
Copy link
Collaborator

@livhe livhe commented Jan 29, 2024

The function does now check if a Series is supplied instead of a numpy array and throws an Error. It used to return just the first and last index for a Series.

Also, I think the statement "The end index is inclusive!" from the docs was misleading, because it sounds like the end index is pointing to the last element that is included in the True-region, but it points to the first False element.

@livhe livhe requested a review from AKuederle January 29, 2024 14:17
@AKuederle
Copy link
Member

Great! Can you invert the check? At the moment, it would only throw if users accidantly provide a series. But there are likely dozent other datatypes that would result in unexpected behaviour.

So I would suggest we check if something is a numpy array and if not throw, independent of the actual datatype. Keep in mind that isinstance checks for numpy arrays must be made against np.ndarray not np.array

@codecov-commenter
Copy link

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (4683032) 91.57% compared to head (eb9da7b) 91.55%.

Files Patch % Lines
gaitmap/utils/array_handling.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #57      +/-   ##
==========================================
- Coverage   91.57%   91.55%   -0.02%     
==========================================
  Files          85       85              
  Lines        4795     4798       +3     
==========================================
+ Hits         4391     4393       +2     
- Misses        404      405       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@AKuederle AKuederle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment in the PR thread :)

@AKuederle AKuederle merged commit 8510fe0 into master Jan 30, 2024
9 checks passed
@AKuederle AKuederle deleted the bool_array_to_start_end_fix branch February 28, 2024 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants