Open apmellot opened 6 months ago
Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴
@antoinecollas @agramfort
I think this can be tackled at the same time and using hopefully the same API as https://github.com/mne-tools/mne-python/issues/9609, can you check?
... specifically this proposal:
https://github.com/mne-tools/mne-python/issues/9609#issuecomment-901203391
+1 for interpolate_to method next to interpolate_bads
+1, this would be a cool feature
Describe the new feature or enhancement
I have recently been working with datasets with diverse montages and wanted to make them comparable by ensuring a consistent number and position of channels across datasets. Currently, achieving this requires hacking in MNE internal functions such as
mne.channels.interpolation._map_meg_or_eeg_channels
ormne.channels.interpolation._make_interpolation_matrix
, and is not straightforward for users. This new method would simplify the process. I believe a similar issue was raised in #12409.Describe your proposed implementation
The proposed implementation involves introducing a new method,
interpolate_to
, to either themne.io.Raw
ormne.Epochs
class. This method would:mne.channels.interpolation._map_meg_or_eeg_channels
ormne.channels.interpolation._make_interpolation_matrix
to interpolate the existing channels to the desired positions. A possible API for this method is:epoch.interpolate_to(montage: DigMontage, method: str, reg: float)
where montage is the desired final montage, method is the interpolation method to use (either spherical spline or field interpolation), and reg is the regularization parameter to pass to the chosen interpolation function.Describe possible alternatives
The parameter montage could also be a list of str with the position names, or a str for the name of a template montage that would be defined in MNE.
Additional context
No response