[Mne_analysis] Evoked setno = 0 in MNE python

Martin Luessi mluessi at nmr.mgh.harvard.edu
Fri Aug 10 16:50:57 EDT 2012
Search archives:

Kam,

On 08/10/12 16:32, Kambiz Tavabi wrote:
> Martin,
>
> Thanks for your response. In the past I have used the MNE command line
> tools to work. I didn't recall the mne_do_inverse_operator program
> requiring a setno argument. In any case, for the data in question I
> computed the noise cov matrix using a cov description file defining all
> the events in my dataset(s). I presume this is what you mean by using
> all different sets to compute the noise cov matrix?

Yes, this is what I meant.

> I also recall that the MNE command line tools to create STC files
> required specific set number arguments to compute and visualize
> solutions. So I must loop through the different conditions to create STC
> files. That makes sense.

Correct.

> What I still don't get is why the python tutorials use setno=0, and not
> a number between 1 and 4 which corresponds to the conditions in the
> sample_audvis-ave.fif dataset, as well as the category event definitions
> in audvis.ave in the sample dataset. Does the numbering for setno
> argument begin from 0 or 1?

Its starts with 0. In Python, indices start with 0, so it makes sense.

> Also, thanks for the flip trick code, I haven't tried it yet but you'll
> likely be hearing from me again soon on the list.

You're welcome. We should add some code to mne-python to simplify the 
averaging over labels. I add it to my todo list.

Best,

Martin

> cheers
> Kam
>
> On 08/10/2012 07:25 AM, Martin Luessi wrote:
>> Kam,
>>
>> See my answers below.
>> On 08/10/12 01:57, Kambiz Tavabi wrote:
>>> Hello list,
>>> I am a bit confused about a couple instances of defining setno = 0 while
>>> loading evoked data in the context of (1) computing an inverse operator
>>> & (2) computing inverse solution on evoked data, using MNE-python. The
>>> exact line is as follows; evoked = Evoked(fname_evoked, setno=0,
>>> baseline=(None, 0)). What does this mean? Does setno = 0 in above (1)
>>> default to an inverse operator for each condition in the evoked data
>>> set; and similarly does setno=0 result in an stc file for all conditions
>>> in (2). If I am wrong, then should I be looping through condition
>>> numbers?
>>
>> The MNE command line tools can create .fif files with multiple evoked
>> responses. If you look at the sample data set, there is is a file
>> "audvis.ave", which specifies the averaging preferences. The resulting
>> "sample_audvis-ave.fif" contains four evoked responses, one for each
>> condition.
>>
>> In mne-python, an Evoked object can only contain a single evoked
>> response. So when loading a .fif file produced with MNE that contains
>> multiple responses (sets), you have to use "setno" to specify which
>> one to load. At this point mne-python doesn't support writing evoked
>> .fif files with multiple sets.
>>
>> This is not directly related to the inverse operator. Assuming you
>> compute the inverse operator using a noise covariance matrix computed
>> using all the different sets, you can use it for all the evoked
>> responses in the same .fif file (as they all have the same measurement
>> information).
>>
>>> And, in python for dummies lingo, how does one compute the mean
>>> activation time series in a label?
>>
>> If you have a label file and an .stc file, you can use
>> mne.label_time_courses() to get the time courses for a label, it will
>> return the time courses for all vertices in the label. You then can
>> simply average the time courses, or use the sign flip trick, i.e.,
>>
>> values, times, vertices = label_time_courses(label_fname, stc_fname)
>>
>> label = mne.read_label(label_fname)
>> flip = mne.label_sign_flip(label, inv['src'])  # inv is the inverse op.
>>
>> label_mean = np.mean(flip[:, None] * values, axis=0)
>>
>> "flip" is a vector with +1 and -1 values, one for each time course in
>> the label. It is computed using the orientation of the vertices. This
>> is the same way MNE computes label averages.
>>
>> I hope this helps,
>>
>> Martin
>>
>>
>>
>>> FYI the argument setno=0 is used in tutorials found @:
>>> http://martinos.org/mne/auto_examples/inverse/plot_make_inverse_operator.html
>>>
>>> http://martinos.org/mne/auto_examples/inverse/plot_compute_mne_inverse.html
>>>
>>>
>>> Thanks in advance
>>> Kam
>>> _______________________________________________
>>> 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