コード例 #1
0
def plot_components(A, raw, picks, **kwargs):
    p, q = A.shape
    ica = ICA_(n_components=q, method='fastica', random_state=0,
               fit_params=dict(max_iter=1))
    ica.info = pick_info(raw.info, picks)
    if ica.info['comps']:
        ica.info['comps'] = []
    ica.ch_names = ica.info['ch_names']
    ica.mixing_matrix_ = A
    ica.pca_components_ = np.eye(p)
    ica.pca_mean_ = None
    ica.unmixing_matrix_ = np.linalg.pinv(A)
    ica.n_components_ = p
    ica._update_ica_names()
    ica.plot_components(**kwargs)
コード例 #2
0
def transfer_to_mne(A, raw, picks):
    '''
    Hack to use the MNE ICA class providing the estimated mixing matrix A.
    '''
    p, q = A.shape
    ica = ICA_(n_components=q, method='fastica', random_state=0,
               fit_params=dict(max_iter=1))
    ica.info = pick_info(raw.info, picks)
    if ica.info['comps']:
        ica.info['comps'] = []
    ica.ch_names = ica.info['ch_names']
    ica.mixing_matrix_ = A
    ica.pca_components_ = np.eye(p)
    ica.pca_mean_ = None
    ica.unmixing_matrix_ = np.linalg.pinv(A)
    ica.n_components_ = p
    ica._update_ica_names()
    return ica