OpenPIV
OpenPIV consists in a Python and Cython modules for scripting and executing the analysis of a set of PIV image pairs. In addition, a Qt and Tk graphical user interfaces are in development, to ease the use for those users who don't have python skills.
Warning
The OpenPIV python version is still in its beta state. This means that it still might have some bugs and the API may change. However, testing and contributing is very welcome, especially if you can contribute with new algorithms and features.
Test it without installation
Click the link - thanks to BinderHub, Jupyter and Conda you can now get it in your browser with zero installation:
Installing
Recommended: Using uv (fastest)
uv is a fast Python package installer and resolver written in Rust:
pip install uv
uv pip install openpiv
Using pip (standard)
Use PyPI: https://pypi.python.org/pypi/OpenPIV:
pip install openpiv
Or Poetry
poetry add openpiv
Note on Conda/Anaconda
⚠️ Conda packages are no longer actively maintained. The conda-forge package may be outdated.
If you previously installed OpenPIV via conda, you can migrate to pip or uv:
# Remove the conda package
conda remove openpiv
# Install with pip or uv
pip install openpiv
# or
uv pip install openpiv
To build from source
Clone using git:
git clone https://github.com/OpenPIV/openpiv-python.git
cd openpiv-python
To build the Rust acceleration extension locally (requires Rust toolchain and maturin):
pip install maturin
maturin develop --release -m crates/openpiv_rust/Cargo.toml
pip install -e .
High-Performance Dual-Backend Acceleration (Rust & SciPy)
OpenPIV features a parallel dual-backend architecture designed for high throughput without sacrificing numerical reproducibility:
- ⚡ Parallel Rust Backend (
openpiv_rust): Multithreaded execution across all CPU cores using Rayon and real-to-complex FFTW/RustFFT routines. Delivers up to 580x faster outlier validation, 19x faster subpixel peak interpolation and SNR calculation, 4-6x faster windowing and FFT cross-correlation, and 3.7x faster end-to-end PIV pipelines. - 🐍 Pure Python / SciPy Backend: Complete, zero-dependency reference implementation that runs everywhere without a compiler.
When you install OpenPIV from PyPI via pip or uv, pre-compiled binary wheels with the Rust acceleration backend are installed automatically.
Explicit Backend Control
All core processing functions accept a backend parameter:
backend Option |
Behavior |
|---|---|
"auto" (default) |
Automatically selects the parallel Rust backend if available; cleanly and transparently falls back to pure Python/SciPy if not. |
"rust" |
Enforces the parallel Rust backend. Raises an informative ImportError if the Rust extension is not compiled. |
"scipy" (or "python") |
Enforces the pure Python/SciPy reference path. |
Both backends produce identical numerical results (diff = 0.0).
Code Examples
1. Quick Analysis with simple_piv
from openpiv import piv
# Default: auto-selects fast Rust backend with fallback
x, y, u, v, s2n = piv.simple_piv("exp1_001_a.bmp", "exp1_001_b.bmp", backend="auto")
# Explicitly force the parallel Rust backend
x, y, u, v, s2n = piv.simple_piv("exp1_001_a.bmp", "exp1_001_b.bmp", backend="rust")
# Explicitly force the SciPy reference backend
x, y, u, v, s2n = piv.simple_piv("exp1_001_a.bmp", "exp1_001_b.bmp", backend="scipy")
2. Standard PIV with extended_search_area_piv
from openpiv import pyprocess, tools
frame_a = tools.imread("exp1_001_a.bmp")
frame_b = tools.imread("exp1_001_b.bmp")
# Run with parallel Rust acceleration
u, v, s2n = pyprocess.extended_search_area_piv(
frame_a,
frame_b,
window_size=32,
overlap=16,
search_area_size=32,
correlation_method="circular",
backend="rust", # 'auto', 'rust', or 'scipy'
)
3. Multi-Pass Window Deformation (windef)
from openpiv import windef, tools
settings = windef.PIVSettings()
settings.windowsizes = (64, 32, 16)
settings.overlap = (32, 16, 8)
settings.num_iterations = 3
# Choose backend in PIVSettings: 'auto', 'rust', or 'scipy'
settings.backend = "auto"
frame_a = tools.imread("exp1_001_a.bmp")
frame_b = tools.imread("exp1_001_b.bmp")
# Executes all deformation passes with the chosen backend
x, y, u, v, mask = windef.simple_multipass(frame_a, frame_b, settings)
Documentation
The OpenPIV documentation is available on the project web page at http://openpiv.readthedocs.org
Demo notebooks
- Tutorial Notebook 1
- Tutorial notebook 2
- Dynamic masking tutorial
- Multipass with Windows Deformation
- Multiple sets in one notebook
- 3D PIV
These and many additional examples are in another repository: OpenPIV-Python-Examples
Contributors
- Alex Liberzon
- Roi Gurka
- Zachary J. Taylor
- David Lasagna
- Mathias Aubert
- Pete Bachant
- Cameron Dallas
- Cecyl Curry
- Theo Käufer
- Andreas Bauer
- David Bohringer
- Erich Zimmer
- Peter Vennemann
- Lento Manickathan
- Yuri Ishizawa
Copyright statement: smoothn.py is a Python version of smoothn.m originally created by D. Garcia [https://de.mathworks.com/matlabcentral/fileexchange/25634-smoothn], written by Prof. Lewis and available on Github [https://github.com/profLewis/geogg122/blob/master/Chapter5_Interpolation/python/smoothn.py]. We include a version of it in the openpiv folder for convenience and preservation. We are thankful to the original authors for releasing their work as an open source. OpenPIV license does not relate to this code. Please communicate with the authors regarding their license.
How to cite this work
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openpiv-0.26.1.tar.gz.
File metadata
- Download URL: openpiv-0.26.1.tar.gz
- Upload date:
- Size: 43.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0966b9d9bd4e0e850df6663170edb2277450ab0aac24f516cc9f60f5e97c3784
|
|
| MD5 |
882e6cd8a65ed2f2905c0a4ecfc1c1fa
|
|
| BLAKE2b-256 |
ac3d4ff4c1917cf18111c70892220082a347b0f0e6c986e7b23d4237ead0089f
|
File details
Details for the file openpiv-0.26.1-py3-none-any.whl.
File metadata
- Download URL: openpiv-0.26.1-py3-none-any.whl
- Upload date:
- Size: 44.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb9352babeef9358a1937d3c872835750f3885db4da5e0acf072c0617d2d5310
|
|
| MD5 |
a380f6c720cbf7ab2e115f23cbda9cee
|
|
| BLAKE2b-256 |
623992de60cbb6a93e11eeeabf2f0dcdccfa5c69fe6489fcaf3148a46befb31c
|