Repository: mne-tools/mne-python

Issue:
MNE Read_Montage

I am trying to read in a .htps montage using the read_montage() function, but it looks to be broken. 


```
montage = mne.channels.read_montage(kind=montage1,unit='mm',transform=False) # read in average montage

Traceback (most recent call last):

montage = mne.channels.read_montage(kind=montage1(.htps monatge file)unit='mm',transform=False) # read in average montage

Attribute Error: module 'mne.channels' has no attribute 'read_montage'
```

With the newest version of MNE this should be deprecated not broken. And indeed it's missing from the 0.19 API:

https://mne.tools/stable/python_reference.html#module-mne.channels










Discussion:
use https://mne.tools/stable/generated/mne.channels.read_dig_hpts.html from
the new release.

if you use current master it's broken but if you use the 0.19 release it
should work with a deprecation warning.

>

Using read_dig_hpts produces an error: 

n [294]: mne.channels.read_dig_hpts(montage1)
Traceback (most recent call last):

  File "<ipython-input-294-c5846a31f581>", line 1, in <module>
    mne.channels.read_dig_hpts(montage1)

  File "//anaconda3/lib/python3.7/site-packages/mne/channels/montage.py", line 493, in read_dig_hpts
    return make_dig_montage(ch_pos=ch_pos, **fid, hpi=hpi, hsp=hsp)

TypeError: make_dig_montage() got an unexpected keyword argument '2'


Can you share the file ?

Btw https://github.com/mne-tools/mne-python/blob/maint/0.19/mne/channels/__init__.py shows that read_montage is not removed from stable release 

I downgraded to .19 (was using .20) and things seem to work. Attached is the average montage I am using. 

[biosemi64_LocatorAdultsMedian.hpts.zip](https://github.com/mne-tools/mne-python/files/3683953/biosemi64_LocatorAdultsMedian.hpts.zip)




Resolving patch:
diff --git a/mne/channels/montage.py b/mne/channels/montage.py
--- a/mne/channels/montage.py
+++ b/mne/channels/montage.py
@@ -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
@@ -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'}


Test patch:
diff --git a/mne/io/brainvision/tests/data/test.hpts b/mne/io/brainvision/tests/data/test.hpts
--- a/mne/io/brainvision/tests/data/test.hpts
+++ b/mne/io/brainvision/tests/data/test.hpts
@@ -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