[Mne_analysis] stc.plot() Error: raise ValueError('time is not the same length as array.shape[1]')
Nakagawa Tristan T
nakagawa-t at ifrec.osaka-u.ac.jp
Fri May 13 21:26:39 EDT 2016
Actually, as I mention below, vtk7 (main release) is compatible with Python3
https://blog.kitware.com/vtk-7-0-0/
and with this and mayavi 4.4.4, after fixing the viz.py script, I could
plot meg activity onto the cortical surface without any apparent
problems so far, all in python 3.
Cheers
Tristan
On 2016年05月13日 21:02, Denis-Alexander Engemann wrote:
> Mayavi does not yet work with Python3 unfortunately. Rumors have been
> existing that there is some unmerged experimental dev branch of VTK
> that supports mayavi 3, but I'm not sure if mayavi can already be used.
>
> Btw. anyone who wants to help writing an API for plotting freesurfer
> outputs using matplotlib without extra dependencies deserves many
> beers {insert favourite drink}. Look also here for the first attempts:
> https://github.com/nilearn/nilearn/pull/1016
>
> Denis
>
> On Fri, May 13, 2016 at 8:01 AM Nakagawa Tristan T
> <nakagawa-t at ifrec.osaka-u.ac.jp
> <mailto:nakagawa-t at ifrec.osaka-u.ac.jp>> wrote:
>
> I figured it out, it seems the code is still not compatible with
> python3.
>
> adding to viz.py :
>
> try:
> basestring
> except NameError:
> basestring = str
>
> fixes this error and makes the plot possible.
>
> I never worked with python2 (and didn't know basestring was a type);
> do I have to expect silent wrong results using the
> python3/mayavi4.4.4/vtk7 combination?
>
>
> ---
> If anybody is interested (unless this isn't advised), The install
> procedure gave me some trouble but finally worked in this combination
> (with anaconda python):
> conda install -c menpo vtk=7.0.0
> pip install mayavi
> pip install pysurfer
>
> cheers
> Tristan
>
>
> On 2016年05月13日 13:39, Nakagawa Tristan T wrote:
> > I was confused, sorry. the actual error is:
> >
> > --> 876 if isinstance(time_label, basestring):
> >
> > as in:
> > In [96]: stc.plot()
> > Updating smoothing matrix, be patient..
> > Smoothing matrix creation, step 1
> > Smoothing matrix creation, step 2
> > Smoothing matrix creation, step 3
> > Smoothing matrix creation, step 4
> > Smoothing matrix creation, step 5
> > Smoothing matrix creation, step 6
> > Smoothing matrix creation, step 7
> > Smoothing matrix creation, step 8
> > Smoothing matrix creation, step 9
> > Smoothing matrix creation, step 10
> >
> ---------------------------------------------------------------------------
> > NameError Traceback (most recent
> call last)
> > <ipython-input-96-2a3e72fcca14> in <module>()
> > ----> 1 stc.plot()
> >
> >
> /home/tristan/anaconda3/lib/python3.5/site-packages/mne-0.12.dev0-py3.5.egg/mne/source_estimate.py
> > in plot(self, subject, surface, hemi, colormap, time_label,
> > smoothing_steps, transparent, alpha, time_viewer, config_opts,
> > subjects_dir, figure, views, colorbar, clim)
> > 1376
> subjects_dir=subjects_dir,
> > figure=figure,
> > 1377 views=views,
> > colorbar=colorbar,
> > -> 1378 clim=clim)
> > 1379 return brain
> > 1380
> >
> >
> /home/tristan/anaconda3/lib/python3.5/site-packages/mne-0.12.dev0-py3.5.egg/mne/viz/_3d.py
> > in plot_source_estimates(stc, subject, surface, hemi, colormap,
> > time_label, smoothing_steps, transparent, alpha, time_viewer,
> > config_opts, subjects_dir, figure, views, colorbar, clim)
> > 747 smoothing_steps=smoothing_steps,
> > time=time,
> > 748 time_label=time_label,
> alpha=alpha,
> > hemi=hemi,
> > --> 749 colorbar=colorbar)
> > 750
> > 751 # scale colormap and set time (index) to display
> >
> > /home/tristan/anaconda3/lib/python3.5/site-packages/surfer/viz.py in
> > add_data(self, array, min, max, thresh, colormap, alpha, vertices,
> > smoothing_steps, time, time_label, colorbar, hemi, remove_existing,
> > time_label_size)
> > 874 raise ValueError('time is not the same
> length as '
> > 875 'array.shape[1]')
> > --> 876 if isinstance(time_label, basestring):
> > 877 time_label_fmt = time_label
> > 878 time_label = lambda x: time_label_fmt % x
> >
> > NameError: name 'basestring' is not defined
> >
> > In [97]: stc.time_label
> >
> ---------------------------------------------------------------------------
> > AttributeError Traceback (most recent
> call last)
> > <ipython-input-97-3f447cdfe95d> in <module>()
> > ----> 1 stc.time_label
> >
> > AttributeError: 'SourceEstimate' object has no attribute
> 'time_label'
> >
> >
> >
> >
> >
> > On 2016年05月13日 11:54, Nakagawa Tristan T wrote:
> >> Hi,
> >>
> >> I get this error when trying to plot my source estimates:
> >> stc.plot() Error: raise ValueError('time is not the same length as
> >> array.shape[1]')
> >>
> >> however,
> >> stc: <SourceEstimate | 10629 vertices, subject : S23, tmin :
> -1100.0
> >> (ms), tmax : 1000.0 (ms), tstep : 1.0 (ms), data size : 10629 x
> 2101>
> >>
> >> In [93]: stc.times.shape
> >> Out[93]: (2101,)
> >>
> >> In [94]: stc.shape
> >> Out[94]: (10629, 2101)
> >>
> >> Here is one of the hemispheres stc:
> >> https://www.dropbox.com/s/d3vvmy79gddvuev/grad_CS-lh.stc?dl=0
> >>
> >> Any ideas?
> >> I just installed mayavi 4.4.4 with vtk 7.0 on python3, not sure
> if that
> >> might cause problems, but the error doesn't look like it.
> >>
> >> Thanks,
> >> Tristan
> >>
>
> --
> Tristan T. Nakagawa, Ph.D.
> Laboratory for Brain-Immune Interaction,
> iFReC, Osaka University
> 3-1 Yamadaoka, Suita, Osaka, Japan
> Tel: 0668789710
> Office: CiNet R 2B6-2
> http://seymourlab.com
>
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> <mailto: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.
>
--
Tristan T. Nakagawa, Ph.D.
Laboratory for Brain-Immune Interaction,
iFReC, Osaka University
3-1 Yamadaoka, Suita, Osaka, Japan
Tel: 0668789710
Office: CiNet R 2B6-2
http://seymourlab.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20160514/f659f280/attachment.html
More information about the Mne_analysis
mailing list