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)
| 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. |