stc.plot() Error: raise ValueError('time is not the same length as array.shape[1]')

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

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

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?

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

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

PySurfer will need to be updated to be Python3 compatible. Can you open a
GitHub issue on the PySurfer repo?

Eric

There is already an issue:
https://github.com/nipy/PySurfer/issues/143

I added a comment to the vtk7.0 release.

cheers,
Tristan