'Specify which reference to use for EEG data.
By default, MNE-Python will automatically re-reference the EEG signal
to use an average reference (see below). Use this function to
explicitly specify the desired reference for EEG. This can be either an
existing electrode or a new virtual channel. This function will
re-reference the data according to the desired reference and prevent
MNE-Python from automatically adding an average reference projection.
Some common referencing schemes and the corresponding value for the
``ref_channels`` parameter:
No re-referencing:
If the EEG data is already using the proper reference, set
``ref_channels=[]``. This will prevent MNE-Python from
automatically adding an average reference projection.
Average reference:
A new virtual reference electrode is created by averaging the
current EEG signal. Make sure that all bad EEG channels are
properly marked and set ``ref_channels=\'average\'``.
A single electrode:
Set ``ref_channels`` to a list containing the name of the channel
that will act as the new reference, for example
``ref_channels=[\'Cz\']``.
The mean of multiple electrodes:
A new virtual reference electrode is created by computing the
average of the current EEG signal recorded from two or more
selected channels. Set ``ref_channels`` to a list of channel names,
indicating which channels to use. For example, to apply an average
mastoid reference, when using the 10-20 naming scheme, set
``ref_channels=[\'M1\', \'M2\']``.
.. note:: In case of average reference `ref_channels=\'average\'`` in
combination with `projection=True`, the reference is added as
a projection and it is not applied automatically. For it to
take effect, apply with method
:meth:`apply_proj <mne.io.Raw.apply_proj>`. Other references
are directly applied (this behavior will change in MNE 0.16).
Parameters
ref_channels : list of str | str
The name(s) of the channel(s) used to construct the reference. To
apply an average reference, specify ``\'average\'`` here (default).
If an empty list is specified, the data is assumed to already have
a proper reference and MNE will not attempt any re-referencing of
the data. Defaults to an average reference.
projection : bool | None
If ``ref_channels=\'average\'`` this argument specifies if the
average reference should be computed as a projection (True) or not
(False). If ``projection=True``, the average reference is added as
a projection and is not applied to the data (it can be applied
afterwards with the ``apply_proj`` method). If
``projection=False``, the average reference is directly applied to
the data. Defaults to None, which means ``projection=True``, but
will change to ``projection=False`` in the next release.
If ``ref_channels`` is not ``\'average\'``, ``projection`` must be
set to ``False`` (the default in this case).
verbose : bool, str, int, or None
If not None, override default verbose level (see
:func:`mne.verbose` and :ref:`Logging documentation <tut_logging>`
for more).
Returns
inst : instance of Raw | Epochs | Evoked
Data with EEG channels re-referenced. If ``ref_channels=\'average\'``
and ``projection=True`` a projection will be added instead of
directly re-referencing the data.
See Also
mne.set_bipolar_reference : Convenience function for creating bipolar
references.
Notes
1. If a reference is requested that is not the average reference, this
function removes any pre-existing average reference projections.
2. During source localization, the EEG signal should have an average
reference.
3. In order to apply a reference, the data must be preloaded. This is
not necessary if ``ref_channels=\'average\'`` and ``projection=True``.
.. versionadded:: 0.9.0'

@verbose
def set_eeg_reference(self, ref_channels='average', projection=None, verbose=None):

    from ..io.reference import set_eeg_reference
    return set_eeg_reference(self, ref_channels=ref_channels, copy=False, projection=projection)[0]
