[Mne_analysis] saving an stc file with mne-python

Eric Larson larson.eric.d at gmail.com
Fri May 2 14:59:23 EDT 2014
Search archives:

Hey Will,

You should just be able to do "cond1_subj_stc.save(...)" directly, as it
looks like it is itself a SourceEstimate (what mne-python turns .stc files
into when you read them). When manually constructing a SourceEstimate
(which I don't think is what you want to do), the first argument needs to
be a `numpy.ndarray`, not another SourceEstimate (which I think is what
"cond1_subj_stc" is).

Cheers,
Eric



On Fri, May 2, 2014 at 11:55 AM, William W. Graves <
william.graves at rutgers.edu> wrote:

> 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
>
> _______________________________________________
> 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/20140502/949dc3b2/attachment.html 


More information about the Mne_analysis mailing list