-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix mne.io.BaserRAW duration calculation
The duration calculation, used in `BaseRAW._html_repr_()` and `BaseRAW.__repr__()`, was taking the timestamp of the last sample as the duration of the acquisition, but was not accounting for the length of the last sample. Also, added tests for the refactored `BaseRAW.duration` property and `BaseRAW._get_duration()` method, and used a sfreq value that revealed the discrepancy in the duration calculation in the `BaseRAW.__repr__()` method. Finally, simplified the duration string calculation for the html display by rounding up all the duration seconds, not just the remainder after hour and minute calculations, thereby avoiding "00:01:60" calculations, which should have been "00:02:00", when there are fractions of a second remaining. Fixes: #12954
- Loading branch information
1 parent
cb597f8
commit 58a9d38
Showing
3 changed files
with
39 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix duration calculation for the textual (``__repr__``) and html (``_repr_html_``, used by e.g. Jupyter) display of :class:`mne.io.BaseRAW` instances. For ex. a duration of 1h is now displayed as ``00:01:00`` rather than ``00:59:60``. By :newcontrib:`Leonardo Rochael Almeida`. |
This file contains 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
This file contains 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