[Mne_analysis] BrainVision files

Boris BURLE boris.burle at univ-amu.fr
Tue Jan 5 11:56:59 EST 2016
Search archives:

Hi again,

Trying to find the issue, I realized that my installed version of mne 
was pretty old (0.8.6), and that this issue has already been fixed (at 
least it is in the dev version...). I apologize for that...

But I found another issue:

If I read correctly, it looks like line 201 of _read_vmrk_events assumes 
that response triggers name must contain an integer, probably 
considering that the names are "Rxxx", with "xxx" being integers. 
However, this is not a requirement of the file format and, especially 
after some preprocessing, the triggers names may have been changed to 
pure text (for example 'LeftResp'). In this case, the code does not seem 
to work, since 'trigger' is None, and line 206 issues an error:

     trigger += response_trig_shift
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'int'

Am I reading the code correctly?
	
	Thanks in advance,
		B.





On 05/01/2016 13:32, Alexandre Gramfort wrote:
> hi Boris,
>
> our test data are in:
>
> https://github.com/mne-tools/mne-python/tree/master/mne/io/brainvision/tests/data
>
> don't hesitate to share a file so we can patch the reader to fix the issue.
>
> Best,
> Alex
>
> On Tue, Jan 5, 2016 at 10:17 AM, Boris BURLE <boris.burle at univ-amu.fr> wrote:
>> Dear colleagues,
>>
>> I'm just starting to use MNE-python, and I face a problem opening
>> BrainVisionAnalyer files. When calling the
>> "mne.io.read_raw_brainvision", I get the following error (full traceback
>> at the end):
>>
>> --> 462     params, settings = settings.split('[Comment]')
>>       463     cfg = configparser.ConfigParser()
>>       464     if hasattr(cfg, 'read_file'):  # newer API
>>
>> ValueError: need more than 1 value to unpack
>>
>> It appears that 'read_raw_brainvision' is searching for a "section"
>> untitled "Comment" in the header (vhdr) file. I have been using
>> BrainVision files quite a lot (actually, I would like to get rid of it
>> by using mne-python...), and I never encountered such a "Comment" field
>> in my vhdr files. However, I always worked with data **exported** from
>> BrainVision, not acquired with it. So I guess the "Comment" field the
>> parser is searching might come from the files created by
>> BrainVisionRecorder. But since I do not have any such file, I cannot check.
>>
>> I do have python code that, I believe, open all variants of files
>> **exported** from BrainVisionAnalyser (be they ASCII or binary, 16, 32
>> ... bits etc...). The code outputs a dictionary for the header (vhdr)
>> file, a numpy.array for the data, and a list of events for the
>> markers/events/triggers. Although I guess it should also open files
>> created by BrainVisionRecorder, I cannot be sure.
>>
>> So, if someone could provide me with a small file that is currently
>> openable by "mne.io.read_raw_brainvision", I would be happy to check
>> whether my code also open it. And, if you find it useful, I would be
>> more than happy to share the code and adapt it to mne-python (with a bit
>> of help from you, probably ...)
>>
>>     All the best,
>>       B.
>>
>> full traceback:
>> In [4]: mne.io.read_raw_brainvision('COUBA_EMG_PC_CompLeft.vhdr')
>> Extracting eeg Parameters from COUBA_EMG_PC_CompLeft.vhdr...
>> ---------------------------------------------------------------------------
>> ValueError                                Traceback (most recent call last)
>> <ipython-input-4-b9123e703050> in <module>()
>> ----> 1 mne.io.read_raw_brainvision('COUBA_EMG_PC_CompLeft.vhdr')
>>
>> /usr/lib/python2.7/dist-packages/mne/io/brainvision/brainvision.pyc in
>> read_raw_brainvision(vhdr_fname, elp_fname, elp_names, preload,
>> reference, eog, ch_names, verbose)
>>       681     """
>>       682     raw = RawBrainVision(vhdr_fname, elp_fname, elp_names, preload,
>> --> 683                          reference, eog, ch_names, verbose)
>>       684     return raw
>>
>> /usr/lib/python2.7/dist-packages/mne/io/brainvision/brainvision.pyc in
>> __init__(self, vhdr_fname, elp_fname, elp_names, preload, reference,
>> eog, ch_names, verbose)
>>
>> /usr/lib/python2.7/dist-packages/mne/utils.pyc in verbose(function,
>> *args, **kwargs)
>>       549         return ret
>>       550     else:
>> --> 551         ret = function(*args, **kwargs)
>>       552         return ret
>>       553
>>
>> /usr/lib/python2.7/dist-packages/mne/io/brainvision/brainvision.pyc in
>> __init__(self, vhdr_fname, elp_fname, elp_names, preload, reference,
>> eog, ch_names, verbose)
>>        82         self.info, self._eeg_info, events =
>> _get_eeg_info(vhdr_fname,
>>        83
>> elp_fname, elp_names,
>> ---> 84
>> reference, eog)
>>        85         self.set_brainvision_events(events)
>>        86         logger.info('Creating Raw.info structure...')
>>
>> /usr/lib/python2.7/dist-packages/mne/io/brainvision/brainvision.pyc in
>> _get_eeg_info(vhdr_fname, elp_fname, elp_names, reference, eog)
>>       460         settings = f.read()
>>       461
>> --> 462     params, settings = settings.split('[Comment]')
>>       463     cfg = configparser.ConfigParser()
>>       464     if hasattr(cfg, 'read_file'):  # newer API
>>
>> ValueError: need more than 1 value to unpack
>>
>> In [5]:
>> _______________________________________________
>> Mne_analysis mailing list
>> Mne_analysis at nmr.mgh.harvard.edu
>> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>>
>>
>> The information in this e-mail is intended only for the person to whom it is
>> addressed. If you believe this e-mail was sent to you in error and the e-mail
>> contains patient information, please contact the Partners Compliance HelpLine at
>> http://www.partners.org/complianceline . If the e-mail was sent to you in error
>> but does not contain patient information, please contact the sender and properly
>> dispose of the e-mail.
>>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis
>



More information about the Mne_analysis mailing list