Mlab's 'orientation_axes' constantly refreshing the scene

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

Mlab's 'orientation_axes' constantly refreshing the scene

Lionel-3
Hello,

I wanted to add the 'orientation_axes' widget provided by the mlab module in the
scenes that my application renders.

The problem is that the text, displayed along each axis, seems to be 'spamming'
the application with (useless) events, causing it to eat up a lot a CPU.

Here is an example:

from enthought.mayavi import mlab

mlab.surf([1], [1], [1])
mlab.orientation_axes()
mlab.show()

As (I hope) you can see, something is going wrong with the event loop here.
However, if you hide the labels, this will go away.


Any idea ?

Cheers,

Lionel

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

Re: Mlab's 'orientation_axes' constantly refreshing the scene

Gael Varoquaux
Hi,

On Thu, Jan 14, 2010 at 02:56:54PM +0000, Lionel wrote:
> I wanted to add the 'orientation_axes' widget provided by the mlab
> module in the scenes that my application renders.

> The problem is that the text, displayed along each axis, seems to be 'spamming'
> the application with (useless) events, causing it to eat up a lot a CPU.

> Here is an example:

> from enthought.mayavi import mlab

> mlab.surf([1], [1], [1])
> mlab.orientation_axes()
> mlab.show()

> As (I hope) you can see, something is going wrong with the event loop here.
> However, if you hide the labels, this will go away.

I can't see anything wrong when running a script with such code. What
makes you think that there is a problem? (please be precise, it will make
debugging easier). Also, could you give us your platform, your Mayavi
version, and you VTK version.

Cheers,

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

Re: Mlab's 'orientation_axes'constantly refreshing the scene

Lionel-3
Gael Varoquaux <gael.varoquaux@...> writes:

>
> Hi,
> I can't see anything wrong when running a script with such code. What
> makes you think that there is a problem? (please be precise, it will make
> debugging easier). Also, could you give us your platform, your Mayavi
> version, and you VTK version.
>
> Cheers,
>
> Gaël
>

Sorry, my first mail wasn't really explicit about the problem.

So, what actually happens when I run this code is that ps -u shows that the
application uses above 90% of the CPU, doing nothing more than refreshing the
window.
But don't forget that this is only happening when the axes labels are visible,
which is why I get some trouble debugging it myself.

Here are some informations:

My platform: Linux 2.6.28-17-generic #58-Ubuntu / i686
My Mayavi version(quite old): Mayavi 3.3.1.dev-r24690
My Vtk version: 5.4

Thanks a lot


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

Re: Mlab's 'orientation_axes'constantly?refreshing?the scene

Gael Varoquaux
On Thu, Jan 14, 2010 at 03:45:20PM +0000, Lionel wrote:
> So, what actually happens when I run this code is that ps -u shows that the
> application uses above 90% of the CPU, doing nothing more than refreshing the
> window.
> But don't forget that this is only happening when the axes labels are visible,
> which is why I get some trouble debugging it myself.

So, we do seem to have a problem :).

> Here are some informations:

> My platform: Linux 2.6.28-17-generic #58-Ubuntu / i686
> My Mayavi version(quite old): Mayavi 3.3.1.dev-r24690
> My Vtk version: 5.4

OK, the Mayavi version is oldish, but not that bad. How did you install
it? Any chance that you can grab the SVN?

I would tend to think that the problem comes from the VTK version: I have
never played with VTK 5.4. It may be a bug in VTK or in our bindings that
shows up. How did you install VTK? Is this the development version of
VTK?

Cheers,

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

Re: Mlab's 'orientation_axes'constantly refreshing the scene

Jens Schleede
In reply to this post by Lionel-3


On Thu, Jan 14, 2010 at 4:45 PM, Lionel <[hidden email]> wrote:
Gael Varoquaux <gael.varoquaux@...> writes:

>
> Hi,
> I can't see anything wrong when running a script with such code. What
> makes you think that there is a problem? (please be precise, it will make
> debugging easier). Also, could you give us your platform, your Mayavi
> version, and you VTK version.
>
> Cheers,
>
> Gaël
>

Mayavi version 3.3.1.dev-r25045 - VTK version 5.4.2Sorry, my first mail wasn't really explicit about the problem.

So, what actually happens when I run this code is that ps -u shows that the
application uses above 90% of the CPU, doing nothing more than refreshing the
window.
But don't forget that this is only happening when the axes labels are visible,
which is why I get some trouble debugging it myself.

Here are some informations:

My platform: Linux 2.6.28-17-generic #58-Ubuntu / i686
My Mayavi version(quite old): Mayavi 3.3.1.dev-r24690
My Vtk version: 5.4

Thanks a lot


I can confirm this issue in some way.
If the axes indicator / orientation axes is enabled and I move my mouse over the scene mayavi uses around 15% of CPU. If the mouse is outside the scene CPU usage is zero.

My version details:

Mayavi version 3.3.1.dev-r25045 - VTK version 5.4.2
Python 2.5.4 |EPD 5.1.0|
wxPython 2.8.7.1

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


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

Re: Mlab's 'orientation_axes'constantly?refreshing?the scene

Lionel-3
In reply to this post by Gael Varoquaux
Gael Varoquaux <gael.varoquaux@...> writes:

> OK, the Mayavi version is oldish, but not that bad. How did you install
> it? Any chance that you can grab the SVN?
>

I just tried it with the very last svn revision(25123), and the problem seems to
be gone. I should have done this before asking :)

Thanks a lot,

Lionel



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

Re: Mlab's 'orientation_axes'constantly refreshing the scene

Jens Schleede
In reply to this post by Jens Schleede


On Thu, Jan 14, 2010 at 5:36 PM, Jens Schleede <[hidden email]> wrote:


On Thu, Jan 14, 2010 at 4:45 PM, Lionel <[hidden email]> wrote:
Gael Varoquaux <gael.varoquaux@...> writes:

>
> Hi,
> I can't see anything wrong when running a script with such code. What
> makes you think that there is a problem? (please be precise, it will make
> debugging easier). Also, could you give us your platform, your Mayavi
> version, and you VTK version.
>
> Cheers,
>
> Gaël
>

Mayavi version 3.3.1.dev-r25045 - VTK version 5.4.2Sorry, my first mail wasn't really explicit about the problem.


So, what actually happens when I run this code is that ps -u shows that the
application uses above 90% of the CPU, doing nothing more than refreshing the
window.
But don't forget that this is only happening when the axes labels are visible,
which is why I get some trouble debugging it myself.

Here are some informations:

My platform: Linux 2.6.28-17-generic #58-Ubuntu / i686
My Mayavi version(quite old): Mayavi 3.3.1.dev-r24690
My Vtk version: 5.4

Thanks a lot


I can confirm this issue in some way.
If the axes indicator / orientation axes is enabled and I move my mouse over the scene mayavi uses around 15% of CPU. If the mouse is outside the scene CPU usage is zero.

My version details:

Mayavi version 3.3.1.dev-r25045 - VTK version 5.4.2
Python 2.5.4 |EPD 5.1.0|
wxPython 2.8.7.1

Jens
The script recorder shows the following events, whenever I move the mouse cursor over the scene:

orientation_axes.text_property.font_size = 10
orientation_axes.text_property.shadow_offset = array([ 1, -1])
orientation_axes.text_property.font_size = 9
orientation_axes.text_property.shadow_offset = array([ 1, -1])
orientation_axes.text_property.font_size = 10
orientation_axes.text_property.shadow_offset = array([ 1, -1])
orientation_axes.text_property.font_size = 9
orientation_axes.text_property.shadow_offset = array([ 1, -1])
....

Is it possible to see which events where fired?

Cheers,

Jens

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

Re: Mlab's?'orientation_axes'constantly?refreshing?the scene

Gael Varoquaux
In reply to this post by Lionel-3
On Fri, Jan 15, 2010 at 09:04:47AM +0000, Lionel wrote:
> Gael Varoquaux <gael.varoquaux@...> writes:

> > OK, the Mayavi version is oldish, but not that bad. How did you install
> > it? Any chance that you can grab the SVN?


> I just tried it with the very last svn revision(25123), and the problem
> seems to be gone. I should have done this before asking :)

That certainly is a good news. Thanks a lot for all the testing, and for
reporting the results.

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

Re: Mlab's 'orientation_axes'constantly refreshing the scene

Gael Varoquaux
In reply to this post by Jens Schleede
On Fri, Jan 15, 2010 at 10:06:09AM +0100, Jens Schleede wrote:
>      I can confirm this issue in some way.
>      If the axes indicator / orientation axes is enabled and I move my mouse
>      over the scene mayavi uses around 15% of CPU. If the mouse is outside
>      the scene CPU usage is zero.

>      My version details:

>      Mayavi version 3.3.1.dev-r25045 - VTK version 5.4.2
>      Python 2.5.4 |EPD 5.1.0|
>      wxPython 2.8.7.1
>      Jens

OK, You have a very recent version of Mayavi, so I believe that the
problem is solved in trunk.

>    The script recorder shows the following events, whenever I move the mouse
>    cursor over the scene:

>      orientation_axes.text_property.font_size = 10
>      orientation_axes.text_property.shadow_offset = array([ 1, -1])
>      orientation_axes.text_property.font_size = 9
>      orientation_axes.text_property.shadow_offset = array([ 1, -1])
>      orientation_axes.text_property.font_size = 10
>      orientation_axes.text_property.shadow_offset = array([ 1, -1])
>      orientation_axes.text_property.font_size = 9
>      orientation_axes.text_property.shadow_offset = array([ 1, -1])
>      ....

Useful piece of information. I wonder where that comes from.

>    Is it possible to see which events where fired?

I am not sure what you mean by that. There are several kind of event
which could be fired: mainly Wx ones and VTK ones. Both could change the
font size of the text, and thus create this loop.

Would you mind reverting to revision 25015 to see if this fixes the
problem? I added code registering VTK events in revision 25016.

Cheers,

Ga�l

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

Re: Mlab's 'orientation_axes'constantly?refreshing?the scene

Lionel-3
In reply to this post by Gael Varoquaux
Gael Varoquaux <gael.varoquaux@...> writes:

> OK, the Mayavi version is oldish, but not that bad. How did you install
> it? Any chance that you can grab the SVN?
>
> I would tend to think that the problem comes from the VTK version: I have
> never played with VTK 5.4. It may be a bug in VTK or in our bindings that
> shows up. How did you install VTK? Is this the development version of
> VTK?
>
> Cheers,
>
> Gaël
>


Ok, I spoke a bit too fast.

The problem is still there, but only occurs when I use the Qt4 backend ; wx
works just fine. It might be why you couldn't see it the first time.

I'm not sure how everything was installed on my computer, since I didn't do it
myself. I'm pretty sure VTK was installed the classic way (make install) and is
not the development version, but the latest release (5.4.2).
My Qt version is 4.5.0.
My Qt backend version is : TraitsBackendQt-3.2.1.dev_r24713


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

Re: Mlab's 'orientation_axes'constantly refreshing the scene

Gael Varoquaux
In reply to this post by Gael Varoquaux
Hey,

Sorry for the slow answer. Real life kicked in (deadlines...). I just
found time to look deeply in this problem.

On Fri, Jan 15, 2010 at 10:14:19AM +0100, Gael Varoquaux wrote:
> On Fri, Jan 15, 2010 at 10:06:09AM +0100, Jens Schleede wrote:
> >      I can confirm this issue in some way.
> >      If the axes indicator / orientation axes is enabled and I move my mouse
> >      over the scene mayavi uses around 15% of CPU. If the mouse is outside
> >      the scene CPU usage is zero.

> > [snip]

> >    The script recorder shows the following events, whenever I move the mouse
> >    cursor over the scene:

> >      orientation_axes.text_property.font_size = 10
> >      orientation_axes.text_property.shadow_offset = array([ 1, -1])
> >      orientation_axes.text_property.font_size = 9
> >      orientation_axes.text_property.shadow_offset = array([ 1, -1])
> >      orientation_axes.text_property.font_size = 10
> >      orientation_axes.text_property.shadow_offset = array([ 1, -1])
> >      orientation_axes.text_property.font_size = 9
> >      orientation_axes.text_property.shadow_offset = array([ 1, -1])
> >      ....

> Useful piece of information. I wonder where that comes from.

> >    Is it possible to see which events where fired?

> I am not sure what you mean by that. There are several kind of event
> which could be fired: mainly Wx ones and VTK ones. Both could change the
> font size of the text, and thus create this loop.

So, it ended up being VTK events. Interestingly, a plain TVTK use of the
orientation marker showed the same problem, so the problem might very
well be at the VTK level (I have attached a script that I used to
highlight the problem at the Mayavi level, or at the TVTK level).

I solved the problem in [25279] with a brutal solution. A side effect of
this problem is that the font size of the labels cannot be set. I wasn't
able to solve that problem. There is an underlying VTK behavior that I
don't understand. Maybe a bug.

Anyhow, the biggest issue should be solved as of 25279. Thanks for taking
the time to report the problem and helping me find its source.

Gaël

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

test.py (499 bytes) Download Attachment