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

Function test_compute_maxwell_basis

mne/preprocessing/tests/test_maxwell.py:1888–1906  ·  view source on GitHub ↗

Test compute_maxwell_basis.

(regularize, n, int_order)

Source from the content-addressed store, hash-verified

1886 ],
1887)
1888def test_compute_maxwell_basis(regularize, n, int_order):
1889 """Test compute_maxwell_basis."""
1890 raw = read_raw_fif(raw_small_fname).crop(0, 2)
1891 assert raw.info["bads"] == []
1892 raw.del_proj()
1893 rank = compute_rank(raw)["meg"]
1894 assert rank == 306
1895 raw.info["bads"] = ["MEG 2443"]
1896 kwargs = dict(regularize=regularize, int_order=int_order, verbose=True)
1897 raw_sss = maxwell_filter(raw, **kwargs)
1898 want = raw_sss.get_data("meg")
1899 rank = compute_rank(raw_sss)["meg"]
1900 assert rank == n
1901 S, pS, reg_moments, n_use_in = compute_maxwell_basis(raw.info, **kwargs)
1902 assert n_use_in == n
1903 assert n_use_in == len(reg_moments) - 15 # no externals removed
1904 xform = S[:, :n_use_in] @ pS[:n_use_in]
1905 got = xform @ raw.pick(picks="meg", exclude="bads").get_data()
1906 assert_allclose(got, want, atol=1e-16)
1907
1908
1909@testing.requires_testing_data

Callers

nothing calls this directly

Calls 8

read_raw_fifFunction · 0.90
compute_rankFunction · 0.90
compute_maxwell_basisFunction · 0.90
maxwell_filterFunction · 0.85
del_projMethod · 0.80
cropMethod · 0.45
get_dataMethod · 0.45
pickMethod · 0.45

Tested by

no test coverage detected