[Mne_analysis] mne.write_cov error

mlgeliliangao mlgeliliangao at 126.com
Fri Apr 29 07:27:07 EDT 2016
Search archives:

不一定。
我想把成对的功能连接值重回大脑显示,这个老美的讨论是否给你提示呢,所以,转给你了

发自我的 iPad

> 在 2016年4月29日,6:21,JR KING <jeanremi.king at gmail.com> 写道:
> 
> Dear Peng,
> 
> You shouldn't save your covariance in a text file. Covariance object contains headers/metadata
> 
> You should do:
> 
> import mne
> epochs = mne.read_epochs(epochs_path) 
> 
> # compute covariance
> cov = mne.compute_covariance(epochs, tmax=0.)
> 
> # save covariance object
> cov.save('my_file-cov.fif')
> 
> # read covariance object
> cov = mne.read_cov(fname_cov)
> 
> 
> Try following the website tutorials first:
> http://martinos.org/mne/dev/auto_examples/io/plot_read_noise_covariance_matrix.html#sphx-glr-auto-examples-io-plot-read-noise-covariance-matrix-py
> http://martinos.org/mne/dev/faq.html#how-should-i-regularize-the-covariance-matrix
> 
> Best,
> 
> Jean-Rémi
> 
> 
> 
>> On 28 April 2016 at 17:17, Peng Zan <zanpeng.pz at gmail.com> wrote:
>> Dear mne expert,
>> 
>> I wanted to write a covariance matrix into a *-cov.fif file using python command 'mne.write_cov' but failed. I saved the covariance matrix into a txt file 'R2262.txt' and then read it via python to cov_matrix. The error occurred in the step of 'write_cov'. In tutorial, only file name and the matrix are needed. Everything should be correct but it said 'str' had no attribute 'save'. The detail is as follows.
>> 
>> >>> cov = open('/Users/Peng/Documents/MNE/MNE_analysis/MNE_TRFs/MEG/R2262_S0807/R2262cov.txt'); cov_matrix = cov.read()
>> 
>> >>> mne.write_cov('/Users/Peng/Documents/MNE/MNE_analysis/MNE_TRFs/MEG/R2262_S0807/R2262_trf-cp-cov.fif',cov_matrix)
>> 
>> Traceback (most recent call last):
>> 
>>   File "<stdin>", line 1, in <module>
>> 
>>   File "/Users/Peng/Library/Python/2.7/lib/python/site-packages/mne-0.12.dev0-py2.7.egg/mne/cov.py", line 1181, in write_cov
>> 
>>     cov.save(fname)
>> 
>> AttributeError: 'str' object has no attribute 'save'
>> 
>> 
>> 
>> Do you have any idea how should this work?
>> 
>> Thank you very much!
>> 
>> Sincerely,
>> 
>> Peng
>> 
>> 
>> _______________________________________________
>> 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/20160429/048f2863/attachment.html 


More information about the Mne_analysis mailing list