Python Tips and Tricks

From KitwarePublic
Revision as of 15:46, 11 August 2009 by Tmjung (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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.