[Mne_analysis] single-trial mne sources

Marijn van Vliet w.m.vanvliet at gmail.com
Fri Jun 22 11:55:47 EDT 2018
Search archives:

Dear Sébastien & Yair,

with the default settings the SourceEstimate object only contains the magnitude of the source currents, but not the direction. Try using pick_ori=‘vector’, which keeps the full vector source estimate. See: https://martinos.org/mne/stable/auto_tutorials/plot_dipole_orientations.html   After averaging, you can use the .magnitude() method to drop the directionality if desired to obtain the traditional ‘blobs’ view.

best,
Marijn.

> On 22 Jun 2018, at 18:08, MARTI Sébastien INSERM <sebastien.marti at cea.fr> wrote:
> 
>         External Email - Use Caution        
> 
> 
> Dear MNE users,
> We are trying to perform source localization at the single trial. For a reason we don't understand, the results we obtain when applying the inverse operator on each trial and then computing the average across trials do not really make sense when compared to applying the inverse operator to the averaged epochs. In other words, applying the inverse operator on the evoked object doesn't seem to be equivalent to averaging across trials the sources from each trial. We expected the two to be equivalent since the inverse operation is linear, but perhaps due to regularization, or another reason, the two shouldn't be the same.
>  
> If any of you had an example script for source localization at the single trial level it would help us to understand what we are doing wrong.
> We have also looked at this example on mne website: "Compute MNE-dSPM inverse solution on single epochs", but didn't find the solution there.
>  
> Many thanks in advance
>  
> Best
>  
> Sébastien & Yair
>  
>  
> Some details:
> mne version: 0.16.dev0
>  
> OS: Ubuntu 16.04
>  
> Code:
>  
>  
>         '''
>         apply inverse operator and compare conditions
>         '''
>  
>         import sys
>         import os
>         from os.path import join
>  
>         import mne
>         from mne import morph_data
>         from mne.source_space import (setup_source_space, morph_source_spaces,
> add_source_space_distances)
>         from mne.minimum_norm import (make_inverse_operator, read_inverse_operator, apply_inverse_epochs)
>         from sentcomp_epoching import get_condition
>         import numpy as np
>         import numpy.matlib
>  
>         data_path = '/neurospin/meg/meg_tmp/sentcomp_Marti_2016/Seb/data'
>         subjects_dir = join(data_path, 'anatomy', 'subjects')
>         meg_dir = join(data_path, 'sss')
>  
>         os.environ['SUBJECTS_DIR'] = subjects_dir
>         os.environ['MEG_DIR'] = meg_dir
>  
>         speed_oi = 4
>         if speed_oi==1:
>             real_speed = .083
>         elif speed_oi==2:
>             real_speed = .116
>         elif speed_oi==3:
>             real_speed = .166
>         elif speed_oi==4:
>             real_speed = .301
>  
>         # read epochs
>         epochs = mne.read_epochs(join(data_path, 'epochs',  subject + '_speed'
> + str(speed) + '_V2-epo.fif'))
>         epochs.apply_baseline(baseline=(-0.76,-0.3), verbose=None)
>  
>         # read inverse operator
>         inv_meg = read_inverse_operator(join(data_path, 'sources', subject +
> '-meg-oct-6-meg-inv.fif'))
>  
>         # get conditions
>         knames2, ep2 = get_condition(conditions=c2,epochs=epochs,startTime=-.2,
> duration=1.5,real_speed=real_speed)
>         if timelock_to_word==True:
>                 ev2 = ep2.average()
>         else:
>                 ev2 = epochs[knames2].average()
>                 ep2 = epochs[knames2]
>  
>         snr = 3.0
>         lambda2 = 1./snr**2
>  
>         # apply inverse operator
>         stc_meg2 = apply_inverse_epochs(ep2, inv_meg, lambda2=lambda2, method='MNE', pick_ori=None, nave=1)
>         av_stc_meg2 = np.mean(stc_meg2) # average of inverse
>  
>          ev_stc_meg2 = apply_inverse(ev2, inv_meg, lambda2=lambda2, method='MNE', pick_ori=None) # inverse of average
>  
>          av_stc_meg2.plot(subject='am150105', surface='inflated', hemi='lh', smoothing_steps=12, time_viewer=True, subjects_dir=subjects_dir, figure=None, views='lat', backend='mayavi', time_unit='ms', spacing='oct6')
>          ev_stc_meg2.plot(subject='am150105', surface='inflated', hemi='lh', smoothing_steps=12, time_viewer=True, subjects_dir=subjects_dir, figure=None, views='lat', backend='mayavi', time_unit='ms', spacing='oct6')
>  
>  
>  
> _______________________________________________
> 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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1386 bytes
Desc: not available
Url : http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180622/d429b3e4/attachment.bin 
-------------- next part --------------
        External Email - Use Caution        
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180622/d429b3e4/attachment.html 


More information about the Mne_analysis mailing list