def test_get_set_sensor_positions():
 raw1 = read_raw_fif(raw_fname)
 picks = pick_types(raw1.info, meg=False, eeg=True)
 pos = np.array([ch['loc'][:3] for ch in raw1.info['chs']])[picks]
 raw_pos = raw1._get_channel_positions(picks=picks)
 assert_array_equal(raw_pos, pos)
 ch_name = raw1.info['ch_names'][13]
 assert_raises(ValueError, raw1._set_channel_positions, [1, 2], ['name'])
 raw2 = read_raw_fif(raw_fname)
 raw2.info['chs'][13]['loc'][:3] = np.array([1, 2, 3])
 raw1._set_channel_positions([[1, 2, 3]], [ch_name])
 assert_array_equal(raw1.info['chs'][13]['loc'], raw2.info['chs'][13]['loc'])

def test_get_set_sensor_positions ( ) : raw1 = read_raw_fif ( raw_fname ) picks = pick_types ( raw1 . info , meg = False , eeg = True ) pos = np . array ( [ ch [ 'loc' ] [ : 3 ] for ch in raw1 . info [ 'chs' ] ] ) [ picks ] raw_pos = raw1 . _get_channel_positions ( picks = picks ) assert_array_equal ( raw_pos , pos ) ch_name = raw1 . info [ 'ch_names' ] [ 13 ] assert_raises ( ValueError , raw1 . _set_channel_positions , [ 1 , 2 ] , [ 'name' ] ) raw2 = read_raw_fif ( raw_fname ) raw2 . info [ 'chs' ] [ 13 ] [ 'loc' ] [ : 3 ] = np . array ( [ 1 , 2 , 3 ] ) raw1 . _set_channel_positions ( [ [ 1 , 2 , 3 ] ] , [ ch_name ] ) assert_array_equal ( raw1 . info [ 'chs' ] [ 13 ] [ 'loc' ] , raw2 . info [ 'chs' ] [ 13 ] [ 'loc' ] )
test get/set functions for sensor positions .