MCPcopy Index your code
hub / github.com/mne-tools/mne-python / regularize

Function regularize

mne/cov.py:1921–2130  ·  view source on GitHub ↗

Regularize noise covariance matrix. This method works by adding a constant to the diagonal for each channel type separately. Special care is taken to keep the rank of the data constant. .. note:: This function is kept for reasons of backward-compatibility. Please cons

(
    cov,
    info,
    mag=0.1,
    grad=0.1,
    eeg=0.1,
    exclude="bads",
    proj=True,
    seeg=0.1,
    ecog=0.1,
    hbo=0.1,
    hbr=0.1,
    fnirs_cw_amplitude=0.1,
    fnirs_fd_ac_amplitude=0.1,
    fnirs_fd_phase=0.1,
    fnirs_od=0.1,
    csd=0.1,
    dbs=0.1,
    rank=None,
    scalings=None,
    verbose=None,
)

Source from the content-addressed store, hash-verified

1919
1920@verbose
1921def regularize(
1922 cov,
1923 info,
1924 mag=0.1,
1925 grad=0.1,
1926 eeg=0.1,
1927 exclude="bads",
1928 proj=True,
1929 seeg=0.1,
1930 ecog=0.1,
1931 hbo=0.1,
1932 hbr=0.1,
1933 fnirs_cw_amplitude=0.1,
1934 fnirs_fd_ac_amplitude=0.1,
1935 fnirs_fd_phase=0.1,
1936 fnirs_od=0.1,
1937 csd=0.1,
1938 dbs=0.1,
1939 rank=None,
1940 scalings=None,
1941 verbose=None,
1942):
1943 """Regularize noise covariance matrix.
1944
1945 This method works by adding a constant to the diagonal for each
1946 channel type separately. Special care is taken to keep the
1947 rank of the data constant.
1948
1949 .. note:: This function is kept for reasons of backward-compatibility.
1950 Please consider explicitly using the ``method`` parameter in
1951 :func:`mne.compute_covariance` to directly combine estimation
1952 with regularization in a data-driven fashion. See the
1953 :ref:`FAQ <faq_how_should_i_regularize>` for more information.
1954
1955 Parameters
1956 ----------
1957 cov : Covariance
1958 The noise covariance matrix.
1959 %(info_not_none)s (Used to get channel types and bad channels).
1960 mag : float (default 0.1)
1961 Regularization factor for MEG magnetometers.
1962 grad : float (default 0.1)
1963 Regularization factor for MEG gradiometers. Must be the same as
1964 ``mag`` if data have been processed with SSS.
1965 eeg : float (default 0.1)
1966 Regularization factor for EEG.
1967 exclude : list | 'bads' (default 'bads')
1968 List of channels to mark as bad. If 'bads', bads channels
1969 are extracted from both info['bads'] and cov['bads'].
1970 proj : bool (default True)
1971 Apply projections to keep rank of data.
1972 seeg : float (default 0.1)
1973 Regularization factor for sEEG signals.
1974 ecog : float (default 0.1)
1975 Regularization factor for ECoG signals.
1976 hbo : float (default 0.1)
1977 Regularization factor for HBO signals.
1978 hbr : float (default 0.1)

Callers 12

test_gamma_map_standardFunction · 0.90
test_bad_projFunction · 0.90
test_cov_orderFunction · 0.90
test_regularize_covFunction · 0.90
test_whiten_evokedFunction · 0.90
test_low_rank_covFunction · 0.90
test_reg_rankFunction · 0.90
_get_dataFunction · 0.90
test_simulate_evokedFunction · 0.90
test_rank_deficiencyFunction · 0.90
fitMethod · 0.85

Calls 15

_handle_defaultFunction · 0.85
_picks_by_typeFunction · 0.85
_compute_rankFunction · 0.85
pick_channels_covFunction · 0.85
_make_projectorFunction · 0.85
_safe_svdFunction · 0.85
pick_channelsFunction · 0.85
pick_infoFunction · 0.85
_smart_eighFunction · 0.85
infoMethod · 0.80
copyMethod · 0.45
_check_consistencyMethod · 0.45

Tested by 11

test_gamma_map_standardFunction · 0.72
test_bad_projFunction · 0.72
test_cov_orderFunction · 0.72
test_regularize_covFunction · 0.72
test_whiten_evokedFunction · 0.72
test_low_rank_covFunction · 0.72
test_reg_rankFunction · 0.72
_get_dataFunction · 0.72
test_simulate_evokedFunction · 0.72
test_rank_deficiencyFunction · 0.72