'Run the ICA decomposition on raw data.
Caveat! If supplying a noise covariance keep track of the projections
available in the cov, the raw or the epochs object. For example,
if you are interested in EOG or ECG artifacts, EOG and ECG projections
should be temporally removed before fitting the ICA.
Parameters
inst : instance of Raw, Epochs or Evoked
Raw measurements to be decomposed.
picks : array-like of int
Channels to be included. This selection remains throughout the
initialized ICA solution. If None only good data channels are used.
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.
decim : int | None
Increment for selecting each nth time slice. If None, all samples
within ``start`` and ``stop`` are used.
reject : dict | None
Rejection parameters based on peak-to-peak amplitude.
Valid keys are \'grad\', \'mag\', \'eeg\', \'seeg\', \'ecog\', \'eog\', \'ecg\',
\'hbo\', \'hbr\'.
If reject is None then no rejection is done. Example::
reject = dict(grad=4000e-13, # T / m (gradiometers)
mag=4e-12, # T (magnetometers)
eeg=40e-6, # V (EEG channels)
eog=250e-6 # V (EOG channels)
It only applies if `inst` is of type Raw.
flat : dict | None
Rejection parameters based on flatness of signal.
Valid keys are \'grad\', \'mag\', \'eeg\', \'seeg\', \'ecog\', \'eog\', \'ecg\',
\'hbo\', \'hbr\'.
Values are floats that set the minimum acceptable peak-to-peak
amplitude. If flat is None then no rejection is done.
It only applies if `inst` is of type Raw.
tstep : float
Length of data chunks for artifact rejection in seconds.
It only applies if `inst` is of type Raw.
reject_by_annotation : bool
Whether to omit bad segments from the data before fitting. If True,
annotated segments with a description that starts with \'bad\' are
omitted. Has no effect if ``inst`` is an Epochs or Evoked object.
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
self : instance of ICA
Returns the modified instance.'

@verbose
def fit(self, inst, picks=None, start=None, stop=None, decim=None, reject=None, flat=None, tstep=2.0, reject_by_annotation=True, verbose=None):

    if isinstance(inst, (BaseRaw, BaseEpochs)):
        _check_for_unsupported_ica_channels(picks, inst.info)
        if isinstance(inst, BaseRaw):
            self._fit_raw(inst, picks, start, stop, decim, reject, flat, tstep, reject_by_annotation, verbose)
        elif isinstance(inst, BaseEpochs):
            self._fit_epochs(inst, picks, decim, verbose)
    else:
        raise ValueError('Data    input    must    be    of    Raw    or    Epochs    type')
    var = _ica_explained_variance(self, inst)
    var_ord = var.argsort()[::(-1)]
    _sort_components(self, var_ord, copy=False)
    return self
