vis.pawsey.org.au

Paraview
Part 2

Overview

Scripting fundamentals

  • Use cases
  • Scripting methods
  • Common commands

Hands-on scripting

  • Creating/generating scripts
  • Running scripts
  • Creating pipelines

ParaView Scripting Fundamentals

What is scripting?

Why use scripting?

GUI
Script

Advantages / Use Cases

  • Workflow Automation
  • Simplification
  • Headless jobs
  • Reproducibility

Generating Scripts With a State File

(Hands-on)

Data

Select the example data file and desired parameters

/scratch/courses01/remote_vis/paraview/can.ex2

Load the data

Change the view angle and data representation

Go to different timestep

Save state file

Choose desired format

Select all properties

Load State File

Manipulating State File

The Python State File

AWST ()

Questions?

Scripting Tools

Scripting Tools

  • Visualisation in Stand-alone mode (pvpython)
  • Visualisation in Batch mode (pvbatch)
  • Visualisation in Client-server mode (pvpython + pvserver)
  • Visualisation in Client-Render Server-Data Server mode (pvpython + pvdataserver + pvrenderserver)

pvpython


pvbatch


pvpython + pvserver

Client-Server mode

pvpython + pvdataserver + pvserver

Client Render-Server Data-Server mode

Running ParaView Scripts

Running Scripts

1. ParaView Client Shell Interactive, scripts loading

Running Scripts

2. pvpython Stand-alone mode
Interactive scripting

module load virtualgl paraview
vglrun pvpython
from paraview.simple import *
							
vglrun pvpython PYTHON_FILE.py

Running Scripts

3. pvbatch Batch mode
MPI-enabled, headless, non-interactive

module load paraview
pvbatch PYTHON_FILE.py

Common Commands

To delete a variable: del variable d: lowercase
To delete an object from pipeline browser: Delete(object) D: uppercalse
To show an object: Show() // If pipeline object and/or view are not specified, active objects are used.
To refresh pipeline browser and reset the view: Render() // Optional
To switch off an object: Hide()
Help: help (command) // help(Render)
List all available classes of a sub-module dir(submodule.class) //dir(servermanager.connect)

Creating Pipeline

(Hands-on)

Crushing Can Script

/scratch/courses01/remote_vis/paraview/can.py
from paraview.simple import *
renderView1 = CreateView('RenderView')
SetActiveView(renderView1)
canex2 = ExodusIIReader(FileName=['/scratch/courses01/remote_vis/paraview/can.ex2'])
canex2.PointVariables = ['VEL']
canex2Display = Show(canex2, renderView1, 'UnstructuredGridRepresentation')
Render()

Generate Render Window

Use previous script with pvpython to generate interactive render window as below:

Hint:

To change the camera view angle, use following code:

renderView1.CameraPosition = [Xcoordinate, Ycoordinate, Zcoordinate]

To have interactive window, add following code to your script:

paraview.simple.Interact(view=None)

Try in ParaView Python Shell

canex2 = ExodusIIReader(FileName=['/scratch/courses01/remote_vis/paraview/can.ex2'])
canex2.PointVariables = ['VEL']
Show(canex2)
renderView = GetActiveView()
renderView.CameraPosition = [-37.04449555112574, -31.731530832524076, -8.5636485799288]
Render()

Challenge

Try to export screenshot as below image

AWST ()

Questions?

More Information and Help

Visualisation Documentation:

http://bit.ly/PawseyVisDoc

Contact:

visualisation@pawsey.org.au

Help:

help@pawsey.org.au

Thank You