def test_ch_loc(): """Test raw kit loc.""" raw_py = read_raw_kit(sqd_path, mrk_path, elp_txt_path, hsp_txt_path, stim='<') raw_bin = read_raw_fif(op.join(data_dir, 'test_bin_raw.fif')) ch_py = np.array([ch['loc'] for ch in raw_py._raw_extras[0]['channels'][:160]]) # ch locs stored as m, not mm ch_py[:, :3] *= 1e3 ch_sns = read_sns(op.join(data_dir, 'sns.txt')) assert_array_almost_equal(ch_py, ch_sns, 2) assert_array_almost_equal(raw_py.info['dev_head_t']['trans'], raw_bin.info['dev_head_t']['trans'], 4) for py_ch, bin_ch in zip(raw_py.info['chs'], raw_bin.info['chs']): if bin_ch['ch_name'].startswith('MEG'): # the stored ch locs have more precision than the sns.txt assert_array_almost_equal(py_ch['loc'], bin_ch['loc'], decimal=2) # test when more than one marker file provided mrks = [mrk_path, mrk2_path, mrk3_path] read_raw_kit(sqd_path, mrks, elp_txt_path, hsp_txt_path, preload=False) # this dataset does not have the equivalent set of points :( raw_bin.info['dig'] = raw_bin.info['dig'][:8] raw_py.info['dig'] = raw_py.info['dig'][:8] assert_dig_allclose(raw_py.info, raw_bin.info)
def test_ch_loc(): """Test raw kit loc """ raw_py = read_raw_kit(sqd_path, mrk_path, elp_path, hsp_path, stim='<') raw_bin = Raw(op.join(data_dir, 'test_bin_raw.fif')) ch_py = raw_py._sqd_params['sensor_locs'][:, :5] # ch locs stored as m, not mm ch_py[:, :3] *= 1e3 ch_sns = read_sns(op.join(data_dir, 'sns.txt')) assert_array_almost_equal(ch_py, ch_sns, 2) assert_array_almost_equal(raw_py.info['dev_head_t']['trans'], raw_bin.info['dev_head_t']['trans'], 4) for py_ch, bin_ch in zip(raw_py.info['chs'], raw_bin.info['chs']): if bin_ch['ch_name'].startswith('MEG'): # the stored ch locs have more precision than the sns.txt assert_array_almost_equal(py_ch['loc'], bin_ch['loc'], decimal=2) assert_array_almost_equal(py_ch['coil_trans'], bin_ch['coil_trans'], decimal=2) # test when more than one marker file provided mrks = [mrk_path, mrk2_path, mrk3_path] read_raw_kit(sqd_path, mrks, elp_path, hsp_path, preload=False)
def test_ch_loc(): """Test raw kit loc.""" raw_py = read_raw_kit(sqd_path, mrk_path, elp_txt_path, hsp_txt_path, stim='<') raw_bin = read_raw_fif(op.join(data_dir, 'test_bin_raw.fif')) ch_py = np.array([ch['loc'] for ch in raw_py._raw_extras[0]['channels'][:160]]) # ch locs stored as m, not mm ch_py[:, :3] *= 1e3 ch_sns = read_sns(op.join(data_dir, 'sns.txt')) assert_array_almost_equal(ch_py, ch_sns, 2) assert_array_almost_equal(raw_py.info['dev_head_t']['trans'], raw_bin.info['dev_head_t']['trans'], 4) for py_ch, bin_ch in zip(raw_py.info['chs'], raw_bin.info['chs']): if bin_ch['ch_name'].startswith('MEG'): # the stored ch locs have more precision than the sns.txt assert_array_almost_equal(py_ch['loc'], bin_ch['loc'], decimal=2) # test when more than one marker file provided mrks = [mrk_path, mrk2_path, mrk3_path] read_raw_kit(sqd_path, mrks, elp_txt_path, hsp_txt_path, preload=False) # this dataset does not have the equivalent set of points :( raw_bin.info['dig'] = raw_bin.info['dig'][:8] raw_py.info['dig'] = raw_py.info['dig'][:8] assert_dig_allclose(raw_py.info, raw_bin.info)
def test_ch_loc(): """Test raw kit loc """ raw_py = read_raw_kit(sqd_path, mrk_path, elp_path, hsp_path, stim='<') raw_bin = Raw(op.join(data_dir, 'test_bin_raw.fif')) ch_py = raw_py._sqd_params['sensor_locs'][:, :5] # ch locs stored as m, not mm ch_py[:, :3] *= 1e3 ch_sns = read_sns(op.join(data_dir, 'sns.txt')) assert_array_almost_equal(ch_py, ch_sns, 2) assert_array_almost_equal(raw_py.info['dev_head_t']['trans'], raw_bin.info['dev_head_t']['trans'], 4) for py_ch, bin_ch in zip(raw_py.info['chs'], raw_bin.info['chs']): if bin_ch['ch_name'].startswith('MEG'): # the stored ch locs have more precision than the sns.txt assert_array_almost_equal(py_ch['loc'], bin_ch['loc'], decimal=2) assert_array_almost_equal(py_ch['coil_trans'], bin_ch['coil_trans'], decimal=2) # test when more than one marker file provided mrks = [mrk_path, mrk2_path, mrk3_path] _ = read_raw_kit(sqd_path, mrks, elp_path, hsp_path, preload=False)