[Mne_analysis] ctf file issues

Alexandre Gramfort alexandre.gramfort at telecom-paristech.fr
Thu Jul 31 19:53:33 EDT 2014
Search archives:

hi Will,

I just fixed the pb on current master. The fix will be included in
v0.8.1 in a few days.

https://github.com/mne-tools/mne-python/commit/597681d9a7f9516bc8275053001b070f02f287a2

Alex

On Wed, Jul 30, 2014 at 8:37 PM, Denis-Alexander Engemann
<denis.engemann at gmail.com> wrote:
> Hi Will,
>
> I meanwhile opened an issue on github. People interested in the solution can
> follow the development there.
>
> Best,
> Denis
>
>
>
> On Wed, Jul 30, 2014 at 8:17 PM, Denis-Alexander Engemann
> <denis.engemann at gmail.com> wrote:
>>
>> Hi Will,
>>
>> sorry for the confusion.
>>
>> This line would work (crop makes a copy by default and `None` is only
>> valid for Epochs and Evokeds):
>>
>> raw.crop(0, 0.1, copy=False)
>> raw.save('my-ctf-raw.fif')
>>
>> # should fit into an email as attachment
>>
>> Since I don't know the CTF system very well the channels don't help as
>> such. It's more relevant what's in the raw.info dict, actually the type
>> information used inside the plotting routine is not inferred from the
>> channels names.
>>
>> Denis
>>
>>
>>
>> On Wed, Jul 30, 2014 at 8:09 PM, <wgraves at psychology.rutgers.edu> wrote:
>>>
>>> Hi Denis,
>>>
>>> Thanks for the suggestions, and for being willing to take a look at a
>>> snippet of data. Unfortunatley, when I run the first command you have as
>>> written, this happens:
>>>
>>>
>>> ---------------------------------------------------------------------------
>>> ValueError                                Traceback (most recent call
>>> last)
>>> <ipython-input-55-ddfaa452efda> in <module>()
>>> ----> 1 raw.crop(None, 0.1)
>>>
>>> /home/wgraves/data/ld_meg/scripts/src/mne/mne/fiff/base.pyc in crop(self,
>>> tmin, tmax, copy)
>>>     606             raise ValueError('tmin must be less than tmax')
>>>     607         if tmin < 0.0:
>>> --> 608             raise ValueError('tmin must be >= 0')
>>>     609         elif tmax > max_time:
>>>     610             raise ValueError('tmax must be less than or equal to
>>> the max raw '
>>>
>>> ValueError: tmin must be >= 0
>>>
>>>
>>> So I tried this instead, which seems to work:
>>> In [56]: raw.crop(1,1.1)
>>> Out[56]: <Raw  |  n_channels x n_times : 303 x 61>
>>>
>>> However, when I run:
>>> raw.save('test-ctf_raw.fif')
>>>
>>> it proceeds to save all 370 seconds of the file.
>>>
>>> Anyway, I guess you must be right about the channel names, because when I
>>> run:
>>> In [54]: raw.ch_names
>>>
>>> I get this:
>>> Out[54]:
>>> ['UPPT001',
>>>  'SCLK01-177',
>>>  'BG1-3805',
>>>  'BG2-3805',
>>>  'BG3-3805',
>>>  'BP1-3805',
>>>  'BP2-3805',
>>>  'BP3-3805',
>>>  'BR1-3805',
>>>  'BR2-3805',
>>>  'BR3-3805',
>>>  'G11-3805',
>>>  'G12-3805',
>>>  'G13-3805',
>>>  'G22-3805',
>>>  'G23-3805',
>>>  'P11-3805',
>>>  'P12-3805',
>>>  'P13-3805',
>>>  'P22-3805',
>>>  'P23-3805',
>>>  'Q11-3805',
>>>  'Q12-3805',
>>>  'Q13-3805',
>>>  'Q22-3805',
>>>  'Q23-3805',
>>>  'R11-3805',
>>>  'R12-3805',
>>>  'R13-3805',
>>>  'R22-3805',
>>>  'R23-3805',
>>>  'MLC11-3805',
>>>  'MLC12-3805',
>>>  'MLC13-3805',
>>>  'MLC14-3805',
>>>  'MLC15-3805',
>>>  'MLC16-3805',
>>>  'MLC17-3805',
>>>  'MLC21-3805',
>>>  'MLC22-3805',
>>>  'MLC23-3805',
>>>  'MLC24-3805',
>>>  'MLC25-3805',
>>>  'MLC31-3805',
>>>  'MLC32-3805',
>>>  'MLC41-3805',
>>>  'MLC42-3805',
>>>  'MLC51-3805',
>>>  'MLC52-3805',
>>>  'MLC53-3805',
>>>  'MLC54-3805',
>>>  'MLC55-3805',
>>>  'MLC61-3805',
>>>  'MLC62-3805',
>>>  'MLC63-3805',
>>>  'MLF11-3805',
>>>  'MLF12-3805',
>>>  'MLF13-3805',
>>>  'MLF14-3805',
>>>  'MLF21-3805',
>>>  'MLF22-3805',
>>>  'MLF23-3805',
>>>  'MLF24-3805',
>>>  'MLF25-3805',
>>>  'MLF31-3805',
>>>  'MLF32-3805',
>>>  'MLF33-3805',
>>>  'MLF34-3805',
>>>  'MLF35-3805',
>>>  'MLF41-3805',
>>>  'MLF42-3805',
>>>  'MLF43-3805',
>>>  'MLF44-3805',
>>>  'MLF45-3805',
>>>
>>> and so on... with nothing that looks like those nice, sensible channel
>>> names you listed.
>>>
>>> I suppose I somehow need to pair the CTF channle selections file with
>>> this
>>> dataset, but outside of the interactive mne_browse_raw interace, I don't
>>> know how to do that.
>>>
>>> Thanks,
>>> Will
>>>
>>>
>>> > Hi will,
>>> >
>>> > could you share a small snippet (e.g. 100 ms) of your data like that:
>>> >
>>> > raw.crop(None, 0.1)
>>> > raw.save('my-ctf-raw.fif')
>>> >
>>> > I suspect there is some channel type in your data whic is not
>>> > classified
>>> > as
>>> > one of these:
>>> >
>>> > ['eeg', 'eog', 'ecg', 'emg', 'ref_meg', 'stim', 'resp', 'misc', 'chpi',
>>> > 'syst', 'ias', 'exci']
>>> >
>>> > Maybe your reference channels are not marked as such.
>>> > You could try to identify them by name and remove them just for the
>>> > purpose
>>> > of plotting using
>>> >
>>> > `raw.drop_channels(channel_names)`
>>> >
>>> > Best,
>>> > Denis
>>> >
>>> > On Wed, Jul 30, 2014 at 6:00 PM, <wgraves at psychology.rutgers.edu>
>>> > wrote:
>>> >
>>> >> Hello MNE Experts,
>>> >>
>>> >> In trying to deal with CTF files for the first, time I'm running into
>>> >> some
>>> >> issues that I don't understand and hope someone can easily help with.
>>> >> I
>>> >> used the mne_ctf2fiff command to convert to fiff, but I can't
>>> >> visualize
>>> >> the resulting file in mne_browse_raw (it loads without error but just
>>> >> looks blank). Similarly, all the steps for loading a segment of the
>>> >> file
>>> >> as raw data in mne_python work without error, until I do "raw.plot()",
>>> >> when I get this error:
>>> >>
>>> >> In [20]: raw.plot()
>>> >>
>>> >> ---------------------------------------------------------------------------
>>> >> RuntimeError                              Traceback (most recent call
>>> >> last)
>>> >> <ipython-input-20-d4ffb847f525> in <module>()
>>> >> ----> 1 raw.plot()
>>> >>
>>> >> /home/wgraves/data/ld_meg/scripts/src/mne/mne/fiff/base.pyc in
>>> >> plot(raw,
>>> >> events, duration, start, n_channels, bgcolor, color, bad_color,
>>> >> event_color, scalings, remove_dc, order, show_options, title, show,
>>> >> block)
>>> >>     846         return plot_raw(raw, events, duration, start,
>>> >> n_channels,
>>> >> bgcolor,
>>> >>     847                         color, bad_color, event_color,
>>> >> scalings,
>>> >> remove_dc,
>>> >> --> 848                         order, show_options, title, show,
>>> >> block)
>>> >>     849
>>> >>     850     @verbose
>>> >>
>>> >> /home/wgraves/data/ld_meg/scripts/src/mne/mne/viz.pyc in plot_raw(raw,
>>> >> events, duration, start, n_channels, bgcolor, color, bad_color,
>>> >> event_color, scalings, remove_dc, order, show_options, title, show,
>>> >> block)
>>> >>    2778     inds = np.concatenate(inds).astype(int)
>>> >>    2779     if not len(inds) == len(info['ch_names']):
>>> >> -> 2780         raise RuntimeError('Some channels not classified,
>>> >> please
>>> >> report '
>>> >>    2781                            'this problem')
>>> >>    2782
>>> >>
>>> >> RuntimeError: Some channels not classified, please report this problem
>>> >>
>>> >> Unfortunately, the data were collected in short epochs keyed to the
>>> >> events
>>> >> rather than continuously. My original plan was to use
>>> >> mne.fiff.concatenate_raws to concatenate across epochs/events, but I
>>> >> couldn't figure out how to make that work either (perhaps because I
>>> >> don't
>>> >> know what the "raw" argument is supposed to look like, and I can't
>>> >> find
>>> >> an
>>> >> example).
>>> >>
>>> >> Anyway, I would gratly appreciate any help or insight anyone can
>>> >> share.
>>> >>
>>> >> Thanks,
>>> >> Will
>>> >>
>>> >> _______________________________________________
>>> >> 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
>>> >
>>> >
>>> > 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
>>
>>
>
>
> _______________________________________________
> 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.
>



More information about the Mne_analysis mailing list