phys2bids
phys2bids copied to clipboard
IndexError when slicing last run
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 :
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]
The end of the run becomes the last index of the timeserie.
Proposed Changes
slice4phys.pynow contains atry: ... except IndexErrorstatement.
Change Type
- [x]
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) - [ ]
other
Checklist before review
- [x] I added everything I wanted to add to this PR.
- [ ] [Code or tests only] I wrote/updated the necessary docstrings.
- [ ] [Code or tests only] I ran and passed tests locally.
- [ ] [Documentation only] I built the docs locally.
- [x] My contribution is harmonious with the rest of the code: I'm not introducing repetitions.
- [x] My code respects the adopted style, especially linting conventions.
- [x] The title of this PR is explanatory on its own, enough to be understood as part of a changelog.
- [x] I added or indicated the right labels.
- [ ] I added information regarding the timeline of completion for this PR.
- [ ] Please, comment on my PR while it's a draft and give me feedback on the development!
Codecov Report
Merging #415 (9073c65) into master (72ffc15) will not change coverage. The diff coverage is
n/a.
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
| Impacted Files | Coverage Δ | |
|---|---|---|
| phys2bids/slice4phys.py | 92.10% <ø> (ø) |
@sangfrois do you have a file that we can use to test this particular situation?
Hey @sangfrois! Could you pull from master, resolve conflicts, and push?
everything should be good to merge! Let me know if you need me to do anything more!