Paraview scripting. Raffaele Ponzini r.ponzini@cineca.it SuperComputing Applications and Innovation Department



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

Why are we teaching you VisIt?

Visualization with ParaView

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

CHAPTER FIVE RESULT ANALYSIS

Scientific data formats and visualization of large datasets

Introduction to Batch Visualization

Visualization Plugin for ParaView


VisIt Visualization Tool

Introduction to Visualization with VTK and ParaView

Scientific Visualization with ParaView

Getting Started with IVI-COM and Python for the Lambda Genesys Power Supply

Building and breaking a Python sandbox

Cassandra 2.0: Tutorial

Facts about Visualization Pipelines, applicable to VisIt and ParaView

Python Objects. Charles Severance

Microsoft Windows PowerShell v2 For Administrators

Visualization with ParaView. Greg Johnson

NaviCell Data Visualization Python API

MayaVi: A free tool for CFD data visualization

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

School Presentation. Raffaele Ponzini SuperComputing Applications and Innovation Department

Scientific Visualization with Open Source Tools. HM 2014 Julien Jomier

Introduction to Paraview. H.D.Rajesh

Post-processing and Visualization with Open-Source Tools. Journée Scientifique Centre Image April 9, Julien Jomier

Using the JNIOR with the GDC Digital Cinema Server. Last Updated November 30, 2012

Parallel Large-Scale Visualization

Desktop, Web and Mobile Testing Tutorials

Visualization with OpenDX

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

SOFTWARE TESTING TRAINING COURSES CONTENTS

3D Data visualization with Mayavi

OpenFOAM postprocessing and advanced running options

TEST AUTOMATION FRAMEWORK

The Visualization Pipeline

Exercise 1: Python Language Basics

Cisco SSL Encryption Utility

Advanced Tornado TWENTYONE Advanced Tornado Accessing MySQL from Python LAB

32-Bit Workload Automation 5 for Windows on 64-Bit Windows Systems

DiskPulse DISK CHANGE MONITOR

Copyrighted , Address :- EH1-Infotech, SCF 69, Top Floor, Phase 3B-2, Sector 60, Mohali (Chandigarh),

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

IriScene Remote Manager. Version 4.8 FRACTALIA Software

Exploratory Climate Data Visualization and Analysis

AVS/Express - an object-oriented visual development tool

Being Productive Venkat Subramaniam

Generating Automated Test Scripts for AltioLive using QF Test

Windows PowerShell Cookbook

AXT JOBS GUI Users Guide

Microsoft. Jump Start. M3: Managing Windows Server 2012 by Using Windows PowerShell 3.0

Whisler 1 A Graphical User Interface and Database Management System for Documenting Glacial Landmarks

HPC Wales Skills Academy Course Catalogue 2015

B&K Precision 1785B, 1786B, 1787B, 1788 Power supply Python Library

NNMi120 Network Node Manager i Software 9.x Essentials

Microsoft Visual Basic Scripting Edition and Microsoft Windows Script Host Essentials

How to Run Parallel Jobs Efficiently

Get quick control over your Linux server with server commands

Open source framework for interactive data exploration in server based architecture

IV3Dm provides global settings which can be set prior to launching the application and are available through the device settings menu.

RemoteApp Reference Guide. Outline

Rapid Access Cloud: Se1ng up a Proxy Host

Parallel Visualization of Petascale Simulation Results from GROMACS, NAMD and CP2K on IBM Blue Gene/P using VisIt Visualization Toolkit

MatrixSSL Getting Started

CAPIX Job Scheduler User Guide

Fundamentals of Java Programming

DVS-100 Installation Guide

Test Automation Integration with Test Management QAComplete

Advanced visualization with VisNow platform Case study #3 Vector data visualization

Developing a Web Server Platform with SAPI Support for AJAX RPC using JSON

Advanced Visualization for Chemistry

Monitoring Replication

MultiAlign Software. Windows GUI. Console Application. MultiAlign Software Website. Test Data

NETWRIX CHANGE NOTIFIER

Using Logon Agent for Transparent User Identification

Copyright Notice SmartBear Software. All rights reserved.

Java SE 8 Programming

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

NonStop SQL Database Management

Rapid Game Development Using Cocos2D-JS

Parallel Analysis and Visualization on Cray Compute Node Linux

Software Automated Testing

Datzilla. Error Reporting and Tracking for NOAA Data

PDF Signer User Manual

ArcGIS. Writing Geoprocessing Scripts With ArcGIS

Audit TM. The Security Auditing Component of. Out-of-the-Box

DocAve Upgrade Guide. From Version 4.1 to 4.5

CommonSpot Content Server Version 6.2 Release Notes

The Research and Design of NSL-Oriented Automation Testing Framework

BarTender s ActiveX Automation Interface. The World's Leading Software for Label, Barcode, RFID & Card Printing

Certified The Grinder Testing Professional VS-1165


In-situ Visualization

Subversion Integration

GUI application set up using QT designer. Sana Siddique. Team 5

Perl/CGI. CS 299 Web Programming and Design

Published. Technical Bulletin: Use and Configuration of Quanterix Database Backup Scripts 1. PURPOSE 2. REFERENCES 3.

LAMBDA CONSULTING GROUP Legendary Academy of Management & Business Development Advisories

Accessing Your Database with JMP 10 JMP Discovery Conference 2012 Brian Corcoran SAS Institute

Transcription:

Paraview scripting Raffaele Ponzini r.ponzini@cineca.it SuperComputing Applications and Innovation Department

OUTLINE Why scripting pvbatch and pvpython Macros Scripting using a tracefile Journaling in Paraview GUI Hands-on Python Scripting in ParaView

WHY SCRIPTING Automate repetitive tasks (several similar datesets) GUI is not useful or unavailable (batch execution) In-situ visualization or co-processing (computing+post-processing)

pvbatch - pvpython Paraview contents 2 command lines able to run a python script: pvbatch; pvpython; The differences is that: pvpython is equivalent to the paraview client where the python interpreter plays the role of the GUI (interactive, serial); pvbatch: is equivalent to the paraview server where the commands are coming from the python script instead then from a socket plugged to a paraview client (parallel)

Python interpreter in ParaView The python interpreter is already runnable from paraview to perfom interactive applications

BUILD A PYTHON SCRIPT IN THE PARAVIEW GUI 1. Start tracing 2. Build your pipeline as usual 3. Stop tracing and save the trace file with a name

Use the trace file You can use the traced file in two ways: - As a macro - As a python script using the GUI - As a python script in batch

The paraview.simple module The first thing any ParaView Python script must do is load the paraview.simple module. from paraview.simple import * Or in a save way using the try/except construct try: paraview.simple except: from paraview.simple import * This command is automatically invoked in the ParaView GUI tracing facility, but it must add when you are writing a script to be used in batch either by pvpython or by pvbatch. The paraview.simple module contains a function for every source, reader,filter, and writer with off-course the same name as shown in the GUI menus but with spaces and special characters removed. Each function creates a pipeline object, which will show up in the pipeline browser (with the exception of writers), and returns an object that is a proxy that can be used to query and manipulate the properties of that pipeline object.

BATCH SCRIPTING IN PYTHON try: paraview.simple except: from paraview.simple import * paraview.simple._disablefirstrendercamerareset() data_morphed_ = LegacyVTKReader( FileNames=['C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_0.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_1.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_2.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_3.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_4.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_5.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_6.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_7.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_8.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_9.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_10.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_11.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_12.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_13.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_14.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_15.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_16.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_17.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_18.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_19.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_20.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_21.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_22.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_23.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_24.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_25.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_26.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_27.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_28.vtk', 'C:\\Users\\ponzini\\Dropbox\\Summer-Viz-School- 2013\\Perticoni\\codeAndData\\data_morphed_exported_as_StructuredPoints_VTK\\data_morphed_29.vtk'] )

BATCH SCRIPTING IN PYTHON AnimationScene1 = GetAnimationScene() AnimationScene1.EndTime = 29.0 AnimationScene1.PlayMode = 'Snap To TimeSteps' RenderView1 = GetRenderView() a1_scalars_pvlookuptable = GetLookupTableForArray( "scalars", 1, RGBPoints=[-77.78269958496094, 0.23, 0.299, 0.754, 39.99039840698242, 0.706, 0.016, 0.15], VectorMode='Magnitude', NanColor=[0.25, 0.0, 0.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0, AllowDuplicateScalars=1 ) a1_scalars_piecewisefunction = CreatePiecewiseFunction( Points=[0.0, 0.0, 0.5, 0.0, 1.0, 1.0, 0.5, 0.0] ) DataRepresentation1 = Show() DataRepresentation1.EdgeColor = [0.0, 0.0, 0.5000076295109483] DataRepresentation1.SelectionPointFieldDataArrayName = 'scalars' DataRepresentation1.ScalarOpacityFunction = a1_scalars_piecewisefunction DataRepresentation1.ColorArrayName = 'scalars' DataRepresentation1.ScalarOpacityUnitDistance = 4.349219049453166 DataRepresentation1.LookupTable = a1_scalars_pvlookuptable DataRepresentation1.Representation = 'Slice' DataRepresentation1.ScaleFactor = 3.0 RenderView1.CameraFocalPoint = [14.0, 15.0, 0.0] RenderView1.CameraPosition = [14.0, 15.0, 10000.0] RenderView1.InteractionMode = '2D' RenderView1.CenterOfRotation = [14.0, 15.0, 0.0]

BATCH SCRIPTING IN PYTHON a1_scalars_pvlookuptable.scalaropacityfunction = a1_scalars_piecewisefunction ScalarBarWidgetRepresentation1 = CreateScalarBar( Title='scalars', LabelFontSize=12, Enabled=1, LookupTable=a1_scalars_PVLookupTable, TitleFontSize=12 ) GetRenderView().Representations.append(ScalarBarWidgetRepresentation1) RenderView1.CameraPosition = [14.0, 15.0, 79.27656374961008] RenderView1.CameraClippingRange = [78.48379811211397, 80.46571220585423] RenderView1.CameraParallelScale = 20.518284528683193 a1_scalars_pvlookuptable.rgbpoints = [-100.0, 0.23, 0.299, 0.754, 100.0, 0.706, 0.016, 0.15] a1_scalars_pvlookuptable.lockscalarrange = 1 a1_scalars_piecewisefunction.points = [-100.0, 0.0, 0.5, 0.0, 100.0, 1.0, 0.5, 0.0] WriteAnimation('C:/Users/ponzini/Dropbox/Summer-Viz-School-2013/Ponzini/tutorial/animation.avi', Magnification=1, Quality=2, FrameRate=1.000000) Render()

BATCH SCRIPTING IN PYTHON

Python 2.7.3 (default, Feb 4 2013, 20:52:48) [MSC v.1500 64 bit (AMD64)] on win32 >>> paraview version 3.98.1-RC2 from paraview.simple import * >>> help(sphere) BATCH SCRIPTING IN PYTHON Help on function CreateObject in module paraview.simple: CreateObject(*input, **params) The Sphere source can be used to add a polygonal sphere to the 3D scene. The output of the Sphere source is polygonal data with point normals defined. This function creates a new proxy. For pipeline objects that accept inputs, all non-keyword arguments are assumed to be inputs. All keyword arguments are assumed to be property,value pairs and are passed to the new proxy. >>> help(show) Help on function Show in module paraview.simple: Show(proxy=None, view=none, **params) Turns the visibility of a given pipeline object on in the given view. If pipeline object and/or view are not specified, active objects are used. >>> help(render) Help on function Render in module paraview.simple: Render(view=None) Renders the given view (default value is active view) >>> help(hide) Help on function Hide in module paraview.simple: Hide(proxy=None, view=none) Turns the visibility of a given pipeline object off in the given view. If pipeline object and/or view are not specified, active objects are used.

BATCH SCRIPTING IN PYTHON >>> mysphere=sphere() >>> dir(mysphere) ['CellData', 'Center', 'EndPhi', 'EndTheta', 'FieldData', 'FileNameChanged', 'GetCellDataInformation', 'GetDataInformation', 'GetFieldDataInformation', 'GetPointDataInformation', 'GetProperty', 'GetPropertyValue', 'Initialize', 'InitializeFromProxy', 'ListProperties', 'Observed', 'ObserverTag', 'PhiResolution', 'PointData', 'Port', 'Radius', 'SMProxy', 'SetPropertyWithName', 'StartPhi', 'StartTheta', 'ThetaResolution', 'UpdatePipeline', 'UpdatePipelineInformation', '_Proxy ConvertArgumentsAndCall', '_Proxy GetActiveCamera', '_Proxy LastAttrName', '_Proxy Properties', ' class ', ' del ', ' delattr ', ' dict ', ' doc ', ' eq ', ' format ', ' getattr ', ' getattribute ', ' getitem ', ' hash ', ' init ', ' iter ', ' module ', ' ne ', ' new ', ' reduce ', ' reduce_ex ', ' repr ', ' setattr ', ' sizeof ', ' str ', ' subclasshook ', ' weakref ', 'add_attribute'] >>> print mysphere.radius 0.5 >>> print mysphere.pointdata <paraview.servermanager.fielddatainformation object at 0x0000000017BBAC50> >>> Render() <paraview.servermanager.renderview object at 0x0000000018044FD0> >>> Show() <paraview.servermanager.geometryrepresentation object at 0x0000000017A50748> >>>

Recording a Paraview pipeline A similar (but different) solution to launch a pipeline in an automated way is to: record a test and then to: Play a test

WORKOUT Build a script to process several VTK dataset according to the pipeline obtained during the tutorial of day-3 Launch the script over the dataset to archive different animations Record a test and play it for the above mentioned operations