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

Method save

mne/preprocessing/ica.py:2426–2459  ·  view source on GitHub ↗

Store ICA solution into a fiff file. Parameters ---------- fname : path-like The absolute path of the file name to save the ICA solution into. The file name should end with ``-ica.fif`` or ``-ica.fif.gz``. %(overwrite)s .. version

(self, fname, *, overwrite=False, verbose=None)

Source from the content-addressed store, hash-verified

2424
2425 @verbose
2426 def save(self, fname, *, overwrite=False, verbose=None):
2427 """Store ICA solution into a fiff file.
2428
2429 Parameters
2430 ----------
2431 fname : path-like
2432 The absolute path of the file name to save the ICA solution into.
2433 The file name should end with ``-ica.fif`` or ``-ica.fif.gz``.
2434 %(overwrite)s
2435
2436 .. versionadded:: 1.0
2437 %(verbose)s
2438
2439 Returns
2440 -------
2441 ica : instance of ICA
2442 The object.
2443
2444 See Also
2445 --------
2446 read_ica
2447 """
2448 if self.current_fit == "unfitted":
2449 raise RuntimeError("No fit available. Please first fit ICA")
2450
2451 check_fname(
2452 fname, "ICA", ("-ica.fif", "-ica.fif.gz", "_ica.fif", "_ica.fif.gz")
2453 )
2454 fname = _check_fname(fname, overwrite=overwrite)
2455
2456 logger.info(f"Writing ICA solution to {fname}...")
2457 with start_and_end_file(fname) as fid:
2458 _write_ica(fid, self)
2459 return self
2460
2461 def copy(self):
2462 """Copy the ICA object.

Callers 14

test_ica_noopFunction · 0.95
test_ica_n_iter_Function · 0.95
test_ica_additionalFunction · 0.95
test_ica_covFunction · 0.95
test_fit_methodsFunction · 0.95
test_n_components_noneFunction · 0.95
test_whatFunction · 0.95
test_beer_lambertFunction · 0.45
test_csd_epochsFunction · 0.45

Calls 5

check_fnameFunction · 0.85
_check_fnameFunction · 0.85
start_and_end_fileFunction · 0.85
_write_icaFunction · 0.85
infoMethod · 0.80

Tested by 14

test_ica_noopFunction · 0.76
test_ica_n_iter_Function · 0.76
test_ica_additionalFunction · 0.76
test_ica_covFunction · 0.76
test_fit_methodsFunction · 0.76
test_n_components_noneFunction · 0.76
test_whatFunction · 0.76
test_beer_lambertFunction · 0.36
test_csd_epochsFunction · 0.36