[Mne_analysis] Visualizing power spectrum density of sources on the brain

Denis-Alexander Engemann denis.engemann at gmail.com
Tue Jul 19 16:36:18 EDT 2016
Search archives:

> I noted that in the compute_source_psd code, the output is already scaled
to dB (psd = 10*np.log10(psd) is taken in line 486). Is it still necessary
to take 10*log10 of the output?

Hum... probably not then. I have to go back to see on what my observation
was based, I clearly remember having seen regular unscaled PSDs as outputs
based on MNE normal orientation solutions. Basically make sure you check
histograms, they are informative.

> # Sum the power in the frequency band of interest:
> av_data = np.transpose(np.array([np.sum(data,1)]))  # Shape: numsources*1


you can simplify:

av_data = np.sum(data,1)[:, np.newaxis]  # make it 2d after averaging

or

av_data = np.sum(data, 1, keepdims=True) # make it 2d after averaging

btw. checkout `stc.average`

I cannot promise you to get back to you super quickly, but I would offer
you to share some average PSD data with me and I'd try to plot them to get
a better idea what they look like. We can proceed in private for this if
you prefer.

Cheers,
Denis


On Thu, Jul 14, 2016 at 8:56 PM Gladia Hotan <gladiach at gmail.com> wrote:

> Hi Denis,
>
> Thanks for your reply!
>
> I noted that in the compute_source_psd code, the output is already scaled
> to dB (psd = 10*np.log10(psd) is taken in line 486). Is it still necessary
> to take 10*log10 of the output?
>
> I tried detrending the data prior to computing the inverse solution and
> noise covariance matrix, but I get a similar result in which most of the
> power is localized in the white matter. An example of the average I get
> over many epochs is at this link:
> https://www.dropbox.com/s/vs7jjd8u2szjrbo/Screen%20Shot%202016-07-14%20at%202.19.20%20PM.png?dl=0
>
> I tried plotting spectra (power vs frequency) of the sources and the
> spectra look reasonable; it's just the spatial distribution that's strange.
>
> This is roughly how I'm extracting power at a certain frequency:
>
> # Compute psd of sources:
> stc_psd = mne.minimum_norm.comptue_source_psd(...)
>
> # Extract the frequency band of interest:
> data = stc_psd.data[:,1:5]  # Shape: numsources*4
>
> # Sum the power in the frequency band of interest:
> av_data = np.transpose(np.array([np.sum(data,1)]))  # Shape: numsources*1
>
> # Make a copy of the stc object and overwrite its data:
> stc_psd1 = stc_psd.copy()
> stc_psd1.times = stc_psd_slow.times[0:1]   # Doesn't matter what this
> number is; just get the dimensions right
> stc_psd1._data = av_data
>
> # Visualize:
> mne.viz.plot_source_estimates(stc_psd1,...)
>
> Is there any other troubleshooting method I can try?
>
> Thanks and Best,
> Gladia
>
>
> On Thu, Jul 7, 2016 at 12:22 PM, Denis-Alexander Engemann <
> denis.engemann at gmail.com> wrote:
>
>> Sorry Gladia,
>>
>> I was a bit unclear I fear. I was referring to the fact, that if you want
>> to see things in dB and want to look at the power spectrum in one ROI or
>> vertex the same way you want to look at it in the sensor space, you need to
>> use the MNE option. You can then intuitively take the decadic logarithm and
>> scale to dB.
>> Then for the surface plotting it is a bit tricky with regard to color
>> maps. Both dSPM and MNE can be intuitively used but the entire MNE viz
>> system sort of expects time domain data as you may have noticed, where data
>> are dont' have any tend.
>> With frequency domain data this is not the case, you have local peaks but
>> a global 1/f trend which will mess up your display. You then either need to
>> detrend the spectrum or choose fmin, fmid, fmax, carefully, essentially
>> setting them at each frequency where you make sure that your stc.times
>> vector is not longer than 1; by default histograms for determining viz
>> values are computed over all time points so the auto option won't work.
>> Lot's of manual tuning required unfortunately.
>> As to your plots I'm not fully sure I get your message. Intuitively make
>> sure you get the relationship between the time domain and the specteal data
>> right, maybe the time domain localization is driven by a certain band. And
>> as said, colormaps can be difficult and misleading. Plotting historgrams
>> along the way and looking at slices can help understand what you do.
>>
>> I hope this helps a bit,
>> Denis
>>
>>
>> On Thu, Jul 7, 2016 at 4:04 PM Gladia Hotan <gladiach at gmail.com> wrote:
>>
>>> Thanks Alex!
>>>
>>> I am wondering why when I plot the psd on the brain I get a lot of
>>> activity in the corpus callosum and white matter rather than in the grey
>>> matter, which is where the sources are localized to. Here is a link to
>>> example screenshots of the source distribution vs the psd distribution on
>>> the brain, which don't seem to match:
>>> https://www.dropbox.com/sh/blstn3xitewbg5t/AACia--q9mF6d0ZjluhXq_TGa?dl=0
>>>
>>>  How can I check that the source psd is being plotted correctly?
>>>
>>> Thanks and Best,
>>> Gladia
>>>
>>>
>>> On Tue, Jul 5, 2016 at 4:54 PM, Alexandre Gramfort <
>>> alexandre.gramfort at telecom-paristech.fr> wrote:
>>>
>>>> > Could anyone explain why MNE should be used instead of dSPM to get
>>>> the power
>>>> > plots? The tutorial on the MNE website says to use dSPM as the solver.
>>>>
>>>> dSPM is just a normalized/scaled version of MNE (scaling is obtained
>>>> form the noise standard deviation derived from the noise cov). So
>>>> basically it's just a scaling factor. If you apply a baseline /
>>>> contrast with a log ratio of power then there is no diff between the
>>>> 2.
>>>>
>>>> HTH
>>>> Alex
>>>> _______________________________________________
>>>> 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
>>
>>
>> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160719/453ccee1/attachment.html 


More information about the Mne_analysis mailing list