MRG, FIX: make labels in epochs.plot start at 0, fixes issue #7260#7299
MRG, FIX: make labels in epochs.plot start at 0, fixes issue #7260#7299larsoner merged 6 commits intomne-tools:masterfrom
Conversation
| ax.set_xticks(ticks) | ||
| ax2.set_xticks(ticks[:n_epochs]) | ||
| labels = list(range(1, len(ticks) + 1)) # epoch numbers | ||
| labels = list(range(0, len(ticks))) # epoch numbers |
There was a problem hiding this comment.
This can be simplified to list(range(len(ticks))) :) But probably a matter of taste!
Codecov Report
@@ Coverage Diff @@
## master #7299 +/- ##
==========================================
- Coverage 89.82% 88.94% -0.88%
==========================================
Files 447 447
Lines 80694 80856 +162
Branches 12876 12908 +32
==========================================
- Hits 72482 71918 -564
- Misses 5385 6145 +760
+ Partials 2827 2793 -34 |
mne/epochs.py
Outdated
| logger.info('Dropped %d epoch%s: %s' % (count, _pl(count), | ||
| np.array2string(np.sort(try_idx), | ||
| precision=0, | ||
| separator=','))) |
There was a problem hiding this comment.
@hoechenberger: how about this part (formatting and array to string) – is there a more efficient way to do it?
There was a problem hiding this comment.
I would have done:
', '.join(map(str, np.sort(try_idx))
rather than np. array2string
There was a problem hiding this comment.
I've never used array2string and I don't really like map, so my approach would've been based on a list comprehension:
', '.join([str(i) for i in np.sort(try_idx)])But that's not really shorter nor easier to read than your array2string approach, so…
|
I will need help with fixing those tests. no idea what they want. |
agramfort
left a comment
There was a problem hiding this comment.
also don't forget to update latest.inc file @SophieHerbst
thanks!
mne/epochs.py
Outdated
| logger.info('Dropped %d epoch%s: %s' % (count, _pl(count), | ||
| np.array2string(np.sort(try_idx), | ||
| precision=0, | ||
| separator=','))) |
There was a problem hiding this comment.
I would have done:
', '.join(map(str, np.sort(try_idx))
rather than np. array2string
|
@agramfort I don't know what an .inc file is, nor where to find it. |
| fig = epochs.plot(scalings=None, title='Epochs') | ||
| ticks = [x.get_text() for x in fig.axes[0].get_xticklabels()] | ||
| assert ticks == ['1'] | ||
| assert ticks == ['0'] |
There was a problem hiding this comment.
@agramfort is this correct? I don't fully understand what it should do, but it broke the circle-ci.
|
@SophieHerbst You will want to add youself to (but you may also insert a link to a personal website instead of your GitHub profile if you prefer) I suppose this will fix Circle |
|
Done, thanks @hoechenberger! |
|
Thanks @SophieHerbst ! |
…s#7260 (mne-tools#7299) * make labels in epochs.plot start at 0 * try to fix error in test_epochs_plot * change array to string formatting * edit latest.inc * add name * correct update latest.inc
…s#7260 (mne-tools#7299) * make labels in epochs.plot start at 0 * try to fix error in test_epochs_plot * change array to string formatting * edit latest.inc * add name * correct update latest.inc
Makes epochs.plot() start at 0 instead of 1 (issue #7260).
Note: a bug with spyder (#6528) prevents me from testing what happens after closing the interactive plot. I checked that the indices returned for manually selected epochs start with 0, too.
Closes #7260