@verbose
def compute_whitener(noise_cov, info, picks=None, rank=None, scalings=None, verbose=None):
 if (picks is None):
  picks = pick_types(info, meg=True, eeg=True, ref_meg=False, exclude='bads')
 ch_names = [info['chs'][k]['ch_name'] for k in picks]
 noise_cov = cp.deepcopy(noise_cov)
 noise_cov = prepare_noise_cov(noise_cov, info, ch_names, rank=rank, scalings=scalings)
 n_chan = len(ch_names)
 W = np.zeros((n_chan, n_chan), dtype=np.float)
 eig = noise_cov['eig']
 nzero = (eig > 0)
 W[(nzero, nzero)] = (1.0 / np.sqrt(eig[nzero]))
 W = np.dot(W, noise_cov['eigvec'])
 W = np.dot(noise_cov['eigvec'].T, W)
 return (W, ch_names)

@ verbose def compute_whitener ( noise_cov , info , picks = None , rank = None , scalings = None , verbose = None ) : if ( picks is None ) : picks = pick_types ( info , meg = True , eeg = True , ref_meg = False , exclude = 'bads' ) ch_names = [ info [ 'chs' ] [ k ] [ 'ch_name' ] for k in picks ] noise_cov = cp . deepcopy ( noise_cov ) noise_cov = prepare_noise_cov ( noise_cov , info , ch_names , rank = rank , scalings = scalings ) n_chan = len ( ch_names ) W = np . zeros ( ( n_chan , n_chan ) , dtype = np . float ) eig = noise_cov [ 'eig' ] nzero = ( eig > 0 ) W [ ( nzero , nzero ) ] = ( 1.0 / np . sqrt ( eig [ nzero ] ) ) W = np . dot ( W , noise_cov [ 'eigvec' ] ) W = np . dot ( noise_cov [ 'eigvec' ] . T , W ) return ( W , ch_names )
compute whitening matrix .