actually use GFP for EEG channels in plot_compare_evokeds#12410
actually use GFP for EEG channels in plot_compare_evokeds#12410drammock merged 7 commits intomne-tools:mainfrom
Conversation
drammock
left a comment
There was a problem hiding this comment.
left some comments to hopefully speed up review
| def _identity_function(x): | ||
| return x | ||
|
|
||
|
|
There was a problem hiding this comment.
this was moved because it is general-purpose and now used outside of this file
| @pytest.mark.parametrize( | ||
| "combine,vlines,title,picks", | ||
| ( | ||
| pytest.param(None, [0.1, 0.2], "MEG 0113", "MEG 0113", id="singlepick"), | ||
| pytest.param("mean", [], "(mean)", "mag", id="mag-mean"), | ||
| pytest.param("gfp", "auto", "(GFP)", "eeg", id="eeg-gfp"), | ||
| pytest.param(None, "auto", "(RMS)", ["MEG 0113", "MEG 0112"], id="meg-rms"), | ||
| pytest.param( | ||
| "std", "auto", "(std. dev.)", ["MEG 0113", "MEG 0112"], id="meg-std" | ||
| ), | ||
| pytest.param( | ||
| lambda x: np.min(x, axis=1), "auto", "MEG 0112", [0, 1], id="intpicks" | ||
| ), | ||
| ), | ||
| ) | ||
| def test_plot_compare_evokeds_title(evoked, picks, vlines, combine, title): | ||
| """Test title generation by plot_compare_evokeds().""" | ||
| # test picks, combine, and vlines (1-channel pick also shows sensor inset) | ||
| fig = plot_compare_evokeds(evoked, picks=picks, vlines=vlines, combine=combine) | ||
| assert fig[0].axes[0].get_title().endswith(title) |
There was a problem hiding this comment.
this test is just a portion extracted from the following test, to make the params easier to follow. One new param was added (eeg-gfp) and one expected title value changes (meg-rms will now say "(RMS)" instead of "(GFP)")
| # marginal median that is safe for complex values: | ||
| if "median" in valid: | ||
| combine_dict["median"] = partial(_median_complex, axis=axis) |
There was a problem hiding this comment.
the switch to marginal median isn't strictly necessary for this PR but will be for #11282; easier to just add it now.
| axis=1, | ||
| valid=("mean", "median", "std", "gfp"), | ||
| ch_type=None, | ||
| keepdims=False, |
There was a problem hiding this comment.
addition of axis, valid, and keepdims are to make this function useful for TFRs (#11282)
larsoner
left a comment
There was a problem hiding this comment.
Approved pending addressing of @hoechenberger's comments, feel free to mark for merge-when-green when you do @drammock
…12410) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
fixes #9022