[Mayavi] ipython -wthread hangs on accessing properties of volume object

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Mayavi] ipython -wthread hangs on accessing properties of volume object

Jens Schleede
Hello,

I was trying to use a custom colormap for volume rendering in mayavi as described in the docs: http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/auto/mlab_pipeline_other_functions.html?highlight=ctf#volume
I was using 'ipython -wthread'. When I execute the line
vol._volume_property.set_color(ctf)
the ipython shell and the rendering window suddenly hang without throwing any exception.
In a new session I tried to access vol.volume_property. and vol.volume_mapper. without success - ipython hung again. 
It works with the built-in shell in the mayavi2 application and also when using just 'ipython' without '-wthread'.

Does anyone know why this happens (race conditions?) and how to workaround this issue? 

Best regards
Jens



_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Mayavi] ipython -wthread hangs on accessing properties of volume object

Gael Varoquaux
On Wed, Jan 13, 2010 at 12:19:08AM +0100, Jens Schleede wrote:
>    Hello,
>    I was trying to use a custom colormap for volume rendering in mayavi as
>    described in the
>    docs:�[1]http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/auto/mlab_pipeline_other_functions.html?highlight=ctf#volume
>    I was using 'ipython -wthread'. When I execute the line

>      vol._volume_property.set_color(ctf)

>    the ipython shell and the rendering window suddenly hang without throwing
>    any exception.
>    In a new session I tried to access vol.volume_property. and
>    vol.volume_mapper. without success - ipython hung again.�
>    It works with the built-in shell in the mayavi2 application and also when
>    using just 'ipython' without '-wthread'.
>    Does anyone know why this happens (race conditions?) and how to workaround
>    this issue?�

This must be related to a threading issue in IPython. I suspect it is
because a getter is not evaluated in the graphical event loop.

I had a quick try, and it seems that the following works around the
problem:

In [2]: f = vol._volume_property.set_color

In [3]: f(ctf)

A better option (if it works) would be to define a helper function, and
use only that helper in IPython interactively. I suspect that it will
work around the problem.

HTH,

Ga�l

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev