This project implements large-scale waveform generation, feature extraction, and clustering with GPU acceleration using CUDA via the RAPIDS suite (cuDF, cuML, cuPy). The system automatically falls back to CPU processing when GPU resources are unavailable.
- GPU Acceleration: Utilizes NVIDIA RAPIDS libraries for accelerated data processing
- Automatic Fallback: Gracefully reverts to CPU processing when GPU is unavailable
- Waveform Generation: Creates synthetic waveforms with complex parameter combinations
- Feature Extraction: Computes time and frequency domain features from waveforms
- Dimensionality Reduction: Implements PCA for feature compression
- Clustering: Groups similar waveforms using K-means
- Visualization: Generates comprehensive plots to analyze clusters and feature importance
- Python 3.6+
- NumPy, Pandas, Matplotlib, Seaborn, SciPy, scikit-learn
- TQDM (for progress bars)
- Optional GPU dependencies:
- NVIDIA GPU with CUDA support
- RAPIDS suite (cuDF, cuML, cuPy)
# Install Python 3.12 if not already available
sudo dnf install python3.12 python3.12-devel
# Create virtual environment with Python 3.12
python3.12 -m venv ~/venvs/rapids_env
source ~/venvs/rapids_env/bin/activate
# Install dependencies
pip install --upgrade pip
pip install numpy pandas matplotlib seaborn scikit-learn scipy tqdm
# Install CuPy for CUDA 12.x (since you have CUDA 13.0, use cu12x)
pip install cupy-cuda12x
# Install RAPIDS for CUDA 12
pip install --extra-index-url=https://pypi.nvidia.com cudf-cu12 cuml-cu12Simply run the main script:
python pipeline.pyThe script will:
- Check for GPU availability and inform the user
- Generate a diverse dataset of synthetic waveforms
- Extract features from each waveform
- Perform dimensionality reduction and clustering
- Generate visualizations and analysis
- Save results to the
cuda_waveform_analysisdirectory
cuda_waveform_analysis/
├── all_waveform_features.csv # Raw feature data
├── X_pca.npy # PCA-transformed features
├── kmeans_labels.npy # Cluster assignments
├── cluster_centers.npy # Cluster centroids
├── cluster_parameters.csv # Mapping of clusters to parameters
└── plots/
├── kmeans_clusters_tsne.png # t-SNE visualization of clusters
├── cluster_*_distribution.png # Parameter distributions by cluster
├── feature_importance.png # Top features for cluster separation
├── cluster_representative_waveforms_*.png # Example waveforms from each cluster
├── largest_clusters_waveforms.png # Waveforms from most common clusters
├── parameter_relationship.png # Relationship between parameters
└── parameter_cluster_correlation.png # Correlation heatmap
The system generates complex waveforms by combining sine, square, triangle, and sawtooth waves with various frequency parameters. Latin Hypercube Sampling ensures efficient parameter space coverage.
For each waveform, the system extracts:
- Basic statistics (mean, standard deviation, range)
- Signal characteristics (zero crossings, peak count)
- Statistical moments (skewness, kurtosis)
- Complexity measures (total variation)
- Frequency domain features (spectral bands, dominant frequency)
The high-dimensional feature space is reduced using PCA (Principal Component Analysis), then clustered using K-means to identify similar waveform patterns. t-SNE (t-Distributed Stochastic Neighbor Embedding) is used for visualization purposes.

Taking the dimensions given from the discovery model, we can replicate these waveforms in a tanglible way.

- Memory usage scales with the number of waveforms and features
- Batch processing helps manage memory constraints
- GPU acceleration provides significant speedup for large datasets
- The code automatically adjusts batch sizes based on available resources
- Add new waveform generation functions
- Implement additional feature extraction methods
- Experiment with different clustering algorithms
- Export identified clusters for use in audio synthesis or signal processing applications
