david wende | 2 May 2009 20:00
Picon

Problem loading data file

I am using mayavi2 on Linux platform.

Even though creating parametric surface and builtin images seem to work,
loading a vtk or vtu file gives errors and nothing is displayed.
Here is a typical log after loading heart.vtk (the example file):

WARNING|2009-05-01 16:35:57,798|plugin <enthought.plugins.text_editor.text_editor_plugin.TextEditorPlugin object at 0xb93f7ac> has no Id - using <enthought.plugins.text_editor.text_editor_plugin.TextEditorPlugin>
WARNING|2009-05-01 16:35:58,040|could not restore editor [TVTK Scene 1]
INFO|2009-05-01 16:35:58,276|LoggerView.create_control()
INFO|2009-05-01 16:35:58,336| self.widget = <enthought.logger.widget.logger_widget.LoggerWidget; proxy of <Swig Object of type 'wxPanel *' at 0xbc2b558> >
WARNING|2009-05-01 16:35:58,436|view <enthought.plugins.python_shell.view.namespace_view.NamespaceView object at 0xbb925cc> has no Id - using <enthought.plugins.python_shell.view.namespace_view.NamespaceView>
ERROR|2009-05-01 16:36:07,356|Exception occurred in traits notification handler for object: <enthought.mayavi.sources.vtk_file_reader.VTKFileReader object at 0xb9f308c>, trait: file_path, old value: , new value: /home/dwende/Desktop/data/heart.vtk
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/enthought/traits/trait_notifiers.py", line 353, in call_2
self.handler( object, new )
File "/usr/lib/python2.6/site-packages/enthought/mayavi/sources/vtk_file_reader.py", line 76, in _file_path_changed
self.update_data()
File "/usr/lib/python2.6/site-packages/enthought/mayavi/sources/vtk_xml_file_reader.py", line 236, in update_data
pnt_attr, cell_attr = get_all_attributes(self.reader.output)
File "/usr/lib/python2.6/site-packages/enthought/mayavi/sources/vtk_xml_file_reader.py", line 82, in get_all_attributes
point_attr = get_attribute_list(obj.point_data)
AttributeError: 'NoneType' object has no attribute 'point_data'

Any help appreciated.
--
David
------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
MayaVi-users mailing list
MayaVi-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mayavi-users
Prabhu Ramachandran | 3 May 2009 11:57
Picon
Gravatar

Re: Problem loading data file

david wende wrote:
> I am using mayavi2 on Linux platform.
[...]
> "/usr/lib/python2.6/site-packages/enthought/mayavi/sources/vtk_xml_file_reader.py", 
> line 236, in update_data
> pnt_attr, cell_attr = get_all_attributes(self.reader.output)
> File 
> "/usr/lib/python2.6/site-packages/enthought/mayavi/sources/vtk_xml_file_reader.py", 
> line 82, in get_all_attributes
> point_attr = get_attribute_list(obj.point_data)
> AttributeError: 'NoneType' object has no attribute 'point_data'

This is strange.  Can you give us more information on the version of 
mayavi2 you have installed and details on the OS?  My guess is that 
there is a Python-2.6 specific issue here but I am not sure.  I haven't 
tested mayavi with python-2.6 yet.

cheers,
prabhu

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
Prabhu Ramachandran | 3 May 2009 11:39
Picon
Gravatar

Re: mayavi module

Håkan Jakobsson wrote:
> Hi,
> 
> I read on the mayavi website that it is possible to write own modules  
> to mayavi. My research group is looking to write a simple graphical  
> tool used to apply boundary conditions etc to geometries defined  
> by .poly files. The data would be saved in an xml file, read by our  
> solvers. Is it possible to write such a module to mayavi?

Yes, I think it is possible to do so.  I would recommend doing this with 
mayavi2 (and posting questions on enthought-dev <at> mail.enthought.com in 
addition).  Your strategy would be to learn a little of traits and TraitsUI

  http://code.enthought.com/projects/traits/

Then understand how to create a simple module with mayavi2.  The mayavi2 
user guide should give you a reasonable start:

  http://code.enthought.com/projects/mayavi

Then you should have a good idea of what kind of UI you want to provide 
for your module and how you want people to interact with your module to 
provide the boundary condition information and then implement it.  At 
this point you'll also need to learn a little VTK to understand things a 
little better.

HTH.

cheers,
prabhu

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
Prabhu Ramachandran | 9 May 2009 12:34
Picon
Gravatar

Re: Problem loading data file

> On Sun, May 3, 2009 at 12:57 PM, Prabhu Ramachandran 
> <prabhu <at> aero.iitb.ac.in <mailto:prabhu <at> aero.iitb.ac.in>> wrote:
> 
>     david wende wrote:
> 
>         I am using mayavi2 on Linux platform.
> 
>     [...]
> 
>         "/usr/lib/python2.6/site-packages/enthought/mayavi/sources/vtk_xml_file_reader.py",
>         line 236, in update_data
>         pnt_attr, cell_attr = get_all_attributes(self.reader.output)
>         File
>         "/usr/lib/python2.6/site-packages/enthought/mayavi/sources/vtk_xml_file_reader.py",
>         line 82, in get_all_attributes
>         point_attr = get_attribute_list(obj.point_data)
>         AttributeError: 'NoneType' object has no attribute 'point_data'
> 
> 
>     This is strange.  Can you give us more information on the version of
>     mayavi2 you have installed and details on the OS?  My guess is that
>     there is a Python-2.6 specific issue here but I am not sure.  I
>     haven't tested mayavi with python-2.6 yet.

On 05/04/09 08:52, david wende wrote:
 > OS is archlinux.
 > Compling from sources in package called python-enthought-mayavi-3.2.0-1
 > from www.enthought.com/repo/ETS/Mayavi-3.2.0.aar.gz
 > <http://www.enthought.com/repo/ETS/Mayavi-3.2.0.aar.gz>

Can you try this:

  1. Drag the reader object on your tree view and drop it on the Python 
shell on the application.

  2. type the following:

  s = _
  s.reader.update()
  print s.reader.output

And tell us what you get?

prabhu

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
Rohrhirsch, Jakob | 26 May 2009 15:46
Picon
Favicon

weird behavior of warp_scale='auto' in mlabs surf() function

Hi everyone.

I hope this is the right place for my question. As far as I understood this,
the warp_scale='auto' option in mlab's surf() function is supposed to scale
the z-axis to a reasonable ratio. Following is a script that demonstrates a
problem I have found:

from numpy import *
from enthought.mayavi.mlab import *

epsilon = 100
x, y = mgrid[-10.05:10.05:0.1,-10.05:10.05:0.1]
U = epsilon / sqrt(x**2+y**2)
s = surf(x,y,U,warp_scale='auto')
show()

Now if you change the value of epsilon the image acts in a very weird way. If
epsilon is 1 or 10 it seems to be ok (ratio of ~2/3). If it's 100 the peak is
very low. If it's higher than that (1 000, 10 000), the peak is starting to
rise again. is this a numerical problem I'm experiencing here, or is this
indeed a bug in mayavi? Help would be very much apprecheated.

Jakob

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
John R. Cary | 25 May 2009 17:53
Favicon

How to plot triangular mesh without the GUI coming up?

I got past the installation and am now trying
batch generation of images, in particular of
a triangular mesh.  At the top of my script,
following the nongui.py example, I have

import tables
import numpy
from enthought.mayavi import mlab
from enthought.mayavi.plugins.app import Mayavi, get_non_gui_plugins

class CrabCavity(Mayavi):

  def run(self):

# Then generate points and triangles

# Then at the bottom I have

# Create script and add triangles
    script = self.script
    script.new_scene()
    tmesh = mlab.triangular_mesh(points[:, 0], points[:, 1],
        points[:, 2], triangles)
    script.add_module(tmesh)

# Set the view
    s = script.engine.current_scene
    cam = s.scene.camera
    cam.azimuth(45)
    cam.elevation(15)
    s.render()
    s.scene.save("crabcav.png", size=(640,480))

if __name__ == '__main__':
  m = CrabCavity()
# Get the default non GUI plugins.
  plugins = get_non_gui_plugins()
# Start the app with these plugins.
  m.main(plugins=plugins)

which I run with python.

It seems that the gui always comes up.  I just want to
create my scene and save it in a png without the GUI
coming up.

What am I doing wrong?

Thanks....John Cary

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
Gael Varoquaux | 26 May 2009 17:28
Favicon
Gravatar

Re: How to plot triangular mesh without the GUI coming up?

On Mon, May 25, 2009 at 09:53:08AM -0600, John R. Cary wrote:
> It seems that the gui always comes up.  I just want to
> create my scene and save it in a png without the GUI
> coming up.

You are looking for offscreen rendering. I have sketched modifications to
your script that should do it:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import tables
import numpy
from enthought.mayavi import mlab
mlab.options.offscreen = True

def run():

    # Then generate points and triangles

    # Then at the bottom I have

    # Create script and add triangles
    tmesh = mlab.triangular_mesh(points[:, 0], points[:, 1],
                                    points[:, 2], triangles)

    # Set the view
    mlab.view(45, 15)
    mlab.savefig("crabcav.png", size=(640,480))

if __name__ == '__main__':
    run()
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

You should also read 
http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/tips.html#off-screen-rendering
as to avoid having a window poping up, you may need to do more, depending
on your platform.

HTH,

Gaël

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
Gael Varoquaux | 26 May 2009 17:44
Favicon
Gravatar

Re: weird behavior of warp_scale='auto' in mlabs surf() function

On Tue, May 26, 2009 at 03:46:54PM +0200, Rohrhirsch, Jakob wrote:
> I hope this is the right place for my question.

It is. The enthought-dev mailing-list
(https://mail.enthought.com/mailman/listinfo/enthought-dev) may also be
useful, as it has more traffic, and thus more people to help you.

> As far as I understood this,
> the warp_scale='auto' option in mlab's surf() function is supposed to scale
> the z-axis to a reasonable ratio. Following is a script that demonstrates a
> problem I have found:

> from numpy import *
> from enthought.mayavi.mlab import *

> epsilon = 100
> x, y = mgrid[-10.05:10.05:0.1,-10.05:10.05:0.1]
> U = epsilon / sqrt(x**2+y**2)
> s = surf(x,y,U,warp_scale='auto')
> show()

> Now if you change the value of epsilon the image acts in a very weird way. If
> epsilon is 1 or 10 it seems to be ok (ratio of ~2/3). If it's 100 the peak is
> very low. If it's higher than that (1 000, 10 000), the peak is starting to
> rise again. is this a numerical problem I'm experiencing here, or is this
> indeed a bug in mayavi? Help would be very much apprecheated.

This is a bug! Thanks for reporting it. I have fixed it in svn,
https://svn.enthought.com/enthought/changeset/23682
You can work around it by using the extent keyword argument. It is not as
handy as setting warp_scale to 'auto', but if you don't want to install
svn or patch your local version, this is a way forward.

Cheers,

Gaël

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
daspostloch | 27 May 2009 19:28

Offscreen/remote rendering: script access to gl2ps dialog or magnification

Hi all,

I want to produce high-res files for an academic poster in offscreen mode.
My problem is that Im stuck with VTK-5.0.4. (i.e. cant seem to use the
mlab offscreen
flag) and also, I cannot put off work until the file is written, i.e.
I need my screen during
(rather lengthy) rendering. So what I did is use xvfb-run, but there
are two problems:

For vector images, the gl2ps dialog seems to block mlab from writing the file.
So any hint on how to circumvent the dialog or sent an 'OK' to a xvfb session
would solve my problem.
In addition, the .pdf and .ps files do not seem to qualify as vector
output. .PS clearly
produces an embedded raster image and .pdf is of very poor quality. .EPS gets it
amazingly right, but at the expense of quite longer output times.

For raster images, i have the problem that the size option in savefig() does not
work. It does at least try if I put the savefig() command with size
option twice,
but what happens is the following: The resulting figure's size is
right, but everything
is blank except for the upper left corner in which the original. So if
I could write a,
say 5000x5000 raster image, that would solve too. But I dont even know
if there is
a limit to the xvfb screen sizes. So .eps would be much preferred.

Renderman etc. are not an option, since I cannot install conversion software.
I think mayavi was installed via  enthought.mayavi-2.2.0-py2.5.egg, I
would have
to talk to my admin to get something else.

I am really thankful for any hints on this - Matt

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
Prabhu Ramachandran | 28 May 2009 06:40
Picon
Gravatar

Re: Offscreen/remote rendering: script access to gl2ps dialog or magnification

daspostloch <at> googlemail.com wrote:
> For vector images, the gl2ps dialog seems to block mlab from writing the file.
> So any hint on how to circumvent the dialog or sent an 'OK' to a xvfb session
> would solve my problem.

No problem.  Do the following (assuming 's' is your mayavi scene or any 
object that has a scene trait):

  from enthought.tvtk.api import tvtk
  exp = tvtk.GL2PSExporter(file_format='pdf', sort='bsp', compress=1)
  s.scene.save_gl2ps('/tmp/t.pdf', exp)

It should not pop-up a UI in this case.

> In addition, the .pdf and .ps files do not seem to qualify as vector
> output. .PS clearly
> produces an embedded raster image and .pdf is of very poor quality. .EPS gets it
> amazingly right, but at the expense of quite longer output times.
> 
> For raster images, i have the problem that the size option in savefig() does not
> work. It does at least try if I put the savefig() command with size
> option twice,
> but what happens is the following: The resulting figure's size is
> right, but everything
> is blank except for the upper left corner in which the original. So if
> I could write a,
> say 5000x5000 raster image, that would solve too. But I dont even know
> if there is
> a limit to the xvfb screen sizes. So .eps would be much preferred.

Try using the magnification of the scene. If 's' is your mayavi scene 
then you can do:

  s.scene.magnification = 2 # or 4

and VTK should magnify the rendered image.  Try it and see if that helps.

HTH,
cheers,
prabhu

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 

Gmane