<div dir="ltr">Dear JR,<div><br></div><div>I am using mne Version 2.7.3. I also tried python command 'mne_kit2fiff.py' which had 'from <a href="http://mne.io">mne.io</a> import read_raw_kit' at the beginning. But I encountered the error saying that mayavi version was outdated. The error detail is as follows. </div><div><br></div>
<p class=""><span class="">[ISRWKAVW2269A:mne-python/mne/commands] Peng% python mne_kit2fiff.py</span></p>
<p class=""><span class="">Traceback (most recent call last):</span></p>
<p class=""><span class=""> File "mne_kit2fiff.py", line 72, in <module></span></p>
<p class=""><span class=""> run()</span></p>
<p class=""><span class=""> File "mne_kit2fiff.py", line 48, in run</span></p>
<p class=""><span class=""> mne.gui.kit2fiff()</span></p>
<p class=""><span class=""> File "/Users/Peng/Library/Python/2.7/lib/python/site-packages/mne-0.12.dev0-py2.7.egg/mne/gui/__init__.py", line 107, in kit2fiff</span></p>
<p class=""><span class=""> _check_mayavi_version()</span></p>
<p class=""><span class=""> File "/Users/Peng/Library/Python/2.7/lib/python/site-packages/mne-0.12.dev0-py2.7.egg/mne/utils.py", line 832, in _check_mayavi_version</span></p>
<p class=""><span class=""> raise RuntimeError("Need mayavi >= %s" % min_version)</span></p>
<div>RuntimeError: Need mayavi >= 4.3.0</div><div><br></div><div><br></div><div>I have downloaded mayavi-4.4.4 but have trouble making it work with python mne. Do you have any idea how this problem should be solved?</div><div><br></div><div>Thank you very much!</div><div><br></div><div>Sincerely,</div><div>Peng</div>
</div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Apr 16, 2016 at 12:00 PM, <span dir="ltr"><<a href="mailto:mne_analysis-request@nmr.mgh.harvard.edu" target="_blank">mne_analysis-request@nmr.mgh.harvard.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send Mne_analysis mailing list submissions to<br>
<a href="mailto:mne_analysis@nmr.mgh.harvard.edu">mne_analysis@nmr.mgh.harvard.edu</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:mne_analysis-request@nmr.mgh.harvard.edu">mne_analysis-request@nmr.mgh.harvard.edu</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:mne_analysis-owner@nmr.mgh.harvard.edu">mne_analysis-owner@nmr.mgh.harvard.edu</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Mne_analysis digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re: mne.save_stc_as_volume('lcmv_inverse.nii.gz', stc,<br>
fwd['src'], mri_resolution=False) (Alexandre Gramfort)<br>
2. Re: mne_kit2fiff error (JR KING)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Fri, 15 Apr 2016 18:34:02 +0200<br>
From: Alexandre Gramfort <<a href="mailto:alexandre.gramfort@telecom-paristech.fr">alexandre.gramfort@telecom-paristech.fr</a>><br>
Subject: Re: [Mne_analysis]<br>
mne.save_stc_as_volume('lcmv_inverse.nii.gz', stc, fwd['src'],<br>
mri_resolution=False)<br>
To: Discussion and support forum for the users of MNE Software<br>
<<a href="mailto:mne_analysis@nmr.mgh.harvard.edu">mne_analysis@nmr.mgh.harvard.edu</a>><br>
Message-ID:<br>
<CADeotZqDD8MEQy3DyTDxPVtdnFHpEy8YVL=LT9k3f3P2=<a href="mailto:c-Cfg@mail.gmail.com">c-Cfg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset=UTF-8<br>
<br>
please don't paste code in email but use dedicated services like:<br>
<br>
<a href="https://gist.github.com/" rel="noreferrer" target="_blank">https://gist.github.com/</a><br>
<br>
almost if you want someone to test and replicate use an MNE dataset or<br>
make your data available<br>
<br>
A<br>
<br>
On Fri, Apr 15, 2016 at 2:56 PM, parham hashemzadeh <<a href="mailto:ph442@cam.ac.uk">ph442@cam.ac.uk</a>> wrote:<br>
> Dear Dan<br>
> Thank you very much for spending so much time guiding me. In this<br>
> email, I have pasted the complete code from line 1 to last line of the<br>
> code. It is pasted after the first bit of code where I get the error and<br>
> includes the bit of code that gives the error.<br>
><br>
> I implemented your advice, which by the way was very beneficial for me<br>
> for pedagogical reasons.<br>
><br>
> Everything went gone smoothly until, I get the following error:<br>
> --------------------------------<br>
> 99 img = mne.save_stc_as_volume('lcmv_inverse.nii.gz', stc,src,<br>
> mri_resolution=False)<br>
> 100<br>
> 101 t1_fname = data_path + '/subjects/sample/mri/T1.mgz'<br>
><br>
> /home/parham/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mne-0.12.dev0-py2.7.egg/mne/source_estimate.pyc<br>
> in save_stc_as_volume(fname, stc, src, dest, mri_resolution)<br>
> 2649<br>
> 2650 n_times = stc.data.shape[1]<br>
> -> 2651 shape = src[0]['shape']<br>
> 2652 shape3d = (shape[2], shape[1], shape[0])<br>
> 2653 shape = (n_times, shape[2], shape[1], shape[0])<br>
><br>
> KeyError: 'shape'<br>
> --------------------------------<br>
> ----->>>>>>>>>>>>>The COMPLETE CODE is pasted below with some crude<br>
> comments:<br>
> #set up all imports<br>
> import sys<br>
> sys.modules[__name__].__dict__.clear()<br>
><br>
> import numpy as np<br>
> import matplotlib.pyplot as plt<br>
> plt.close("all")<br>
> import mne<br>
> from <a href="http://mne.io" rel="noreferrer" target="_blank">mne.io</a> import Raw<br>
> from mne.beamformer import lcmv<br>
> from nilearn.plotting import plot_stat_map<br>
> from nilearn.image import index_img<br>
> from mne import read_evokeds<br>
> from mne.minimum_norm import apply_inverse, read_inverse_operator<br>
><br>
><br>
> print(__doc__)<br>
> # I have set it up such that the MNE-sample-data is in the home<br>
> directory..<br>
> data_path = '/home/parham/Desktop/MNE-sample-data'<br>
> #raw data file<br>
> raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif'<br>
> trans = data_path + '/MEG/sample/sample_audvis_raw-trans.fif'<br>
> event_fname = data_path + '/MEG/sample/sample_audvis_raw-eve.fif'<br>
> subj = 'sample'<br>
> subjects_dir = data_path + '/subjects'<br>
> aseg_fname = subjects_dir + '/sample/mri/aseg.mgz'<br>
> inner_skull_surf_filename='/home/parham/Desktop/MNE-sample-data/subjects/sample/bem/inner_skull.surf'<br>
> #save the solution to personal code directory.<br>
> dest_bem_dir='/home/parham/Desktop/python_code/sample-5120-5120-5120-bem.fif'<br>
> bem_sol_file='/home/parham/Desktop/python_code/sample-5120-5120-5120-bem-sol.fif'<br>
><br>
> fwd_sol_file='/home/parham/Desktop/python_code/sample_audvis-eeg-vol-fwd.fif'<br>
><br>
> inv_op_file='/home/parham/Desktop/python_code/sample_audvis-eeg-vol-inv.fif'<br>
> ##################### MAke EEG inverse operator############<br>
><br>
><br>
> # Setup for reading the raw data<br>
> raw = Raw(raw_fname)<br>
> <a href="http://raw.info" rel="noreferrer" target="_blank">raw.info</a>['bads'] = ['EEG 053'] # 2 bads channels<br>
> picks = mne.pick_types(<a href="http://raw.info" rel="noreferrer" target="_blank">raw.info</a>, meg=False, eeg=True, stim=True,<br>
> eog=True,exclude='bads')<br>
> events = mne.read_events(event_fname)<br>
> reject = dict(eog=150e-6)<br>
> event_id, tmin, tmax = 1, -0.2, 0.5<br>
> epochs = mne.Epochs(raw, events, event_id=event_id, tmin=tmin,<br>
> tmax=tmax, proj=True, picks=picks, baseline=(None, 0),<br>
> preload=True, reject=reject)<br>
> evoked = epochs.average()<br>
> #Make the BEM model<br>
> model =<br>
> mne.make_bem_model('/home/parham/Desktop/MNE-sample-data/subjects/sample')<br>
> mne.write_bem_surfaces(dest_bem_dir, model)<br>
> #setup a volume source space in the inner_skull. Compute BEM and store<br>
> result.<br>
> inner_skull_surface=mne.read_surface(inner_skull_surf_filename)<br>
> bem_sol = mne.make_bem_solution(model)<br>
> mne.write_bem_solution(bem_sol_file, bem_sol)<br>
> vol=mne.setup_volume_source_space(subj,surface='/home/parham/Desktop/MNE-sample-data/subjects/sample/bem/inner_skull.surf',<br>
> subjects_dir=subjects_dir)<br>
><br>
> # *************************MATLAB: Some simple<br>
> verification****************<br>
> # USE MATLAB to check that the volume source space has been setup<br>
> correctly.<br>
> vertidx = np.where(vol[0]['inuse'])[0]<br>
> pnts=vol[0]['rr']<br>
> closed_surface=inner_skull_surface[0]<br>
> pnts=pnts[vertidx]<br>
> import <a href="http://scipy.io" rel="noreferrer" target="_blank">scipy.io</a> as sio<br>
> sio.savemat('/home/parham/Desktop/python_code/src.mat',<br>
> {'pnts':pnts,'surf':closed_surface})<br>
><br>
> ##### Returning to building the forward model and inverse operator<br>
> below:<br>
> #only compute the forward problem for EEG.<br>
> forward_eeg=mne.make_forward_solution(raw_fname, trans, vol,<br>
> bem_sol_file, fname=fwd_sol_file, meg=False, eeg=True, mindist=0.0,<br>
> ignore_ref=False,overwrite=True, n_jobs=1, verbose=None)<br>
> reject = dict(eeg=80e-6, eog=150e-6)<br>
> # Compute the covariance from the raw data<br>
> noise_cov = mne.compute_raw_covariance(raw, picks=picks, reject=reject)<br>
><br>
> info = <a href="http://evoked.info" rel="noreferrer" target="_blank">evoked.info</a><br>
> inverse_operator_eeg = mne.minimum_norm.make_inverse_operator(info,<br>
> forward_eeg, noise_cov,loose=0.2, depth=0.8)<br>
> mne.minimum_norm.write_inverse_operator(inv_op_file,<br>
> inverse_operator_eeg)<br>
> # Read forward model from hard drive so that you check it has been<br>
> written.<br>
> forward = mne.read_forward_solution(fwd_sol_file)<br>
> # compute data covariance matrix from epochs.<br>
> data_cov = mne.compute_covariance(epochs, tmin=0.04, tmax=0.15,<br>
> method='shrunk')<br>
><br>
> #estimate VOLUME source<br>
> stc = lcmv(evoked, forward, noise_cov, data_cov, reg=0.01,<br>
> pick_ori=None)<br>
><br>
> # Save result in stc files<br>
> stc.save('lcmv-vol')<br>
><br>
> stc.crop(0.0, 0.2)<br>
> src=forward['src']<br>
> # Save result in a 4D nifti file<br>
> img = mne.save_stc_as_volume('lcmv_inverse.nii.gz', stc,src,<br>
> mri_resolution=False)<br>
><br>
> t1_fname = data_path + '/subjects/sample/mri/T1.mgz'<br>
><br>
> # Plotting with nilearn<br>
> ######################################################<br>
> plot_stat_map(index_img(img, 61), t1_fname, threshold=0.8,<br>
> title='LCMV (t=%.1f s.)' % stc.times[61])<br>
><br>
> # plot source time courses with the maximum peak amplitudes<br>
> plt.figure()<br>
> plt.plot(stc.times, stc.data[np.argsort(np.max(stc.data,<br>
> axis=1))[-40:]].T)<br>
> plt.xlabel('Time (ms)')<br>
> plt.ylabel('LCMV value')<br>
> plt.show()<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> On 2016-04-14 16:17, dgw wrote:<br>
>> Hi Parham,<br>
>><br>
>> There are a couple of problems you are running into here:<br>
>><br>
>> 1. That forward solution only contains MEG sensors, you would need to<br>
>> generate your own with EEG only sensors if you want to.<br>
>><br>
>> 2. You didn't mention changing the picks call which would also need to<br>
>> be done.<br>
>><br>
>> Next time if you copy and paste all and exactly what you ran, I can<br>
>> probably help you quicker.<br>
>><br>
>> hth<br>
>> d<br>
>><br>
><br>
> _______________________________________________<br>
> Mne_analysis mailing list<br>
> <a href="mailto:Mne_analysis@nmr.mgh.harvard.edu">Mne_analysis@nmr.mgh.harvard.edu</a><br>
> <a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
><br>
><br>
> The information in this e-mail is intended only for the person to whom it is<br>
> addressed. If you believe this e-mail was sent to you in error and the e-mail<br>
> contains patient information, please contact the Partners Compliance HelpLine at<br>
> <a href="http://www.partners.org/complianceline" rel="noreferrer" target="_blank">http://www.partners.org/complianceline</a> . If the e-mail was sent to you in error<br>
> but does not contain patient information, please contact the sender and properly<br>
> dispose of the e-mail.<br>
><br>
<br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Fri, 15 Apr 2016 12:48:49 -0400<br>
From: JR KING <<a href="mailto:jeanremi.king@gmail.com">jeanremi.king@gmail.com</a>><br>
Subject: Re: [Mne_analysis] mne_kit2fiff error<br>
To: Discussion and support forum for the users of MNE Software<br>
<<a href="mailto:mne_analysis@nmr.mgh.harvard.edu">mne_analysis@nmr.mgh.harvard.edu</a>><br>
Message-ID:<br>
<CAOcgdciP7PKWG6WUkjpmwkWj66o8eKhvy6_aH7w=<a href="mailto:5_cTBpr7AQ@mail.gmail.com">5_cTBpr7AQ@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Dear Peng,<br>
<br>
Which version of mne are you using? I didn't find this error in the source<br>
code.<br>
<br>
Also, can you try using the python command directly<br>
<br>
from <a href="http://mne.io" rel="noreferrer" target="_blank">mne.io</a> import read_raw_kit<br>
<br>
?<br>
<br>
Best,<br>
<br>
JR<br>
<br>
On 15 April 2016 at 11:52, Peng Zan <<a href="mailto:zanpeng.pz@gmail.com">zanpeng.pz@gmail.com</a>> wrote:<br>
<br>
> Dear mne expert,<br>
><br>
> I am currently transferring sqd files to fiff files using command<br>
> mne_kit2fiff, while I got the following errors.<br>
><br>
> ''Writing raw dataTotal number of samples is not an even multiple of the<br>
> number of channels.<br>
><br>
> Sorry.''<br>
><br>
> Do you have any idea why this error occurred? My detailed command is as<br>
> follows,<br>
><br>
> ''mne_kit2fiff --elp R2197_03.25.15.elp --hpi R2197-coregis.txt --sns<br>
> R2197-channel.txt --raw R2197-coregis.txt --aligntol 15 --stim 163<br>
> --stimthresh .002 --sfreq 1000 --hsp R2197_03.25.15.hsp --out<br>
> R2197_Tone_raw.fif''<br>
><br>
> Thank you ahead for your time and answer!<br>
><br>
> Sincerely,<br>
><br>
> Peng Zan<br>
><br>
> _______________________________________________<br>
> Mne_analysis mailing list<br>
> <a href="mailto:Mne_analysis@nmr.mgh.harvard.edu">Mne_analysis@nmr.mgh.harvard.edu</a><br>
> <a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
><br>
><br>
> The information in this e-mail is intended only for the person to whom it<br>
> is<br>
> addressed. If you believe this e-mail was sent to you in error and the<br>
> e-mail<br>
> contains patient information, please contact the Partners Compliance<br>
> HelpLine at<br>
> <a href="http://www.partners.org/complianceline" rel="noreferrer" target="_blank">http://www.partners.org/complianceline</a> . If the e-mail was sent to you in<br>
> error<br>
> but does not contain patient information, please contact the sender and<br>
> properly<br>
> dispose of the e-mail.<br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160415/d22c95b8/attachment-0001.html" rel="noreferrer" target="_blank">http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160415/d22c95b8/attachment-0001.html</a><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
<br>
End of Mne_analysis Digest, Vol 99, Issue 33<br>
********************************************<br>
</blockquote></div><br></div>