Possible bug for mlab.contour3d()

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

Possible bug for mlab.contour3d()

Youbao Zhang
Dear all,

When I try to run the following python code (attached to this email as ShowDiamond.py, also the datafile test.h5), the scene window appeared for a while, and then disappeared. It is very wired. When I run the code line by line in interactive mode, the scene window is freezed there, and we cannot do any operations.

            import numpy as np
            import h5py 
            from mayavi import mlab
f = h5py.File('test.h5','r')
data_new = f['data-new']
isosurfdata = np.array(data_new.value)
mlab.contour3d(isosurfdata)
f.close()
I've tested the code on Windows XP and Debian Squeeze (64Bit) with academic EPD-7.3, and the same problem.

I think there is a bug somewhere in the packages, but I cannot figure it out. Any ideas?

Best regards,

Simon
Memorial University of Newfoundland

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

ShowDiamond.py (262 bytes) Download Attachment
test.h5 (697K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Possible bug for mlab.contour3d()

Didrik Pinte-2
Hi Simon,

On 5 July 2012 04:08, Youbao Zhang <[hidden email]> wrote:

> Dear all,
>
> When I try to run the following python code (attached to this email as
> ShowDiamond.py, also the datafile test.h5), the scene window appeared for a
> while, and then disappeared. It is very wired. When I run the code line by
> line in interactive mode, the scene window is freezed there, and we cannot
> do any operations.
>
>>             import numpy as np
>>
>>             import h5py
>>
>>             from mayavi import mlab
>>
>> f = h5py.File('test.h5','r')
>> data_new = f['data-new']
>> isosurfdata = np.array(data_new.value)
>> mlab.contour3d(isosurfdata)
>> f.close()
>
> I've tested the code on Windows XP and Debian Squeeze (64Bit) with academic
> EPD-7.3, and the same problem.
>
> I think there is a bug somewhere in the packages, but I cannot figure it
> out. Any ideas?

You haven't started the GUI mainloop. That is the reason why it pops
up and disappears straight away.

You can do this :

-------------------------------------------------
import numpy as np
import h5py
from pyface.api import GUI
from mayavi import mlab

g = GUI()

f = h5py.File('test.h5','r')
data_new = f['data-new']

isosurfdata = np.array(data_new.value)
mlab.contour3d(isosurfdata)

g.start_event_loop()

f.close()
-------------------------------------------------

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

Re: Possible bug for mlab.contour3d()

Gael Varoquaux
On Thu, Jul 05, 2012 at 09:44:53AM +0200, Didrik Pinte wrote:
> -------------------------------------------------
> import numpy as np
> import h5py
> from pyface.api import GUI
> from mayavi import mlab

> g = GUI()

> f = h5py.File('test.h5','r')
> data_new = f['data-new']

> isosurfdata = np.array(data_new.value)
> mlab.contour3d(isosurfdata)

> g.start_event_loop()

Actually, the canonical way of doing it in mlab is with 'mlab.show()'
that checks that it is not running in addition.

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

Re: Possible bug for mlab.contour3d()

Gael Varoquaux
On Thu, Jul 05, 2012 at 10:05:05AM +0200, Gael Varoquaux wrote:
> Actually, the canonical way of doing it in mlab is with 'mlab.show()'
> that checks that it is not running in addition.

PS: thanks for answering Didrik. With all my travelling I am not really
able to keep a proper eye on my mailbox.

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

Re: Possible bug for mlab.contour3d()

Youbao Zhang
Wonderful! I am surprising the way to visualize 3D data in such a simple way.

Thanks  Didrik and Gael.

Both methods work perfectly, and the mlab.show() is much simpler though.

Best regards,

Simon

On Thu, Jul 5, 2012 at 4:05 PM, Gael Varoquaux <[hidden email]> wrote:
On Thu, Jul 05, 2012 at 10:05:05AM +0200, Gael Varoquaux wrote:
> Actually, the canonical way of doing it in mlab is with 'mlab.show()'
> that checks that it is not running in addition.

PS: thanks for answering Didrik. With all my travelling I am not really
able to keep a proper eye on my mailbox.

G
_______________________________________________
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