Skip to content

#3613 causes problems with loading .elps #3684

@jona-sassenhagen

Description

@jona-sassenhagen

After #3613, loading a normal .elp file, I get

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-11-eab9d558a983> in <module>()
      1 fname = fnames[2]
----> 2 mne.io.read_raw_brainvision(fname, montage=montage, preload=True, eog=[])

/home/FB/fb05/sassenha/tools/mne-python/mne/io/brainvision/brainvision.py in read_raw_brainvision(vhdr_fname, montage, eog, misc, scale, preload, response_trig_shift, event_id, verbose)
    689                           misc=misc, scale=scale, preload=preload,
    690                           response_trig_shift=response_trig_shift,
--> 691                           event_id=event_id, verbose=verbose)

/home/FB/fb05/sassenha/tools/mne-python/mne/io/brainvision/brainvision.py in __init__(self, vhdr_fname, montage, eog, misc, scale, preload, response_trig_shift, event_id, verbose)

/home/FB/fb05/sassenha/tools/mne-python/mne/utils.py in verbose(function, *args, **kwargs)
    682         with use_log_level(verbose_level):
    683             return function(*args, **kwargs)
--> 684     return function(*args, **kwargs)
    685 
    686 

/home/FB/fb05/sassenha/tools/mne-python/mne/io/brainvision/brainvision.py in __init__(self, vhdr_fname, montage, eog, misc, scale, preload, response_trig_shift, event_id, verbose)
     83             vhdr_fname, eog, misc, scale, montage)
     84         events = _read_vmrk_events(mrk_fname, event_id, response_trig_shift)
---> 85         _check_update_montage(info, montage)
     86         with open(info['filename'], 'rb') as f:
     87             f.seek(0, os.SEEK_END)

/home/FB/fb05/sassenha/tools/mne-python/mne/io/base.py in _check_update_montage(info, montage, path, update_ch_names)
   2246         if montage is not None:
   2247             if isinstance(montage, string_types):
-> 2248                 montage = read_montage(montage, path=path)
   2249             _set_montage(info, montage, update_ch_names=update_ch_names)
   2250 

/home/FB/fb05/sassenha/tools/mne-python/mne/channels/montage.py in read_montage(kind, ch_names, path, unit, transform)
    267                                   for h, a in zip(horiz, az)]))
    268         pol = radius * np.pi
--> 269         pos = _sph_to_cart(np.array([np.ones(len(az)) * 85., az, pol])).T
    270     elif ext == '.hpts':
    271         # MNE-C specified format for generic digitizer data

/home/FB/fb05/sassenha/tools/mne-python/mne/transforms.py in _sph_to_cart(sph)
    583 def _sph_to_cart(sph):
    584     """Convert spherical coordinates to Cartesion coordinates."""
--> 585     assert sph.ndim == 2 and sph.shape[1] == 3
    586     sph = np.atleast_2d(sph)
    587     out = np.empty((len(sph), 3))

AssertionError: 

The problem is that the input to _sph_to_cart has shape (3, 368), but the second dimension should be 3, not the first. There should have been a test for this ...

@Eric89GXL

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions