Repository navigation
MRG ENH/ BUG Update how ylim parameter is calculated in plot_evoked_topo - #9285
Conversation
|
Also, I can work on/modify these approaches for other methods if they are better suited! |
|
Looks fair to me. Can you set the PR to For MAD approach, I would have tried k.MAD as suggested here. MAD is just so you get a robust estimate of the standard deviation. Then you can apply your 3 sigma rule to get the 99.7 percentile. So MAD * 3 * 0.67449 = 2 * MAD. Otherwise, you get those crazy high values like in your plots. Anyhow we probably don't need that amount of sophistication |
|
@jasmainak let me know if you're happy and I'll take a look and merge for 0.23 |
| # find maxima over all evoked data for each channel pick | ||
| ymaxes = np.array([max(np.abs(e.data[t]).max() for e in evoked) | ||
| # find minima and maxima over all evoked data for each channel pick | ||
| ymaxes = np.array([max((e.data[t]).max() for e in evoked) |
There was a problem hiding this comment.
do you need this list comprehension now? Can't you simply do:
ymaxes = evoked.data.max(axis=1)There was a problem hiding this comment.
I think we still need the list comprehension in the case of two-channel types being plotted (like mag and grad). Otherwise, this would be better.
|
tiny nitpick, otherwise good by me |
|
Also that CI fail seems to be unrelated. |
|
+1 for MRG |
|
I think that by default Maybe have |
The default before this PR was to calculate ylims for each channel type based on the absolute maxima of the maxima of each channel. The current PR only changes it calculate ylims for each channel type based on the maximum and minimum across each channel in the specific type. So The only 2-channel type plots being currently allowed are (MAG|GRAD) and (HBO|HBR) and in those two cases, I think it might still be useful to set calculate ylim individually for each channel type. From my testing, we don't allow mixes of 2-channel type plots such as EEG and MAG or HBO and GRAD. |
larsoner
left a comment
There was a problem hiding this comment.
Oh sorry I misunderstood, I thought it was ylims for each channel independently rather than each channel type independently. LGTM!
|
Thanks @ramkpari ! |




Reference issue
Fixes #8714.
What does this implement/fix?
Changes the way
plot_evoked_topocalculates ylims when the input param forylim=None. The current way uses an absolute maxima method to calculate the ylim, while the proposed PR uses a maximum/minimum approach to calculate ylim. The MinMax approach was chosen as it seemed to be consistent with the rest of the codebase while still improving the plot.Other approaches tried were 99.5 percentile and MAD approach which is detailed further along.
Additional information
Using the following code snippet for the plots below.
Current PR approach (MinMax), All Channels

Current PR approach (MinMax), Good Channels

Current Main branch(AbsMax),All Channels

Current Main branch(AbsMax), Good Channels

Raw data for the ylims being used in the above plots