[Mne_analysis] saving an stc file with mne-python

William W. Graves william.graves at rutgers.edu
Fri May 2 14:55:07 EDT 2014
Search archives:

Hi MNE Experts,

In trying to use mne-python to save an stc file, I used to use
mne.write_stc(), but that seems to be deprecated in the latest version. So
now I'm trying to save my output at an stc file this way:

sources = mne.SourceEstimate(data=cond1_subj_stc,
vertices=cond1_subj_stc.vertno, tmin=cond1_subj_stc.tmin,
tstep=cond1_subj_stc.tstep)

filename = (data_path + 'w_nw_dSPM_0p1_40Hz')

sources.save(filename, ftype='stc')

But when I do that, the last step gives this error:

In [69]: sources.save(filename, ftype='stc')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-69-b69543b93fac> in <module>()
----> 1 sources.save(filename, ftype='stc')

/home/wgraves/data/ld_meg/scripts/src/mne/mne/source_estimate.py in
save(self, fname, ftype, verbose)

/home/wgraves/data/ld_meg/scripts/src/mne/mne/utils.py in
verbose(function, *args, **kwargs)
    390         return ret
    391     else:
--> 392         ret = function(*args, **kwargs)
    393         return ret
    394

/home/wgraves/data/ld_meg/scripts/src/mne/mne/source_estimate.py in
save(self, fname, ftype, verbose)
   1012             raise ValueError('ftype must be "stc" or "w", not
"%s"' % ftype)
   1013
-> 1014         lh_data = self.data[:len(self.lh_vertno)]
   1015         rh_data = self.data[-len(self.rh_vertno):]
   1016

TypeError: 'SourceEstimate' object has no attribute '__getitem__'

My "lh_data" and "rh_data" structures seem fine. For example,
shape(lh_data) gives:
Out[72]: (10242, 707)

I'd really appreciate any help you can give.

Thanks,
Will

---
William W. Graves, Ph.D.
Assistant Professor, Department of Psychology
Rutgers, The State University of New Jersey
Smith Hall, Room 337
101 Warren Street, Newark, NJ  07102
Voice: 973-353-3947
Fax: 973-353-1171
http://lbbil.rutgers.edu




More information about the Mne_analysis mailing list