OpenDPD Examples¶
This directory contains example scripts demonstrating how to use the OpenDPD Python API.
Files¶
api_usage_example.py- Comprehensive examples of all API functionssingle_csv_format_example.csv- Example CSV file in the correct format for single CSV datasets
Running the Examples¶
Prerequisites¶
Install OpenDPD first:
Run the Example Script¶
This script demonstrates:
- Training a PA model
- Training a DPD model
- Running the trained DPD model
- Using the OpenDPDTrainer class
- Loading and inspecting datasets
- Creating custom datasets from CSV files
- Training with custom dataset paths
Creating Your Own Dataset¶
Single CSV Format¶
Create a CSV file with 4 columns: I_in, Q_in, I_out, Q_out
Example:
I_in,Q_in,I_out,Q_out
0.0123,-0.0456,0.0145,-0.0523
-0.0234,0.0567,-0.0267,0.0623
0.0345,-0.0678,0.0389,-0.0745
...
Then use it:
Split CSV Format¶
Create a directory with separate CSV files:
MyDataset/
├── spec.json
├── train_input.csv (columns: I, Q)
├── train_output.csv (columns: I, Q)
├── val_input.csv
├── val_output.csv
├── test_input.csv
└── test_output.csv
Then use it:
Quick Examples¶
Minimal PA Training¶
Minimal DPD Training¶
import opendpd
opendpd.train_pa(dataset_name='DPA_200MHz', n_epochs=50)
opendpd.train_dpd(dataset_name='DPA_200MHz', n_epochs=50)
Custom Dataset¶
Interactive tutorial¶
OpenDPD_Tutorial.ipynb is the notebook behind the "Open in Colab" badge of the README: it installs OpenDPD
from the main branch, inspects the measured DPA_200MHz data, trains a PA model and a DPD with the per-epoch
plots and GIFs of V2.1, compares without DPD and with DPD, exports the predistorted signal, fine-tunes a
W16A16 quantized DPD, tries TRes-DeltaGRU with temporal sparsity, and builds a dataset from a CSV. Open it in
Colab straight from GitHub:
colab.research.google.com/github/lab-emi/OpenDPD/blob/main/examples/OpenDPD_Tutorial.ipynb.
More Information¶
- Documentation site: https://lab-emi.github.io/OpenDPD/ (installation, end-to-end training, datasets, benchmark, API reference)
- Main README: See
../README.md