def test_make_eeg_average_ref_proj():
 raw = read_raw_fif(raw_fname, preload=True)
 eeg = mne.pick_types(raw.info, meg=False, eeg=True)
 assert_true((not np.all((raw._data[eeg].mean(axis=0) < 1e-19))))
 car = make_eeg_average_ref_proj(raw.info)
 reref = raw.copy()
 reref.add_proj(car)
 reref.apply_proj()
 assert_array_almost_equal(reref._data[eeg].mean(axis=0), 0, decimal=19)
 raw.info['custom_ref_applied'] = True
 assert_raises(RuntimeError, make_eeg_average_ref_proj, raw.info)

def test_make_eeg_average_ref_proj ( ) : raw = read_raw_fif ( raw_fname , preload = True ) eeg = mne . pick_types ( raw . info , meg = False , eeg = True ) assert_true ( ( not np . all ( ( raw . _data [ eeg ] . mean ( axis = 0 ) < 1e-19 ) ) ) ) car = make_eeg_average_ref_proj ( raw . info ) reref = raw . copy ( ) reref . add_proj ( car ) reref . apply_proj ( ) assert_array_almost_equal ( reref . _data [ eeg ] . mean ( axis = 0 ) , 0 , decimal = 19 ) raw . info [ 'custom_ref_applied' ] = True assert_raises ( RuntimeError , make_eeg_average_ref_proj , raw . info )
test eeg average reference projection .