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

Method get_sources

mne/preprocessing/ica.py:1222–1268  ·  view source on GitHub ↗

Estimate sources given the unmixing matrix. This method will return the sources in the container format passed. Typical usecases: 1. pass Raw object to use `raw.plot ` for ICA sources 2. pass Epochs object to compute trial-based statistics in ICA sp

(self, inst, add_channels=None, start=None, stop=None)

Source from the content-addressed store, hash-verified

1220 return var_explained_ratio
1221
1222 def get_sources(self, inst, add_channels=None, start=None, stop=None):
1223 """Estimate sources given the unmixing matrix.
1224
1225 This method will return the sources in the container format passed.
1226 Typical usecases:
1227
1228 1. pass Raw object to use `raw.plot <mne.io.Raw.plot>` for ICA sources
1229 2. pass Epochs object to compute trial-based statistics in ICA space
1230 3. pass Evoked object to investigate time-locking in ICA space
1231
1232 Parameters
1233 ----------
1234 inst : instance of Raw, Epochs or Evoked
1235 Object to compute sources from and to represent sources in.
1236 add_channels : None | list of str
1237 Additional channels to be added. Useful to e.g. compare sources
1238 with some reference. Defaults to None.
1239 start : int | float | None
1240 First sample to include. If float, data will be interpreted as
1241 time in seconds. If None, the entire data will be used.
1242 stop : int | float | None
1243 Last sample to not include. If float, data will be interpreted as
1244 time in seconds. If None, the entire data will be used.
1245
1246 Returns
1247 -------
1248 sources : same type as the input data
1249 The ICA sources time series.
1250 """
1251 if isinstance(inst, BaseRaw):
1252 _check_compensation_grade(
1253 self.info, inst.info, "ICA", "Raw", ch_names=self.ch_names
1254 )
1255 sources = self._sources_as_raw(inst, add_channels, start, stop)
1256 elif isinstance(inst, BaseEpochs):
1257 _check_compensation_grade(
1258 self.info, inst.info, "ICA", "Epochs", ch_names=self.ch_names
1259 )
1260 sources = self._sources_as_epochs(inst, add_channels, False)
1261 elif isinstance(inst, Evoked):
1262 _check_compensation_grade(
1263 self.info, inst.info, "ICA", "Evoked", ch_names=self.ch_names
1264 )
1265 sources = self._sources_as_evoked(inst, add_channels)
1266 else:
1267 raise ValueError("Data input must be of Raw, Epochs or Evoked type")
1268 return sources
1269
1270 def _sources_as_raw(self, raw, add_channels, start, stop):
1271 """Aux method."""

Callers 14

find_bads_ecgMethod · 0.95
find_bads_muscleMethod · 0.95
test_ica_coreFunction · 0.95
test_ica_additionalFunction · 0.95
test_ica_covFunction · 0.95
test_ica_ctfFunction · 0.95
test_ica_labelsFunction · 0.95
test_ica_eegFunction · 0.95
test_ica_ch_typesFunction · 0.95
_ica_explained_varianceFunction · 0.80

Calls 4

_sources_as_rawMethod · 0.95
_sources_as_epochsMethod · 0.95
_sources_as_evokedMethod · 0.95

Tested by 8

test_ica_coreFunction · 0.76
test_ica_additionalFunction · 0.76
test_ica_covFunction · 0.76
test_ica_ctfFunction · 0.76
test_ica_labelsFunction · 0.76
test_ica_eegFunction · 0.76
test_ica_ch_typesFunction · 0.76