Skip to main content

DPIVSoft Python

DPIVSoft is an open-source PIV (Particle Image Velocimetry) code, originally written in MATLAB by Thomas Leweke and Patrice Meunier (https://www.irphe.fr/~meunier/). This project ports it to Python and adds GPU acceleration through OpenCL.

Documentation (user guide and API reference): https://dpivsoft-python.readthedocs.io

Features

  • 2D PIV with iterative window deformation, on CPU or GPU (OpenCL), with masking of solid bodies
  • Stereo PIV: target calibration (TSI and LaVision), Soloff 3-component reconstruction and disparity (Δz) correction
  • Synthetic particle images from analytic flows or custom velocity fields (e.g. CFD)
  • Post-processing: vorticity, divergence and other derived fields
  • Per-vector uncertainty from the correlation peak ratio — Xue et al., Meas. Sci. Technol. 25, 115301 (2014)
  • Forces from 2D PIV fields:
    • Vorticity-based impulse method — Martín-Alcántara & Fernández-Feria, Phys. Rev. Fluids 4, 024702 (2019)
    • Mesh-based projection method — Chang, Proc. R. Soc. A 437:517–525 (1992)
  • A GUI for PIV, masks, stereo, post-processing, synthetic images and uncertainty

Status

DPIVSoft is in beta, and the API may change between versions.

  • 2D PIV (CPU and GPU) is the mature part: tested against analytic flows, with the GPU path checked against the CPU one.
  • Stereo PIV is validated on synthetic images only, not yet against experimental ground truth. Treat it as experimental.
  • Force methods are validated on analytic benchmark fields, not on noisy PIV data. The wall-shear term of the projection method is not reliable from PIV.

Results changed in several recent releases; check the changelog before reprocessing older data. Testing and feedback are welcome.

Installing

pip install dpivsoft

From source:

git clone https://gitlab.com/jacabello/dpivsoft_python.git
cd dpivsoft_python
python -m pip install .

For development, install in editable mode with the build, lint and documentation tools: python -m pip install -e ".[dev,docs]". requirements.txt pins one set of versions known to work.

Requirements:

  • Python ≥ 3.11 (tested on 3.11, 3.12 and 3.13). Dependencies are listed in pyproject.toml and installed by pip.
  • For the GPU path, an OpenCL runtime for your device (tested on an AMD RX 580). The CPU path needs none.

Quick start

GUI

Start the GUI from the Python environment where DPIVSoft is installed:

python -m dpivsoft.gui                 # empty window
python -m dpivsoft.gui session.yaml    # reopen a saved session (File → Save session)

The GUI needs tkinter, which pip cannot install. Some Python distributions package it separately (python3-tk on Debian/Ubuntu, python-tk on Homebrew). python -m tkinter opens a small test window if it is available.

Each PIV or stereo run writes its parameters.yaml next to the results, so it can be repeated from a script. Forces have no GUI tab; compute them from a script.

Scripts

Start with dpivsoft/Examples/simple_tutorial.py, then the getting started guide.

Examples

Example scripts are in dpivsoft/Examples/:

  • simple_tutorial.py — basic 2D PIV run (synthetic images → CPU PIV → plotting)
  • GPU_simple_tutorial.py — the same run on the GPU
  • masked_airfoil_tutorial.py — airfoil flow with the solid body masked out
  • stereo_tutorial.py — stereo PIV with calibration and 3-component reconstruction (downloads a ~197 MB public dataset)
  • forces_tutorial.py — forces on an analytic oscillating-cylinder flow with both methods
  • mesh_tutorial.py — FEM mesh and auxiliary potentials for the projection method
  • uncertainty_tutorial.py — calibrate per-vector uncertainty and check its coverage
  • performance.py — GPU vs CPU benchmark

Testing

Run the tests from a cloned repository (some write inside Examples/):

python -m unittest discover dpivsoft/tests -b

Or run a single suite, e.g. python -m unittest dpivsoft.tests.test_masking -b.

The GPU tests need an OpenCL device, the GUI smoke tests need a display, and the real-image part of test_cpt_sorting needs the PIV Challenge case E target downloaded by stereo_tutorial.py.

Contributors

  1. Jorge Aguilar-Cabello

Acknowledgements

  1. Patrice Meunier
  2. Thomas Leweke
  3. Raul Infante-Sainz
  4. Luis Parras
  5. Carlos del Pino

How to cite this work

J. Aguilar-Cabello, L. Parras, C. del Pino (2022), "DPIVSoft-OpenCL: A multicore CPU–GPU accelerated open-source code for 2D Particle Image Velocimetry," SoftwareX 20, 101256. https://doi.org/10.1016/j.softx.2022.101256

Metadata

Release files for dpivsoft 0.16.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dpivsoft 0.16.0
File Size Uploaded
dpivsoft-0.16.0.tar.gz 1.6 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for dpivsoft 0.16.0
File Interpreter ABI Platform
dpivsoft-0.16.0-py3-none-any.whl Python 3 none any Details

Total release size: 3.1 MB

Release files / dpivsoft-0.16.0.tar.gz

Download URL dpivsoft-0.16.0.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
a3a95d5b72c9b32b9467fab1cc5f89438be22114cd5fa171e5d4041ff982bea8
BLAKE2b-256 checksum
How to use checksums
58ae8779e6b3a50fc762ca23e50303c660741cfb93fb5ea0d37f45223829e260
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / dpivsoft-0.16.0-py3-none-any.whl

Download URL dpivsoft-0.16.0-py3-none-any.whl
Size 1.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
dab753e9ec3b4533a68ce6f04aabc045c819f34f7cdeaf34831ec3bbad8ddab0
BLAKE2b-256 checksum
How to use checksums
e5b4c6ac15f0fef55ebf571c0d71111a14b84de2fed988267d0dff237f7daf9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.16.0 This release

2 release files

0.14.0

2 release files

0.12.0

2 release files

0.10.1

2 release files

0.9.0

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page