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