MCPcopy
hub / github.com/mne-tools/mne-python / apply

Method apply

mne/preprocessing/ica.py:2175–2276  ·  view source on GitHub ↗

Remove selected components from the signal. Given the unmixing matrix, transform the data, zero out all excluded components, and inverse-transform the data. This procedure will reconstruct M/EEG signals from which the dynamics described by the excluded components is

(
        self,
        inst,
        include=None,
        exclude=None,
        n_pca_components=None,
        start=None,
        stop=None,
        *,
        on_baseline="warn",
        verbose=None,
    )

Source from the content-addressed store, hash-verified

2173
2174 @verbose
2175 def apply(
2176 self,
2177 inst,
2178 include=None,
2179 exclude=None,
2180 n_pca_components=None,
2181 start=None,
2182 stop=None,
2183 *,
2184 on_baseline="warn",
2185 verbose=None,
2186 ):
2187 """Remove selected components from the signal.
2188
2189 Given the unmixing matrix, transform the data,
2190 zero out all excluded components, and inverse-transform the data.
2191 This procedure will reconstruct M/EEG signals from which
2192 the dynamics described by the excluded components is subtracted.
2193
2194 Parameters
2195 ----------
2196 inst : instance of Raw, Epochs or Evoked
2197 The data to be processed (i.e., cleaned). It will be modified
2198 in-place.
2199 include : array_like of int
2200 The indices referring to columns in the ummixing matrix. The
2201 components to be kept. If ``None`` (default), all components
2202 will be included (minus those defined in ``ica.exclude``
2203 and the ``exclude`` parameter, see below).
2204 exclude : array_like of int
2205 The indices referring to columns in the ummixing matrix. The
2206 components to be zeroed out. If ``None`` (default) or an
2207 empty list, only components from ``ica.exclude`` will be
2208 excluded. Else, the union of ``exclude`` and ``ica.exclude``
2209 will be excluded.
2210 %(n_pca_components_apply)s
2211 start : int | float | None
2212 First sample to include. If float, data will be interpreted as
2213 time in seconds. If None, data will be used from the first sample.
2214 stop : int | float | None
2215 Last sample to not include. If float, data will be interpreted as
2216 time in seconds. If None, data will be used to the last sample.
2217 %(on_baseline_ica)s
2218 %(verbose)s
2219
2220 Returns
2221 -------
2222 out : same type as the input data
2223 The processed data.
2224
2225 Notes
2226 -----
2227 .. note:: Applying ICA may introduce a DC shift. If you pass
2228 baseline-corrected `~mne.Epochs` or `~mne.Evoked` data,
2229 the baseline period of the cleaned data may not be of
2230 zero mean anymore. If you require baseline-corrected
2231 data, apply baseline correction again after cleaning
2232 via ICA. A warning will be emitted to remind you of this

Callers 14

test_warningsFunction · 0.95
test_ica_noopFunction · 0.95
test_ica_projsFunction · 0.95
test_ica_coreFunction · 0.95
test_ica_additionalFunction · 0.95
test_ica_covFunction · 0.95
test_ica_twiceFunction · 0.95
test_ica_ctfFunction · 0.95
test_ica_eegFunction · 0.95
test_ica_ch_typesFunction · 0.95

Calls 7

_validate_typeFunction · 0.85
_check_on_missingFunction · 0.85
_on_missingFunction · 0.85
infoMethod · 0.80
updateMethod · 0.45
apply_baselineMethod · 0.45

Tested by 13

test_warningsFunction · 0.76
test_ica_noopFunction · 0.76
test_ica_projsFunction · 0.76
test_ica_coreFunction · 0.76
test_ica_additionalFunction · 0.76
test_ica_covFunction · 0.76
test_ica_twiceFunction · 0.76
test_ica_ctfFunction · 0.76
test_ica_eegFunction · 0.76
test_ica_ch_typesFunction · 0.76
test_ica_rank_reductionFunction · 0.36