[Mne_analysis] Volume Source Space Orientation

Zhongnan Fang zhongnan at alumni.stanford.edu
Tue May 15 17:06:50 EDT 2018
Search archives:

        External Email - Use Caution        

Hi all,

I tested Christian's commit and it works great for my need. I also tested
it with the following code adapted from the MNE example.

Thanks again everyone! You are AWESOME!

Best,
Zhongnan


import matplotlib.pyplot as plt

from nilearn.plotting import plot_stat_map
from nilearn.image import index_img

from mne.datasets import sample
from mne import read_evokeds
from mne.minimum_norm import apply_inverse, read_inverse_operator

import numpy as np

data_path = sample.data_path()
fname_inv = data_path + '/MEG/sample/sample_audvis-meg-vol-7-meg-inv.fif'
fname_evoked = data_path + '/MEG/sample/sample_audvis-ave.fif'

snr = 3.0
lambda2 = 1.0 / snr ** 2
method = "dSPM"

# Load data
evoked = read_evokeds(fname_evoked, condition=0, baseline=(None, 0))
inverse_operator = read_inverse_operator(fname_inv)

# Compute inverse solution

# Vector
stc_v = apply_inverse(evoked, inverse_operator, lambda2, method,
pick_ori='vector')
# Magnitude
stc_m = apply_inverse(evoked, inverse_operator, lambda2, method,
pick_ori=None)

# Data converted from vector to the magnitude data
stc_v2m_data = np.sqrt(np.sum(stc_v.data**2,axis=1))
# The magnitude data
stc_m_data = stc_m.data

# Difference between the two
diff = np.sqrt(np.sum(stc_v2m_data-stc_m_data)**2)

print(diff)

The output diff is 1.63549729315e-14


On Tue, May 15, 2018 at 12:12 PM, Zhongnan Fang <
zhongnan at alumni.stanford.edu> wrote:

> Hi all,
>
> I first would like to thank you for the quick response!
>
> I will try to code with the github version to see if it works for me. I
> will keep you guys updated.
>
> Thanks again!
>
> Best,
> Zhongnan
>
> On Tue, May 15, 2018 at 12:09 PM, Christian Markus Brodbeck <
> brodbeck at umd.edu> wrote:
>
>>         External Email - Use Caution
>>
>> Zhongnan, if you’re comfortable with installing a GitHub version you
>> could check whether that solves your issue?
>>
>>
>> > On May 15, 2018, at 3:07 PM, Alexandre Gramfort <
>> alexandre.gramfort at inria.fr> wrote:
>> >
>> >        External Email - Use Caution
>> >
>> > here it is:
>> >
>> > https://github.com/mne-tools/mne-python/pull/5209
>> >
>> > A
>> >
>> > _______________________________________________
>> > 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20180515/a878aa59/attachment.html 


More information about the Mne_analysis mailing list