3D Data visualization with Mayavi



Similar documents
Material for tutorial. Twitter: prabhu_r. Slides: Demos:

Mayavi User Guide. Release Prabhu Ramachandran, Gael Varoquaux


MayaVi: A free tool for CFD data visualization

Visualization with ParaView. Greg Johnson

Visualization with ParaView

Processing Data with rsmap3d Software Services Group Advanced Photon Source Argonne National Laboratory

VisIt Visualization Tool

Cassandra 2.0: Tutorial

Steady Flow: Laminar and Turbulent in an S-Bend

Scientific Visualization with ParaView

Plotting: Customizing the Graph

NaviCell Data Visualization Python API

Solutions to Practice Problems for Test 4

Visualizing molecular simulations

Visualization Plugin for ParaView

Gephi Tutorial Visualization

Getting more out of Matplotlib with GR

Computational Fluid Dynamics. Department of Aerospace Engineering, IIT Bombay

Creo Simulate 1.0 April 2011

AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables

CLOUD DIGITISER 2014!

GR A universal framework for visualization applications

Why are we teaching you VisIt?

Finding Drag Coefficient using Solidworks Flow Simulation

ICEM CFD Tutorial. Simple Duct Grid

RAJALAKSHMI ENGINEERING COLLEGE MA 2161 UNIT I - ORDINARY DIFFERENTIAL EQUATIONS PART A

version 3.0 tutorial - Turbulent mixing in a T-junction with CFDSTUDY in SALOME contact: saturne-support@edf.fr

Plug-in Software Developer Kit (SDK)

Python. Python. 1 Python. M.Ulvrova, L.Pouilloux (ENS LYON) Informatique L3 Automne / 25

Postprocessing with Python

How is EnSight Uniquely Suited to FLOW-3D Data?

Building a Python Plugin

17 April Remote Scan

OpenFOAM postprocessing and advanced running options

Quick Start Guide. Microsoft Access 2013 looks different from previous versions, so we created this guide to help you minimize the learning curve.

ParaView s Comparative Viewing, XY Plot, Spreadsheet View, Matrix View

Nicolas P. Rougier PyConFr Conference 2014 Lyon, October 24 25

Microsoft PowerPoint 2011

Simulation of wireless ad-hoc sensor networks with QualNet

Signal Processing First Lab 01: Introduction to MATLAB. 3. Learn a little about advanced programming techniques for MATLAB, i.e., vectorization.

RVA: RESERVOIR VISUALIZATION AND ANALYSIS

Running and Scheduling QGIS Processing Jobs

Quick Start Guide. Microsoft Access 2013 looks different from previous versions, so we created this guide to help you minimize the learning curve.

Microsoft PowerPoint 2010

Exercise 0. Although Python(x,y) comes already with a great variety of scientic Python packages, we might have to install additional dependencies:

ABAQUS Tutorial. 3D Modeling

Outlook . User Guide IS TRAINING CENTER. 833 Chestnut St, Suite 600. Philadelphia, PA

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

Working with Excel in Origin

How to start with 3DHOP

Introduction to Visualization with VTK and ParaView

RDM+ Remote Desktop for Android. Getting Started Guide

GR Framework / MODBUS on Raspberry Pi

Analysis Programs DPDAK and DAWN

SilkTest Workbench. Getting Started with.net Scripts

14.1. bs^ir^qfkd=obcib`qflk= Ñçê=emI=rkfuI=~åÇ=léÉåsjp=eçëíë

What is new in WiseImage

FreeFem++-cs, the FreeFem++ Graphical Interface

KaleidaGraph Quick Start Guide

Twelve. Figure 12.1: 3D Curved MPR Viewer Window

Using MuPAD and JavaView to Visualize Mathematics on the Internet

TABLE OF CONTENTS. INTRODUCTION... 5 Advance Concrete... 5 Where to find information?... 6 INSTALLATION... 7 STARTING ADVANCE CONCRETE...

Pro/ENGINEER Wildfire 4.0 Basic Design

DataPA OpenAnalytics End User Training

Introduction to Paraview. H.D.Rajesh

Word basics. Before you begin. What you'll learn. Requirements. Estimated time to complete:

Attix5 Pro Server Edition

James Ahrens, Berk Geveci, Charles Law. Technical Report

Microsoft Migrating to Access 2010 from Access 2003

An introduction to 3D draughting & solid modelling using AutoCAD

Glass coloured glass may pick up on scan. Top right of screen tabs: these tabs will relocate lost windows.

OpenScape Web Collaboration for Microsoft Windows OS

Maple Quick Start. Introduction. Talking to Maple. Using [ENTER] 3 (2.1)

Exam 1 Sample Question SOLUTIONS. y = 2x

Explore commands on the ribbon Each ribbon tab has groups, and each group has a set of related commands.

Programming in Slicer4

Data Mining. SPSS Clementine Clementine Overview. Spring 2010 Instructor: Dr. Masoud Yaghini. Clementine

Comsol Multiphysics. Physics Builder User s Guide VERSION 4.3 BETA

SHORTCUTS PHOTO PERSONA

Quickstart for Desktop Version

Introduction to Python

Using HDR Panoramas. Dr Ryan Southall - School of Architecture & Design, University of Brighton.

A Tutorial on dynamic networks. By Clement Levallois, Erasmus University Rotterdam

Script Manager for Nexio G-Scribe

Visualization and Post Processing of OpenFOAM results a Brie. a Brief Introduction to VTK

The Vector or Cross Product

ANSYS CFD-Post Tutorials

PolyWorks V10 Beginner s Guide

Building Visualization using Autodesk VIZ

MicroStrategy Analytics Express User Guide

How to use Wireframe in Visio

Fundamentals of Computer Animation


Applying a circular load. Immediate and consolidation settlement. Deformed contours. Query points and query lines. Graph query.

Configuring MassTransit Server to listen on ports less than 1024 using WaterRoof on Macintosh Workstations

Introduction to Microsoft Access 2003

Transcription:

3D Data visualization with Mayavi Prabhu Ramachandran Department of Aerospace Engineering IIT Bombay SciPy.in 2012, December 27, IIT Bombay. Prabhu Ramachandran (IIT Bombay) Mayavi2 tutorial 1 / 53

In memory of John Hunter,

Kenneth Gonsalves,

and Raj Mathur.

Objectives At the end of this session you will be able to: 1 Use mlab effectively to visualize numpy array data of various kinds 2 Apply some of mayavi s advanced features

Outline 1 Quick introduction to Mayavi 2 mlab Prabhu Ramachandran (IIT Bombay) Mayavi2 tutorial 6 / 53

Outline 1 Quick introduction to Mayavi 2 mlab Prabhu Ramachandran (IIT Bombay) Mayavi2 tutorial 7 / 53

Overview of features

Live in your dialogs

Mayavi in applications

Exploring the documentation

Other features Easy customization Offscreen animations Automatic script generation Powerful command line options

Summary http://code.enthought.com/projects/ mayavi Uses VTK (www.vtk.org) BSD license Linux, win32 and Mac OS X Highly scriptable Embed in Traits UIs (wxpython and PyQt4) Envisage Plugins Debian/Ubuntu/Fedora Pythonic 5

Outline 1 Quick introduction to Mayavi 2 mlab Prabhu Ramachandran (IIT Bombay) Mayavi2 tutorial 15 / 53

Overview Simple Convenient Full-featured Prabhu Ramachandran (IIT Bombay) Mayavi2 tutorial 16 / 53

Getting started Vanilla: $ ipython gui=wx with Pylab: $ ipython pylab=wx

Using mlab: >>> from enthought. mayavi import mlab Try these: >>> mlab. test_ <TAB> >>> mlab. test_contour3d ( ) >>> mlab. test_contour3d??

Exploring the view Mouse Keyboard Toolbar Mayavi icon 10

mlab plotting functions 0D data >>> from numpy import >>> t = l i nspace ( 0, 2 pi, 50) >>> u = cos ( t ) p i >>> x, y, z = s i n ( u ), cos ( u ), s i n ( t ) >>> mlab.points3d(x, y, z)

Changing how things look Clearing the view >>> mlab.clf() IPython is your friend! >>> mlab.points3d? Extra argument: Scalars Keyword arguments UI >>> mlab. points3d ( x, y, z, t, scale_mode= none )

Changing how things look Clearing the view >>> mlab.clf() IPython is your friend! >>> mlab.points3d? Extra argument: Scalars Keyword arguments UI >>> mlab. points3d ( x, y, z, t, scale_mode= none )

Changing how things look Clearing the view >>> mlab.clf() IPython is your friend! >>> mlab.points3d? Extra argument: Scalars Keyword arguments UI >>> mlab. points3d ( x, y, z, t, scale_mode= none )

1D data >>> mlab.plot3d(x, y, z, t ) Plots lines between the points

2D data >>> x, y = mgrid [ 3:3:100 j, 3:3:100 j ] >>> z = s i n ( x x + y y ) >>> mlab.surf(x, y, z) Assumes the points are rectilinear

2D data: mlab.mesh >>> mlab.mesh(x, y, z) Points needn t be regular >>> phi, t h e t a = numpy. mgrid [ 0 : p i :20 j,... 0:2 p i :20 j ] >>> x = s i n ( phi ) cos ( t h e t a ) >>> y = s i n ( phi ) s i n ( t h e t a ) >>> z = cos ( phi ) >>> mlab. mesh( x, y, z,... r e p r e s e n t a t i o n = wireframe )

3D data >>> x, y, z = o g r i d [ 5:5:64 j,... 5:5:64 j,... 5:5:64 j ] >>> mlab. contour3d ( x x 0.5 + y y + z z 2)

3D vector data: mlab.quiver3d >>> mlab. t e s t _ q u i v e r 3 d ( ) obj = mlab.quiver3d(x, y, z, u, v, w) 40

3D vector data: mlab.flow >>> x, y, z = mgrid [ 2:3, 2:3, 2:3] >>> r = s q r t ( x 2 + y 2 + z 4) >>> u = y s i n ( r ) / ( r +0.001) >>> v = x s i n ( r ) / ( r +0.001) >>> w = z e r o s _ l i k e ( z ) >>> obj = mlab. flow ( x, y, z, u, v, w, seedtype= plane ) >>> obj. stream_tracer. i n t e g r a t o r _ t y p e = \ runge_kutta45

Exercise: Lorenz equation dx dt dy dt dz dt = s(y x) = rx y xz = xy bz Let s = 10, r = 28, b = 8./3. Region of interest x, y, z = mgrid [ 50:50:20 j, 50:50:20 j, 10:60:20 j ] Use mlab.quiver3d

mlab. quiver3d ( x, y, z, u, v, w, s c a l e _ f a c t o r =0.01, mask_points =5) mlab. show ( ) Solution def lorenz ( x, y, z, s =10., r =28., b = 8. / 3. ) : u = s ( y x ) v = r x y x z w = x y b z return u, v, w x, y, z = mgrid [ 50:50:20 j, 50:50:20 j, 10:60:20 j ] u, v, w = lorenz ( x, y, z )

Issues and solutions Basic visualization: not very useful Tweak parameters: mask_points, scale_factor Explore parameters on UI mlab.flow is a lot better! Good visualization involves work 50

Other utility functions gcf: get current figure savefig, figure axes, outline title, xlabel, ylabel, zlabel colorbar, scalarbar, vectorbar show: Standalone mlab scripts Others, see UG

Can we do more? Yes!

quiver3d ( x, y, z, u, v, w, s c a l e _ f a c t o r =0.01, mask_points =5)

Looking inside

The pipeline 60

Mayavi Engine TVTK Scene Source Filter ModuleManager Lookup tables List of Modules

Changing the pipeline On UI Right click on node drag drop Script Or use mlab.pipeline Example: mlab.pipeline. outline () obj.remove()

Exercise >>> mlab. t e s t _ q u i v e r 3 d ( ) Hide vectors, add a Vector Cut Plane >>> mlab. t e s t _ f l o w ( ) Add a Vector Cut Plane Can also use the Lorenz example

Exercise >>> mlab. t e s t _ q u i v e r 3 d ( ) Hide vectors, add a Vector Cut Plane >>> mlab. t e s t _ f l o w ( ) Add a Vector Cut Plane Can also use the Lorenz example

Surprised?

So what is the problem?

Points?

Curve?

Surface?

Interior of sphere?

Datasets Quiver v/s Flow 75

Recap mlab gets you started Pipeline and data flow Datasets are important

Changing the pipeline On UI Right click on node drag drop Script Or use mlab.pipeline Example: mlab.pipeline. outline () obj.remove()

mlab and Mayavi2? mlab is just a thin layer over the Mayavi OO API mlab commands return mayavi objects

Exercise 1 Start with flow for the Lorenz system 2 Now extract the vector norm (use a filter) 3 Plot iso-contours of this 4 Figure out how to do this from the UI and mlab.pipeline 85 Prabhu Ramachandran (IIT Bombay) Mayavi2 tutorial 49 / 53

So how do you make a fancier script? Use script recording Demo

So how do you make a fancier script? Use script recording Demo

Animating data >>> s = mlab. flow ( x, y, z, u, v, w) >>> s. mlab_source. u = u z mlab_source.set: multiple attributes If you change the shape of the arrays use the reset method

Setting the view >>> p r i n t mlab. view ( ) >>> mlab. view ( azimuth=none, e l e v a t i o n =None, distance=none, f o c a l p o i n t =None ) 100

Thank you!