New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix lingering topomap api #11371
Fix lingering topomap api #11371
Conversation
Looks reasonable so far! |
apparently sometime today GitHub actions deprecated the 18.04 ubuntu image, so our
That aside, there is one difference between this PR and I think that it's actually correct on this PR and was incorrect on import numpy as np
import mne
from mne.preprocessing import (ICA, create_eog_epochs, create_ecg_epochs,
corrmap)
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = (sample_data_folder / 'MEG' / 'sample' /
'sample_audvis_filt-0-40_raw.fif')
raw = mne.io.read_raw_fif(sample_data_raw_file)
raw.crop(tmax=60.).pick_types(meg='mag', eeg=True, stim=True, eog=True)
raw.load_data()
filt_raw = raw.copy().filter(l_freq=1., h_freq=None)
ica = ICA(n_components=15, max_iter='auto', random_state=97)
ica.fit(filt_raw)
picks = np.arange(15)
data = np.dot(ica.mixing_matrix_[:, picks].T,
ica.pca_components_[:ica.n_components_])
print(data[1].min(), data[1].max())
# -0.016085387042690098 0.8193667881245026 notice that the data for that component straddles zero, and so should have some (dark) red and some (not very dark) blue, but on |
Agreed this looks like a bug fix |
Failure looks real:
@drammock feel free to fix, I've marked as merge-when-green. Then hopefully we can release! |
OK so here's what's going on with
Proposed solution: keep it like current main (each map gets its own vmin/vmax, and all the colormaps are forced to be symmetrical about zero even if their data is all-positive). I think it makes sense given the nature of the ICA decomposition: all components are at least potentially both positive and negative (unlike some topomap data like field power) so forcing symmetric vlims onto one-sided data actually makes sense here. Also it appears to have been this way since 0.22 at least, so it won't surprise anyone. Ultimately I'd |
Sounds good to me, feel free to mark for merge when your plan has been implemented @drammock unless you want me to take another look |
it's already implemented :) but now that compat/old is actually running, it's revealed a new test failure (I'm guessing due to old MPL API). I'll fix it shortly. |
closes #11368
Highlights:
CSP.plot_patterns()
,CSP.plot_filters()
,ICA.plot_components()
andplot_ica_components()
to standardize their API with other topomap-plotting functions/methods (follow-up to Standardize topomap args #11123)extrapolate, border, cnorm, axes, nrows, ncols
. For the ICA-components func/meth, they also gainedshow_names, size, cbar_fmt
.title
parameter because we were actually setting a default title even whentitle=None