MayaVi

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Mayavi
DeveloperEnthought
Initial release2019; 7 years ago (2019)
Repository
  • {{URL|example.com|optional display text}}Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
Written inPython, VTK, wxPython/Qt
Engine
    Lua error in Module:EditAtWikidata at line 29: attempt to index field 'wikibase' (a nil value).
    Operating systemLinux, Mac OS X, Windows
    Available inEnglish
    TypeData visualization
    LicenseBSD License
    Websitedocs.enthought.com/mayavi/mayavi/

    Lua error in mw.title.lua at line 392: bad argument #2 to 'title.new' (unrecognized namespace name 'Portal'). MayaVi is a scientific data visualizer written in Python, which uses VTK and provides a GUI via Tkinter. MayaVi was developed by Prabhu Ramachandran, is free and distributed under the BSD License. It is cross-platform and runs on any platform where both Python and VTK are available (almost any Unix, Mac OS X, or Windows). MayaVi is pronounced as a single name, "Ma-ya-vee", meaning "magical" in Sanskrit. The code of MayaVi has nothing in common with that of Autodesk Maya or the Vi text editor.[1]

    The latest version of MayaVi, called Mayavi2, is a component of the Enthought suite of scientific Python programs. It differs from the original MayaVi by its strong focus on making an interactive program and a reusable component for 3D plotting in Python. Although it exposes a slightly different interface and API than the original MayaVi, it now has more features.[2][3]

    Major features

    [edit | edit source]
    • visualizes computational grids and scalar, vector, and tensor data
    • an easy-to-use GUI
    • can be imported as a Python module from other Python programs or can be scripted from the Python interpreter
    • supports volume visualization of data via texture and ray cast mappers
    • support for any VTK dataset using the VTK data format
    • support for PLOT3D data
    • multiple datasets can be used simultaneously
    • provides a pipeline browser, with which objects in the VTK pipeline can be browsed and edited
    • imports simple VRML and 3D Studio scenes
    • custom modules and data filters can be added
    • exporting to PostScript files, PPM/BMP/TIFF/JPEG/PNG images, Open Inventor, Geomview OOGL, VRML files, Wavefront .obj files, or RenderMan RIB file

    Examples

    [edit | edit source]

    Spherical harmonics

    [edit | edit source]
    File:Mayavi spherical harmonics Y 3 0.jpg
    The spherical harmonic function Y30(θ,φ)
    from numpy import linspace, meshgrid, array, sin, cos, pi, abs
    from scipy.special import sph_harm
    from mayavi import mlab
    
    theta_1d = linspace(0, pi, 91)
    phi_1d = linspace(0, 2 * pi, 181)
    
    theta_2d, phi_2d = meshgrid(theta_1d, phi_1d)
    xyz_2d = array(
        [sin(theta_2d) * sin(phi_2d), sin(theta_2d) * cos(phi_2d), cos(theta_2d)]
    )
    l = 3
    m = 0
    
    Y_lm = sph_harm(m, l, phi_2d, theta_2d)
    r = abs(Y_lm.real) * xyz_2d
    
    mlab.figure(size=(700, 830))
    mlab.mesh(r[0], r[1], r[2], scalars=Y_lm.real, colormap="cool")
    mlab.view(azimuth=0, elevation=75, distance=2.4, roll=-50)
    mlab.savefig("Y_%i_%i.jpg" % (l, m))
    mlab.show()
    

    References

    [edit | edit source]
    1. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    2. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    3. ^ Lua error in Module:Citation/CS1/Configuration at line 2172: attempt to index field '?' (a nil value).
    [edit | edit source]