'Detect EOG related components using correlation.
Detection is based on Pearson correlation between the
filtered data and the filtered EOG channel.
Thresholding is based on adaptive z-scoring. The above threshold
components will be masked and the z-score will be recomputed
until no supra-threshold component remains.
Parameters
inst : instance of Raw, Epochs or Evoked
Object to compute sources from.
ch_name : str
The name of the channel to use for EOG peak detection.
The argument is mandatory if the dataset contains no EOG
channels.
threshold : int | float
The value above which a feature is classified as outlier.
start : int | float | None
First sample to include. If float, data will be interpreted as
time in seconds. If None, data will be used from the first sample.
stop : int | float | None
Last sample to not include. If float, data will be interpreted as
time in seconds. If None, data will be used to the last sample.
l_freq : float
Low pass frequency.
h_freq : float
High pass frequency.
reject_by_annotation : bool
If True, data annotated as bad will be omitted. Defaults to True.
.. versionadded:: 0.14.0
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). Defaults to self.verbose.
Returns
eog_idx : list of int
The indices of EOG related components, sorted by score.
scores : np.ndarray of float, shape (``n_components_``) | list of array
The correlation scores.
See Also
find_bads_ecg'

@verbose
def find_bads_eog(self, inst, ch_name=None, threshold=3.0, start=None, stop=None, l_freq=1, h_freq=10, reject_by_annotation=True, verbose=None):

    if (verbose is None):
        verbose = self.verbose
    eog_inds = _get_eog_channel_index(ch_name, inst)
    if (len(eog_inds) > 2):
        eog_inds = eog_inds[:1]
        logger.info(('Using    EOG    channel    %s' % inst.ch_names[eog_inds[0]]))
    (scores, eog_idx) = ([], [])
    eog_chs = [inst.ch_names[k] for k in eog_inds]
    targets = [self._check_target(k, inst, start, stop, reject_by_annotation) for k in eog_chs]
    for (ii, (eog_ch, target)) in enumerate(zip(eog_chs, targets)):
        scores += [self.score_sources(inst, target=target, score_func='pearsonr', start=start, stop=stop, l_freq=l_freq, h_freq=h_freq, verbose=verbose, reject_by_annotation=reject_by_annotation)]
        this_idx = find_outliers(scores[(-1)], threshold=threshold)
        eog_idx += [this_idx]
        self.labels_[(('eog/%i/' % ii) + eog_ch)] = list(this_idx)
    scores_ = np.concatenate([scores[ii][inds] for (ii, inds) in enumerate(eog_idx)])
    eog_idx_ = np.concatenate(eog_idx)[np.abs(scores_).argsort()[::(-1)]]
    eog_idx_unique = list(np.unique(eog_idx_))
    eog_idx = []
    for i in eog_idx_:
        if (i in eog_idx_unique):
            eog_idx.append(i)
            eog_idx_unique.remove(i)
    if (len(scores) == 1):
        scores = scores[0]
    self.labels_['eog'] = list(eog_idx)
    return (self.labels_['eog'], scores)
