VTKpytools
vtkpytools is a python package developed in house that has useful tools for generating Visualization ToolKit (VTK) files, and for extracting and manipulating data from VTK files. The code is hosted on a repository in PHASTA's GitHub organization.
vtkpytools heavily utilizes the pyvista Python package, which provides a Pythonic interface to VTK objects, and the Python bindings for the VTK library itself (which are simply one-to-one copies of the C++ API).
Contents
Using vtkpytools
Installation
Normal Use
vtkpytools is already installed on the global (main
) conda environment installed on the viz nodes. This also makes all vtkpytool scripts (ie. bar2vtk.py
and barsplit.py
, etc.) available in your $PATH
when the conda environment is active, allowing them to be used in command line. This installation with be updated periodically as updates are made.
This was done by going to a cloned version of the vtkpytools repository and running python setup.py install
with the conda environment active (see Anaconda#Activating_conda_Environment).
Development Use
If you're making changes to the code and want to test it out, there are two ways to "override" the normal installation.
Adding to Path
First is adding the development repository to the path that Python searches for packages. This maybe done by modifying the $PYTHONPATH
environment variable or by using the following commands in a script:
import sys sys.path.insert(0, 'path/to/vtkpytools/repository/directory')
Creating a New (personal) Conda Environment
The second way is creating a new conda (personal) environment and installing your copy of the repository there. If going this route, it is recommended to install the package via python setup.py develop
as this will allow updates to be tested without reinstalling the package everytime.
Abbreviation
In Python, it is somewhat customary to use an abbreviation for packages when importing them (numpy -> np
or pandas -> pd
). In that same vein, vtkpytools
maybe abbreviated to vpt
. For those unfamiliar, this maybe done by
import vtkpytools as vpt
Expanding vtkpytools
Currently, the vtkpytools repository is structured so that it can be expanded to host useful functions/utilities/scripts for many different kinds of problems/uses. If you would like to make changes/additions to the package, see the (to be added) CONTRIBUTING.md
file in the repository for instructions.