How germanfid/fieldaveraging works
Main Components
• User Interfaces
• CLI Interface (main.py + averager.py)
• GUI Interface (mainUI.py + ui.py + useful_graphics.py)
• Core Processing Library
• CPU Averaging (averager.py)
• GPU/CUDA Averaging (averager_cuda.py)
• Data Model & I/O
• structures.py (data classes, file parsing)
• Visualization Helpers
• useful_graphics.py (plots, charts used by GUI)
• Entry Points & Scripts
• main.py (shell mode)
• mainUI.py (GUI)
• External Dependencies
• Python packages (numpy, pandas, matplotlib, pycuda, etc.)
Relationships & Data Flow
• User → CLI (shell commands) or User → GUI (window events)
• CLI/GUI → Data Model (structures.py reads CSV or other sources)
• Data Model → Core Processing (calls averager or averager_cuda)
• Core Processing → returns averaged result arrays
• GUI → Visualization Helpers → renders charts/tables
• Optionally, write output back to disk via structures.py
Architectural Patterns
• Layered Architecture: UI layer, Processing layer, Data layer
• Strategy Pattern: two processing strategies (CPU vs CUDA) behind a common interface
• Modular Design: each Python module encapsulates a distinct responsibility
Detailed Component Breakdown
a. UI Layer:
• Component: CLI Frontend
• File: main.py
• Invokes: averager.py functions
• Component: GUI Frontend
• Files: mainUI.py + ui.py
• Uses: useful_graphics.py for charts
b. Core Processing:
• Module: CPU Averager
• File: averager.py
• Exposes: average_2d(), average_3d()
• Module: GPU Averager
• File: averager_cuda.py
• Exposes: cuda_average()
c. Data Model & I/O:
• Module: structures.py
• Classes: StreamData, FieldData
• Responsibilities: parse CSV, hold numerical arrays
d. Visualization:
• Module: useful_graphics.py
• Functions: plot_contour(), plot_surface()
• Module: ui.py
• Helper widgets for GUI layout