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
Inconsistent behavior between Epochs
and Evoked
in get_data()
method when picking EEG channels and bads are present
#12577
Comments
The docstrings are identical, so I think both methods should behave identically. In addition, the docstring says:
I think this should be:
At least that's how it currently works for https://mne.tools/dev/generated/mne.Epochs.html#mne.Epochs.get_data |
@cbrnr Note that I did not pass The doctoring says:
So something about this point is inconsistent between epochs and evoked at least when passing I think what you're mentioning here is being tracked at #12197 |
Epochs
and Evoked
in get_data()
methodEpochs
and Evoked
in get_data()
method when picking
Epochs
and Evoked
in get_data()
method when pickingEpochs
and Evoked
in get_data()
method when picking EEG channels
Epochs
and Evoked
in get_data()
method when picking EEG channelsEpochs
and Evoked
in get_data()
method when picking EEG channels and bads are present
Neither |
Even if documented I think it would be a bit surprising if |
I tested the MWE with Raw and now it seems it's actually Epochs who's the odd one: # %%
import mne
sample_dir = mne.datasets.sample.data_path()
sample_fname = sample_dir / "MEG" / "sample" / "sample_audvis_raw.fif"
raw = mne.io.read_raw_fif(sample_fname)
raw.crop(tmax=60)
events = mne.find_events(raw, stim_channel="STI 014")
raw.pick("eeg")
epochs = mne.Epochs(raw, events=events, preload=True)
evoked = epochs.average()
# %%
for inst_type, inst in zip(["raw", "epochs", "evoked"], [raw, epochs, evoked]):
print(f"{inst_type}:")
print(f" bads: {inst.info['bads']}")
print(f" data shape: {inst.get_data(picks='eeg').shape}") raw:
bads: ['EEG 053']
data shape: (60, 36038)
epochs:
bads: ['EEG 053']
data shape: (86, 59, 421)
evoked:
bads: ['EEG 053']
data shape: (60, 421) |
More digging:
|
My feeling is that we should add |
Description of the problem
Epochs.get_data(picks="eeg")
excludes bad channels, butEvoked.get_data(picks="eeg")
doesn'tSteps to reproduce
Link to data
No response
Expected results
Both methods should behave the same in regards to bad channel treatment.
Actual results
As you can see, the data from
Evoked
contains the bad channel, while the data fromEpochs
does not.Additional information
This is with
main
The text was updated successfully, but these errors were encountered: