IndexError when slicing last run#415
Merged
smoia merged 9 commits intophysiopy:masterfrom Dec 12, 2022
Merged
Conversation
smoia
approved these changes
Nov 22, 2021
Member
smoia
left a comment
There was a problem hiding this comment.
LGTM (let's wait for the tests)!
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #415 +/- ##
=======================================
Coverage 94.42% 94.42%
=======================================
Files 8 8
Lines 879 879
=======================================
Hits 830 830
Misses 49 49
|
Member
|
@sangfrois do you have a file that we can use to test this particular situation? |
smoia
requested changes
Nov 22, 2021
phys2bids/slice4phys.py
Outdated
| try: | ||
| run_end = int(np.where(phys_in.timeseries[0] > end_sec)[0][0] + padding) | ||
| except IndexError: | ||
| run_end = phys_in.timeseries[0].shape[0] |
Member
There was a problem hiding this comment.
@sangfrois , could you add a warning here, something on the line:
LGR.warning('Some message that says that the file does not have enough timepoints hence the shape was used instead')
Member
|
Hey @sangfrois! Could you pull from master, resolve conflicts, and push? |
Member
Author
|
everything should be good to merge! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Workflow crashes when the last recorded run doesn't have enough signal at the end. This is caused by the padding added at the end of the run.
A simple fix for that error was to deal with the exception.
Like this :
The end of the run becomes the last index of the timeserie.
Proposed Changes
slice4phys.pynow contains atry: ... except IndexErrorstatement.Change Type
bugfix(+0.0.1)minor(+0.1.0)major(+1.0.0)refactoring(no version update)test(no version update)infrastructure(no version update)documentation(no version update)otherChecklist before review