pyptv

Running the GUI

Learn how to use the PyPTV graphical user interface for particle tracking analysis.

Launching PyPTV

Command Line Launch

# Activate environment
conda activate pyptv

# Launch GUI from any directory
python -m pyptv.pyptv_gui


## GUI Requirements and Testing

The PyPTV GUI requires a display (X11 on Linux/macOS, or native on Windows). GUI-dependent tests are located in `tests_gui/` and are not run in CI or Docker. Run these tests locally or with Xvfb if needed.

For headless testing, see the main README and installation guide.

# Or from PyPTV source directory
cd pyptv
python -m pyptv.pyptv_gui

From Python Script

from pyptv.pyptv_gui import MainGUI
from pathlib import Path

# Launch with specific experiment
experiment_path = Path("path/to/your/experiment")
gui = MainGUI(experiment_path, Path.cwd())
gui.configure_traits()

GUI Overview

The PyPTV interface consists of several main areas:

1. Parameter Tree (Left Panel)

2. Camera Views (Center/Right)

3. Control Buttons (Top)

4. Status Bar (Bottom)

Main Workflow

1. Load Experiment

Option A: Load Existing YAML

File → Load Experiment → Select parameters.yaml

Option B: Load Legacy Parameters

File → Load Legacy → Select parameters/ folder
# Automatically converts to YAML format

Option C: Create New Experiment

File → New Experiment → Choose directory
# Creates basic parameter structure

2. Initialize Parameters

After loading an experiment:

  1. Load images/parameters button
    • Reads all configuration files
    • Loads calibration data
    • Prepares camera views
  2. Verify setup:
    • Check parameter tree is populated
    • Ensure camera tabs are visible
    • Confirm calibration images load

3. Single Frame Processing

Process one frame to test setup:

  1. Detection:
    Click "Detection" button
    → Blue crosses mark detected particles
    
  2. Correspondences:
    Click "Correspondences" button  
    → Colored lines connect matching particles
    
  3. Determination:
    Click "Determination" button
    → Calculates 3D positions
    

4. Sequence Processing

Process multiple frames:

  1. Set frame range in sequence parameters
  2. Click “Sequence” button
  3. Monitor progress in status bar
  4. Check output files in experiment directory

Parameter Management

Editing Parameters

Method 1: Right-click in Parameter Tree

Right-click parameter set → "Edit Parameters"
→ Opens parameter editing dialog

Method 2: Direct File Editing

Edit parameters.yaml in text editor
→ Reload experiment in GUI

Method 3: Calibration-specific

Calibration → Open Calibration
→ Specialized calibration interface

Parameter Sets

Create multiple parameter configurations:

  1. Add new set:
    Right-click in parameter tree → "Add Parameter Set"
    → Enter name (e.g., "HighSpeed", "LowLight")
    
  2. Switch between sets:
    Right-click parameter set → "Set as Active"
    
  3. Copy settings:
    Right-click → "Duplicate Parameter Set"
    

Parameter Sections

Key parameter groups:

Section Purpose Key Settings
ptv General PTV settings Image names, camera count, preprocessing
detect_plate Particle detection Gray thresholds, size limits
criteria Correspondence matching Search tolerances, minimum matches
track Particle tracking Velocity limits, trajectory linking
cal_ori Calibration Camera files, calibration images

Camera Views

Overlays

Camera-specific Operations

Processing Controls

Detection Settings

detect_plate:
  gvth_1: 80     # Primary detection threshold
  gvth_2: 40     # Secondary threshold
  min_npix: 5    # Minimum particle size
  max_npix: 100  # Maximum particle size

Correspondence Settings

criteria:
  eps0: 0.2      # Search radius (mm)
  corrmin: 2     # Minimum cameras for correspondence
  cn: 0.02       # Additional tolerance

Tracking Settings

track:
  dvxmin: -50.0  # Velocity limits (mm/frame)
  dvxmax: 50.0
  dvymin: -50.0
  dvymax: 50.0

File Management

Input Files

Output Files

Advanced Features

Plugin Integration

Right-click parameter tree → "Configure Plugins"
→ Select tracking and sequence plugins

Batch Processing

# Script for multiple experiments
for experiment in experiment_list:
    gui.load_experiment(experiment)
    gui.process_sequence()
    gui.export_results()

Custom Visualization

# Add custom overlays
def custom_overlay(camera_view, data):
    camera_view.plot_custom_data(data)

Troubleshooting

Common Issues

“Images not found”

“Calibration errors”

“No particles detected”

“Poor correspondences”

Performance Tips

Debugging Mode

Enable verbose output:

python -m pyptv.pyptv_gui --debug

Check log files:

tail -f pyptv.log

Keyboard Shortcuts

Key Action
Ctrl+O Open experiment
Ctrl+S Save parameters
F5 Refresh/reload
Space Process next frame
Esc Cancel current operation

Best Practices

Workflow Organization

  1. Test single frame before sequence processing
  2. Save parameter changes before major operations
  3. Back up original parameters before modifications
  4. Use descriptive parameter set names

Data Management

Quality Control


Next: Learn about Camera Calibration or Parameter Migration