def test_whiten_evoked():
 evoked = read_evokeds(ave_fname, condition=0, baseline=(None, 0), proj=True)
 cov = read_cov(cov_fname)
 picks = pick_types(evoked.info, meg=True, eeg=True, ref_meg=False, exclude='bads')
 noise_cov = regularize(cov, evoked.info, grad=0.1, mag=0.1, eeg=0.1, exclude='bads')
 evoked_white = whiten_evoked(evoked, noise_cov, picks, diag=True)
 whiten_baseline_data = evoked_white.data[picks][:, (evoked.times < 0)]
 mean_baseline = np.mean(np.abs(whiten_baseline_data), axis=1)
 assert_true(np.all((mean_baseline < 1.0)))
 assert_true(np.all((mean_baseline > 0.2)))
 cov_bad = pick_channels_cov(cov, include=evoked.ch_names[:10])
 assert_raises(RuntimeError, whiten_evoked, evoked, cov_bad, picks)

def test_whiten_evoked ( ) : evoked = read_evokeds ( ave_fname , condition = 0 , baseline = ( None , 0 ) , proj = True ) cov = read_cov ( cov_fname ) picks = pick_types ( evoked . info , meg = True , eeg = True , ref_meg = False , exclude = 'bads' ) noise_cov = regularize ( cov , evoked . info , grad = 0.1 , mag = 0.1 , eeg = 0.1 , exclude = 'bads' ) evoked_white = whiten_evoked ( evoked , noise_cov , picks , diag = True ) whiten_baseline_data = evoked_white . data [ picks ] [ : , ( evoked . times < 0 ) ] mean_baseline = np . mean ( np . abs ( whiten_baseline_data ) , axis = 1 ) assert_true ( np . all ( ( mean_baseline < 1.0 ) ) ) assert_true ( np . all ( ( mean_baseline > 0.2 ) ) ) cov_bad = pick_channels_cov ( cov , include = evoked . ch_names [ : 10 ] ) assert_raises ( RuntimeError , whiten_evoked , evoked , cov_bad , picks )
test whitening of evoked data .