Skip to content

Commit

Permalink
FIX: Ref
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Sep 2, 2020
1 parent bebc68a commit 2cff166
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion mne/channels/tests/test_montage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1321,12 +1321,16 @@ def test_get_ch_positions():
# set a montage and new channel positions should match
raw_bv.set_montage(montage)
ch_positions, coord_frame = raw_bv.get_ch_positions()
assert list(set(coord_frame.values())) == ['head']
assert montage.dig[0]['coord_frame'] == FIFF.FIFFV_COORD_HEAD
montage_ch_pos = montage._get_ch_pos()
montage_ch_pos.pop('EEG000') # ref, not used

# all montage channels should match new channel positions
# other channels should match original channel positions
assert set(ch_positions) == set(montage_ch_pos)
for ch, pos in ch_positions.items():
assert_array_equal(montage_ch_pos[ch], pos)
assert_allclose(montage_ch_pos[ch], pos, err_msg=ch)

# if no montage, ch_positions should be all nans
raw_bv.set_montage(None)
Expand Down
3 changes: 2 additions & 1 deletion mne/io/_digitization.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def _get_data_as_dict_from_dig(dig):
hsp.append(d['r'])
elif d['kind'] == FIFF.FIFFV_POINT_EEG:
# XXX: dig_ch_pos['EEG%03d' % d['ident']] = d['r']
dig_ch_pos_location.append(d['r'])
if d['ident'] != 0: # ref channel
dig_ch_pos_location.append(d['r'])

dig_coord_frames = set([d['coord_frame'] for d in dig])
assert len(dig_coord_frames) == 1, \
Expand Down

0 comments on commit 2cff166

Please sign in to comment.