Difference between revisions of "VTKpytools"

From PHASTA Wiki
Jump to: navigation, search
(add vpt abbreviation for vtkpytools)
(Add link to Anaconda page)
Line 10: Line 10:
 
  sys.path.insert(0, 'path/to/vtkpytools/repository/directory')  
 
  sys.path.insert(0, 'path/to/vtkpytools/repository/directory')  
  
This makes you have control over which version of vtkpytools you use. Alternatively, the package can be installed to your python environment by running <code>python setup.py install</code> in the repository directory. If running this on the global installed conda environment on the viz nodes, this will update/install the package version for ''everyone''.  
+
This makes you have control over which version of vtkpytools you use. Alternatively, the package can be installed to your python environment by running <code>python setup.py install</code> in the repository directory. If running this on the [[Anaconda|global installed conda]] environment on the viz nodes, this will update/install the package version for ''everyone''.  
  
 
=== Abbreviation ===
 
=== Abbreviation ===

Revision as of 17:26, 24 August 2020

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).

Using vtkpytools

The recommended (though admitedly clunky) way import vtkpytools is to add it to the python path in script then import it:

import sys                                                
sys.path.insert(0, 'path/to/vtkpytools/repository/directory') 

This makes you have control over which version of vtkpytools you use. Alternatively, the package can be installed to your python environment by running python setup.py install in the repository directory. If running this on the global installed conda environment on the viz nodes, this will update/install the package version for everyone.

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.