DescriptionPyGpiv is a Python module of Libgpiv that allows to use the library in Python scripts. The module has been generated by wrapping the Libgpiv headers using SWIG, which also allows to wrap software easily to other script and compiled languages, like: Perl, PHP, Ruby, Tcl/Tk, Clisp, Guile, Java.
Writing scipts in Python (or any other script language) allows
rapid prototyping in a structured way, without being bothered
about memory (de-)allocation and without the need to go through
the writing/compiling/running cycle after each modification of
The Python language has been choosen for wrapping Libgpiv for different reasons:
- It is designed for numerical purposes.
- It is a very well structured, objective language allowing small programs, but also large, complicated projects
- The syntax is simple, self-explaining and straightforward. This provides easy learning the language and easy maintaining the software.
- There is a huge amount of additional software and modules available for numerical calculations, web applications, administrative tasks, (graphical) output, user interfaces etc.
Unpacking, building and installationYou can download the package here. Unpacking is done with:
gzip -d pygpiv-*.tar.gz
tar -xvf pygpiv-*.tar
building the package is done with:
python setup.py build_ext
and installing the module in the correct Python directory with:
python setup.py install
PyGpiv has been included in the Debian GNU/Linux distribution. Users of this system can install the software by means of the apt-tools and aptitude, without to be bothered about dependencies. PyGpiv is available for most of the computer architectures Debian GNU/Linux is supporting,
An example script and PIV image-pair is provided in the
example/ directory of the package. Probably the script can find the
module when installed to a standard Python
directory. Else, the PYTHONPATH will have to be set. In bash this is done by:
Running the script is perfomed with:
Using PyGpivThe full API of Libgpiv has been wrapped, so documentation may be found at the API documentation of Libgpiv.
The module can be used after launching (i)python (for
interactive use) or including in a script by invoking:
Any Libgpiv function gpiv_*() then is called by
or if the module is loaded following:
from _pygpiv import *
The functions may be called by:
Only variables of int, char or float that have been
wrapped by Swig are recognized from a python script. Other
variables, like arrays and structures are mapped into a
pointer. So, these variables are opage when used from a
python script and can only be used internally by
libgpiv. Therefore, some additional functions have been
added in the wrapper to access individual array members.
These have _i_get and _i_set or _ij_get and _ij_set in
their name for 1 and 2-dim arrays respectively. For
example to get the value of array member dx[i][j] from the
GpivPivData struct: To define a value at dx[i][j] is done
value = GpivPivData_dx_ij_get(gpiv_data, i, j)
GpivPivData_dx_ij_set(gpiv_data, i, j, value).
To define a value at dx[i][j] is done