Python Tips and Tricks: Difference between revisions

From KitwarePublic
Jump to navigationJump to search
(New page: =Introduction= ParaView filters This usecase shows a user how to use filters to modify the display of data. All filter examples assume that the user starts with a new model. To start o...)
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
=Introduction=
=Introduction=


ParaView filters
These are some tips and tricks I found useful when learning how to use python.


This usecase shows a user how to use filters to modify the display of data.


All filter examples assume that the user starts with a new model.  To start over, go to the menu item '''Edit → Delete All''', and then re-open your data.
==Default Values==
Currently, when using pvpython some default values are not set for certain variables as they would be if the GUI was used. If something is not working it is most likely because a value is not set.


Data is opened by going to '''File → Open'''. Example data files can be found on the ParaView web page at http://www.paraview.org.
==Using the GUI==
Filters and sources can be accessed through the GUI by opening the python console. This is very useful for checking values. If you are unsure how to implement something in python you can first set it up using the GUI and then systematically go through it using python.
 
==Using the Camera==
Manipulating the camera in python is much more challenging than using the GUI. It does allow for a certain level of precision which is difficult to achieve in the GUI though.
It is possible to use the GUI to find relative positions of the camera.
 
 
 
=Acknowledgements=
Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear Security Administration under contract DE-AC04-94AL85000.

Latest revision as of 15:46, 11 August 2009

Introduction

These are some tips and tricks I found useful when learning how to use python.


Default Values

Currently, when using pvpython some default values are not set for certain variables as they would be if the GUI was used. If something is not working it is most likely because a value is not set.

Using the GUI

Filters and sources can be accessed through the GUI by opening the python console. This is very useful for checking values. If you are unsure how to implement something in python you can first set it up using the GUI and then systematically go through it using python.

Using the Camera

Manipulating the camera in python is much more challenging than using the GUI. It does allow for a certain level of precision which is difficult to achieve in the GUI though. It is possible to use the GUI to find relative positions of the camera.


Acknowledgements

Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for the United States Department of Energy’s National Nuclear Security Administration under contract DE-AC04-94AL85000.