Skip to content

Commit 17bbf5e

Browse files
committed
Flatten pyptv into subfolder
1 parent df6bfb2 commit 17bbf5e

923 files changed

Lines changed: 33315 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/pyptv

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/pyptv/CHANGES.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Changelog
2+
3+
All notable changes to PyPTV are documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.4.3] - 2026-03-13
9+
10+
### Added
11+
- `ptv.clone_calibration` helper for calibration workflows
12+
- Marimo-based UI additions for interactive workflows
13+
- Tests covering writable output folder behavior
14+
15+
### Changed
16+
- Widened `_ensure_target_output_writable` type annotations to accept `Sequence[str | os.PathLike]`
17+
- Updated release helper scripts to report the current PyPTV version consistently
18+
19+
### Fixed
20+
- Results directory test handling
21+
- Skipped test behavior in the automated test suite
22+
- Misleading version messages in Windows installation helpers
23+
24+
## [0.4.2] - 2026-03-01
25+
26+
### Added
27+
- NumPy 2.0+ support with full compatibility for NumPy 2.x series
28+
- `build_wheels.sh` script for building universal wheels
29+
- Local wheel installation support in `wheels/` folder
30+
- Installation scripts now support installing from pre-built wheels
31+
32+
### Changed
33+
- **NumPy**: Updated from `==1.26.4` to `>=2.0.0,<2.7` (supports NumPy 2.x)
34+
- **optv**: Updated from `>=0.3.0` to `>=0.3.2` (includes NumPy 2.0+ support)
35+
- **chaco**: Updated from `>=5.1.0` to `>=6.1.0` (NumPy 2 compatible)
36+
- **enable**: Updated from `>=5.3.0` to `>=6.1.0` (NumPy 2 compatible)
37+
- Installation scripts (`install_pyptv.sh`, `install_pyptv.bat`) now install optv from local wheel first
38+
- Test version checks updated to validate NumPy >=2.0.0
39+
40+
### Fixed
41+
- Version checks in `tests/test_environment.py` now accept version range instead of exact version
42+
- Version checks in `scripts/verify_environment.py` updated for NumPy 2.x compatibility
43+
44+
### Technical Details
45+
- pyptv is now distributed as a universal wheel (`py3-none-any`) compatible with Python 3.10+
46+
- optv 0.3.2 requires NumPy >=2.0.0 (handled by local wheel in `wheels/` folder)
47+
- All GUI dependencies (traitsui 8.0.0, pyface 8.0.0, chaco 6.1.1, enable 6.1.0) verified compatible with NumPy 2.x
48+
49+
### Installation
50+
```bash
51+
# Using uv (recommended)
52+
uv venv --python 3.11
53+
source .venv/bin/activate
54+
uv pip install wheels/optv-0.3.2-*.whl
55+
uv pip install wheels/pyptv-0.4.2-py3-none-any.whl
56+
57+
# Or install in editable mode
58+
uv pip install -e .
59+
```
60+
61+
### Migration Notes
62+
- **Minimum NumPy version**: 2.0.0 (NumPy 1.x no longer supported)
63+
- **optv requirement**: 0.3.2+ with NumPy 2.0+ support
64+
- Existing installations should update optv to 0.3.2 or later
65+
66+
---
67+
68+
## [0.4.1] - Previous Release
69+
70+
See git history for details of previous releases.

src/pyptv/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Slim Dockerfile for local testing of pyptv (mimics GitHub Actions)
2+
FROM python:3.11-slim
3+
4+
# Install system dependencies for Qt, traitsui, and scientific stack
5+
RUN apt-get update && apt-get install -y \
6+
build-essential \
7+
libgl1-mesa-glx \
8+
libglib2.0-0 \
9+
libxkbcommon-x11-0 \
10+
libxcb-xinerama0 \
11+
git \
12+
xvfb \
13+
&& rm -rf /var/lib/apt/lists/*
14+
15+
# Set workdir
16+
WORKDIR /workspace
17+
18+
# Copy repo
19+
COPY . /workspace
20+
21+
# Install pip, wheel, and setuptools
22+
RUN pip install --upgrade pip wheel setuptools
23+
24+
# Install pyptv and dependencies
25+
RUN pip install .
26+
RUN pip install -r requirements-dev.txt || true
27+
28+
# Optionally install test dependencies for Qt
29+
RUN pip install PySide6 traits traitsui pytest
30+
31+
# Run all tests
32+
CMD ["xvfb-run", "pytest", "-v", "-x", "--tb=short"]

src/pyptv/LICENSE.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2011-2022 Alex Liberzon
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

src/pyptv/README.md

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# Project Title
2+
3+
[![Python application](https://github.com/alexlib/pyptv/actions/workflows/python-app.yml/badge.svg)](https://github.com/alexlib/pyptv/actions/workflows/python-app.yml)
4+
[![DOI](https://zenodo.org/badge/121291437.svg)](https://zenodo.org/badge/latestdoi/121291437)
5+
[![PyPI - Version](https://img.shields.io/pypi/v/pyptv)](https://pypi.org/project/pyptv/)
6+
7+
8+
9+
10+
11+
**PyPTV** or otherwise called **OpenPTV-Python** is the Python GUI for [OpenPTV](http://www.openptv.net). It is based on `traits`, `traitsui`, `chaco`, `enable` and `pyface` from Enthought Inc. and provides an UI *interface* the OpenPTV library that includes all the core algorithms (correspondence, tracking, calibration, etc.) written in ANSI C and has Python bindings using Cython.
12+
13+
Both PyPTV and the OpenPTV library are in the development phase and continuously refactored. Please follow the development on the community mailing list:
14+
15+
openptv@googlegroups.com
16+
17+
18+
## Documentation:
19+
20+
👉 **[View PyPTV documentation](https://alexlib.github.io/pyptv)**
21+
👉 **[View OpenPTV documentation](https://openptv-python.readthedocs.io/en/latest/))**
22+
23+
## Installation instructions
24+
25+
### Using uv (recommended for development)
26+
27+
This project uses [uv](https://github.com/astral-sh/uv) for fast dependency management. A local wheel of `optv>=0.3.2` is included in the `wheels/` directory until it's available on PyPI.
28+
29+
```bash
30+
# Install uv if you haven't already
31+
curl -LsSf https://astral.sh/uv/install.sh | sh
32+
33+
# Create virtual environment and install dependencies
34+
uv sync
35+
36+
# Or to create environment from scratch
37+
rm -rf .venv && uv sync
38+
```
39+
40+
The `uv.toml` configuration automatically uses the local wheel from `wheels/`. The `uv.lock` file pins all dependencies for reproducible builds.
41+
42+
### Using pip
43+
44+
Short version:
45+
46+
pip install numpy
47+
python -m pip install pyptv --index-url https://pypi.fury.io/pyptv --extra-index-url https://pypi.org/simple
48+
49+
**Note:** If `optv>=0.3.2` is not yet available on PyPI, install it from the local wheel first:
50+
51+
pip install wheels/optv-0.3.2-*.whl
52+
python -m pip install pyptv --index-url https://pypi.fury.io/pyptv --extra-index-url https://pypi.org/simple
53+
54+
Detailed instructions for various platforms are in our documentation:
55+
https://openptv-python.readthedocs.io/en/latest/installation_instruction.html
56+
57+
58+
59+
60+
61+
Follow the instructions in our **screencasts and tutorials**:
62+
63+
* Tutorial 1: <http://youtu.be/S2fY5WFsFwo>
64+
65+
* Tutorial 2: <http://www.youtube.com/watch?v=_JxFxwVDSt0>
66+
67+
* Tutorial 3: <http://www.youtube.com/watch?v=z1eqFL5JIJc>
68+
69+
70+
Ask for help on our mailing list:
71+
72+
openptv@googlegroups.com
73+
74+
75+
76+
## Working with plugins
77+
78+
Plugins is a system of extensions to PyPTV without the need to change the GUI
79+
80+
1. copy the `sequence_plugins.txt` and `tracking_plugins.txt` to the working folder
81+
2. copy the `plugins/` directory to the working folder
82+
3. modify the code so it performs instead of the default sequence or default tracker
83+
4. Open the GUI and Plugins -> Choose , then run the rest: Init -> Sequence
84+
85+
86+
Note, the specific branch `plugin_remback` requires installation of the `pip install rembg[cpu]` or `pip install rembg[gpu]`
87+
88+
89+
### Developers:
90+
91+
**Version Management:**
92+
- Bump version: ```python bump_version.py --patch```
93+
94+
**Publishing to PyPI:**
95+
- See [DEPLOYMENT.md](DEPLOYMENT.md) for comprehensive deployment instructions using GitHub Actions and trusted publishing
96+
97+
**Legacy Manual Publishing:**
98+
```bash
99+
pip install build
100+
python -m build
101+
pip install dist/pyptv-*.whl # Install the built wheel
102+
pip install twine
103+
python -m twine upload dist/*
104+
```
105+
106+
## Compatibility Notes
107+
108+
### NumPy Compatibility
109+
- Supported NumPy versions: >=2.0.0,<2.7
110+
- NumPy 2.x required for optv 0.3.2+
111+
- Tested with NumPy arrays in both float64 and uint8 formats
112+
- Array operations maintained for image processing and coordinate transformations
113+
- NumPy 2.x support requires chaco>=6.1.0 and enable>=6.1.0
114+
115+
### OpenPTV (optv) Compatibility
116+
- Compatible with optv 0.3.2+
117+
- optv 0.3.2+ requires NumPy >=2.0.0
118+
- Core functionality tested with latest optv release
119+
- Calibration and tracking functions verified
120+
121+
## Development Setup
122+
For development work with latest NumPy:
123+
124+
```bash
125+
conda create -n pyptv python=3.11
126+
conda activate pyptv
127+
conda install numpy>=1.23.5 optv>=0.3.0
128+
pip install -e .
129+
```
130+
131+
## Marimo UIs (uv)
132+
133+
This repo includes Marimo-based interactive UIs.
134+
135+
Run the Detection UI:
136+
137+
```bash
138+
uv pip install marimo
139+
uv run marimo run pyptv/marimo_ui_detection.py
140+
```
141+
142+
Or use the helper script:
143+
144+
```bash
145+
./run_marimo_detection.sh
146+
```
147+
148+
Run the Parameters UI:
149+
150+
```bash
151+
uv pip install marimo
152+
uv run marimo run pyptv/marimo_ui_parameters.py
153+
```
154+
155+
Or use the helper script:
156+
157+
```bash
158+
./run_marimo_parameters.sh
159+
```
160+
161+
162+
This is a detailed description of the project...

src/pyptv/actions.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Dumbbell orientation notes
2+
3+
## Error context
4+
- SciPy minimize reports: "Desired error not necessarily achieved due to precision loss."
5+
- The optimizer returns almost the same parameters as the initial guess.
6+
7+
## Call path
8+
- GUI button: calibration_gui.py -> _button_orient_dumbbell_fired -> ptv.py_calibration(12, self)
9+
- Dispatch: ptv.py -> py_calibration -> calib_dumbbell
10+
- Objective + optimizer: ptv.py -> dumbbell_target_func, calib_convergence, minimize
11+
12+
## Likely cause
13+
- Poor scaling and weak constraints (all cameras free).
14+
- Objective mixes positions (~1e3) and angles (~1e0), plus abs() term for length.
15+
16+
## Improvement ideas
17+
1) Fix at least one camera (anchor the gauge) or allow fixed cameras in the GUI flow.
18+
2) Scale parameters (e.g., optimize positions in meters or divide by 1000).
19+
3) Use a more robust optimizer (Powell or L-BFGS-B with bounds) or least_squares on residuals.
20+
4) Replace abs() in dumbbell length error with squared or Huber loss.
21+
5) Ensure enough valid frames with exactly 2 targets per camera; use cleaner subset.
22+
6) Tune dumbbell_penalty_weight to avoid dominating/flattening the objective.

0 commit comments

Comments
 (0)