braindecode.preprocessing.InterpolateTo#

class braindecode.preprocessing.InterpolateTo(sensors, origin='auto', method=None, mode='accurate', reg=0.0)[source]#

Braindecode preprocessor wrapper for interpolate_to().

Interpolate data onto a new sensor configuration.

This method can interpolate EEG data onto a new montage or transform MEG data to a different sensor configuration (e.g., Neuromag to CTF).

Parameters:
sensorsDigMontage | str

For EEG: A DigMontage object containing target channel positions. For MEG: A string specifying the target MEG system. Currently supported: 'neuromag', 'ctf151' or 'ctf275'.

originarray-like, shape (3,) | str

Origin of the sphere in the head coordinate frame and in meters. Can be 'auto' (default), which means a head-digitization-based origin fit. Used for both EEG and MEG interpolation.

methodstr | None

Interpolation method to use. For EEG: 'spline' (default, same as None) or 'MNE'. For MEG: 'MNE' (default, same as None).

Changed in version 1.10.0: Added support for MEG interpolation.

modestr

Either 'accurate' (default) or 'fast', determines the quality of the Legendre polynomial expansion used for interpolation of MEG channels using the minimum-norm method. Only used for MEG interpolation.

regfloat

The regularization parameter for the interpolation method. Only used when method='spline' for EEG channels.

Returns:
instsame type as the input data

A new instance with interpolated data and updated channel information.

Notes

For EEG data:

This method interpolates EEG channels onto a new montage using spherical splines or minimum-norm estimation. Non-EEG channels are preserved without modification.

For MEG data:

This method transforms MEG data to a different sensor configuration using field interpolation.

Common use cases for MEG transformation:

  • Transform Neuromag data to CTF sensor layout for comparison

  • Transform CTF data to Neuromag sensor layout

  • Simulate what data would look like on a different MEG system

Warning

MEG field interpolation assumes that the head position relative to the sensors is similar between systems. Large differences in head position may affect interpolation accuracy.

Added in version 1.10.0.

Changed in version 1.12.0: Added support for MEG interpolation to canonical systems.