[Mne_analysis] Type Error in adaptation of example plot_source_space_time_frequency.py

David Leitman leitman at mail.med.upenn.edu
Sun Mar 9 15:57:58 EDT 2014
Search archives:

Hi thanks will do and will try wilth sample data when I get to work tomorrow 

Dave

Sent from my iPhone

> On Mar 9, 2014, at 7:50 AM, Martin Luessi <mluessi at nmr.mgh.harvard.edu> wrote:
> 
> Hi David,
> 
> It seems to me that you get this error because you use lists for the
> bands instead of arrays. Try to use
> 
> import numpy as np
> bands = dict(theta=np.array([3, 8]), alpha=np.array([9, 11]),
>             beta=np.array([18, 22]), gamma=np.array([30, 80]))
> 
> If this works we will also fix the code so that it works with lists.
> 
> Best,
> 
> Martin
> 
> 
>> On 03/09/14 03:49, Alexandre Gramfort wrote:
>> hi David,
>> 
>> can you reproduce the problem with the sample data?
>> could you share a gist on https://gist.github.com/ ?
>> 
>> thanks
>> Alex
>> 
>> 
>> On Sat, Mar 8, 2014 at 9:47 PM, David Leitman
>> <leitman at mail.med.upenn.edu> wrote:
>>> Hi all,
>>> 
>>> I get the following error when I try the following using my constructed ROI labels : Any pointers would be much appreciated :)
>>> 
>>> thanks// dave
>>> 
>>> script snippet:
>>> 
>>> 
>>> print __doc__
>>> 
>>> import mne
>>> from mne import fiff
>>> 
>>> from mne.minimum_norm import  source_band_induced_power
>>> epochs=mne.read_epochs(fname_epoched, proj= True)
>>> bands = dict(theta= [3, 8], alpha=[9, 11], beta=[18, 22], gamma=[30, 80])
>>> 
>>> stcs = source_band_induced_power(epochs, label, inverse_operator, bands, n_cycles=2,
>>>                                 use_fft=False, n_jobs=1)
>>> 
>>> for b, stc in stcs.iteritems():
>>>    stc.save('induced_power_%s' % b)
>>> 
>>> ###############################################################################
>>> # plot mean power
>>> import matplotlib.pyplot as plt
>>> plt.plot(stcs['alpha'].times, stcs['alpha'].data.mean(axis=0), label='Alpha')
>>> plt.plot(stcs['beta'].times, stcs['beta'].data.mean(axis=0), label='Beta')
>>> plt.plot(stcs['beta'].times, stcs['beta'].data.mean(axis=0), label='Theta')
>>> plt.plot(stcs['beta'].times, stcs['beta'].data.mean(axis=0), label='Gamma')
>>> plt.xlabel('Time (ms)')
>>> plt.ylabel('Power')
>>> plt.legend()
>>> plt.title('Mean source induced power')
>>> plt.show()
>>> 
>>> 
>>> error:
>>> 
>>> ---------------------------------------------------------------------------
>>> TypeError                                 Traceback (most recent call last)
>>> <ipython-input-11-2aeed705510d> in <module>()
>>>      1 bands = dict(theta=[3, 8], alpha=[9, 11], beta=[18, 22], gamma=[30, 80])
>>>      2
>>> ----> 3 BFstcs = source_band_induced_power(epochs, label, inverse_operator, bands, n_cycles=2, use_fft=False, n_jobs=1)
>>> 
>>> /home/leitman/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mne-0.7.1-py2.7.egg/mne/utils.pyc in dec(*args, **kwargs)
>>>    378             return ret
>>>    379         else:
>>> --> 380             return function(*args, **kwargs)
>>>    381
>>>    382     # set __wrapped__ attribute so ?? in IPython gets the right source
>>> 
>>> /home/leitman/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mne-0.7.1-py2.7.egg/mne/minimum_norm/time_frequency.pyc in source_band_induced_power(epochs, inverse_operator, bands, label, lambda2, method, nave, n_cycles, df, use_fft, decim, baseline, baseline_mode, pca, n_jobs, verbose)
>>>     84
>>>     85     frequencies = np.concatenate([np.arange(band[0], band[1] + df / 2.0, df)
>>> ---> 86                                  for _, band in bands.iteritems()])
>>>     87
>>>     88     powers, _, vertno = _source_induced_power(epochs,
>>> _______________________________________________
>>> 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
> 
> 
> -- 
> Martin Luessi, Ph.D.
> 
> Research Fellow
> 
> Department of Radiology
> Athinoula A. Martinos Center for Biomedical Imaging
> Massachusetts General Hospital
> Harvard Medical School
> 149 13th Street
> Charlestown, MA 02129
> 
> Fax: +1 617 726-7422




More information about the Mne_analysis mailing list