Skip to content

Commit

Permalink
fix reading of cardinals in .htps files (mne-tools#6897)
Browse files Browse the repository at this point in the history
  • Loading branch information
agramfort authored and larsoner committed Oct 3, 2019
1 parent 1fec322 commit 2c2488c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 2 additions & 0 deletions doc/changes/latest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Bug

- Fix handling of repeated events in :class:`mne.Epochs` by `Fahimeh Mamashli`_ and `Alex Gramfort`_

- Fix reading of cardinals in .htps files (identifier are int not strings) by `Alex Gramfort`_

- Fix IO of TFRs when event_id contain a / in one of the keys by `Alex Gramfort`_

API
Expand Down
9 changes: 5 additions & 4 deletions mne/channels/montage.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,9 +456,9 @@ def read_dig_hpts(fname, unit='mm'):
For example::
cardinal nasion -5.6729 -12.3873 -30.3671
cardinal lpa -37.6782 -10.4957 91.5228
cardinal rpa -131.3127 9.3976 -22.2363
cardinal 2 -5.6729 -12.3873 -30.3671
cardinal 1 -37.6782 -10.4957 91.5228
cardinal 3 -131.3127 9.3976 -22.2363
hpi 1 -30.4493 -11.8450 83.3601
hpi 2 -122.5353 9.2232 -28.6828
hpi 3 -6.8518 -47.0697 -37.0829
Expand All @@ -480,7 +480,8 @@ def read_dig_hpts(fname, unit='mm'):
xyz = np.array([out['f%d' % ii] for ii in range(2, 5)]).T
xyz *= _scale
del _scale
fid = {label[ii]: this_xyz
fid_idx_to_label = {'1': 'lpa', '2': 'nasion', '3': 'rpa'}
fid = {fid_idx_to_label[label[ii]]: this_xyz
for ii, this_xyz in enumerate(xyz) if kind[ii] == 'cardinal'}
ch_pos = {label[ii]: this_xyz
for ii, this_xyz in enumerate(xyz) if kind[ii] == 'eeg'}
Expand Down
10 changes: 3 additions & 7 deletions mne/io/brainvision/tests/data/test.hpts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Ascii stylus data file created by FastSCAN V4.0.7 on Thu Oct 17 12:30:44 2013
# raw surface, 86 visible points, bounding box reference
# x y z

cardinal nasion -5.6729 -12.3873 -30.3671
cardinal lpa -37.6782 -10.4957 91.5228
cardinal rpa -131.3127 9.3976 -22.2363
cardinal 2 -5.6729 -12.3873 -30.3671
cardinal 1 -37.6782 -10.4957 91.5228
cardinal 3 -131.3127 9.3976 -22.2363
hpi 1 -30.4493 -11.8450 83.3601
hpi 2 -122.5353 9.2232 -28.6828
hpi 3 -6.8518 -47.0697 -37.0829
Expand Down

0 comments on commit 2c2488c

Please sign in to comment.