Skip to content

ENH: Custom referencing #12283

@qian-chu

Description

@qian-chu

Describe the new feature or enhancement

In some cases, especially intracranial EEG, re-referencing of channels should be local (e.g. within the same shaft/grid/strip) rather than global (i.e., ref all channels to one or an average of channels). This thus requires some flexible re-ref schemes, but the existing functions set_eeg_reference and set_bipolar_reference are not super convenient for such purposes.
On the basis of the proposed function, multiple re-ref schemes can be added (for example see https://doi.org/10.1016/j.neuroimage.2018.08.020)

Describe your proposed implementation

A new preprocessing function mne.set_custom_reference(inst, ref_dict, copy=True, on_bad='warn', verbose=None)
Where ref_dict contains a dictionary with keys being the source channel names and values being ref channel names. For example: ref_dict = {'A1': 'A1', 'A2': 'A1', 'A3': 'A1', 'A4': 'A1'} performs monopolar reference; ref_dict = {'A1': 'A2', 'A2': ['A1', 'A3'], 'A3': ['A2', 'A4'], 'A4': 'A3'} performs Laplacian reference.
I'm happy to open a pull request draft if someone can confirm the value of the proposed function.

Describe possible alternatives

Alternatively we can expand mne.set_eeg_reference instead of writing a new function.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions