While documenting the shape passed to fun for Epochs.apply_function (#13118), I noticed a behavioral asymmetry between Raw and Epochs that doesn’t appear to be documented anywhere.
When channel_wise=False:
- For Raw,
picksis applied. - For Epochs,
picksis silently ignored.
Example
import numpy as np, mne
data = np.random.randn(3, 4, 50)
info = mne.create_info(["ch0","ch1","ch2","ch3"], sfreq=100., ch_types="eeg")
epochs = mne.EpochsArray(data, info, verbose=False)
raw = mne.io.RawArray(np.random.randn(4, 150), info, verbose=False)
shapes = []
def spy(x):
shapes.append(x.shape); return x
epochs.copy().apply_function(spy, channel_wise=False, picks=["ch0"])
print("Epochs:", shapes) # [(3, 4, 50)] -> picks ignored
shapes.clear()
raw.copy().apply_function(spy, channel_wise=False, picks=["ch0"])
print("Raw: ", shapes) # [(1, 150)] -> picks applied