Read a noise covariance from a FIF file. Parameters ---------- fname : path-like The path-like of file containing the covariance matrix. It should end with ``-cov.fif`` or ``-cov.fif.gz``. %(verbose)s Returns ------- cov : Covariance The noise co
(fname, verbose=None)
| 478 | |
| 479 | @verbose |
| 480 | def read_cov(fname, verbose=None): |
| 481 | """Read a noise covariance from a FIF file. |
| 482 | |
| 483 | Parameters |
| 484 | ---------- |
| 485 | fname : path-like |
| 486 | The path-like of file containing the covariance matrix. It should end |
| 487 | with ``-cov.fif`` or ``-cov.fif.gz``. |
| 488 | %(verbose)s |
| 489 | |
| 490 | Returns |
| 491 | ------- |
| 492 | cov : Covariance |
| 493 | The noise covariance matrix. |
| 494 | |
| 495 | See Also |
| 496 | -------- |
| 497 | write_cov, compute_covariance, compute_raw_covariance |
| 498 | """ |
| 499 | from ._fiff.open import fiff_open |
| 500 | |
| 501 | check_fname( |
| 502 | fname, "covariance", ("-cov.fif", "-cov.fif.gz", "_cov.fif", "_cov.fif.gz") |
| 503 | ) |
| 504 | fname = _check_fname(fname=fname, must_exist=True, overwrite="read") |
| 505 | f, tree, _ = fiff_open(fname) |
| 506 | with f as fid: |
| 507 | return Covariance( |
| 508 | **_read_cov(fid, tree, FIFF.FIFFV_MNE_NOISE_COV, limited=True) |
| 509 | ) |
| 510 | |
| 511 | |
| 512 | ############################################################################### |