Remote OpenFAST Plotter Architecture
This document describes the architecture of the Remote OpenFAST Plotter application, explaining how the code is organized and how the different modules interact with each other.
Overview
The application is built using a modular structure to improve maintainability, testability, and extensibility. The code is divided into several Python modules, each with a specific responsibility:
Application architecture diagram
Module Structure
app.py
This is the main entry point for the application. It:
Initializes the Dash application with proper configuration
Imports and registers the components and callbacks
Provides the server startup functionality with automatic port retry
data_manager.py
Responsible for handling all data loading and management operations:
Defines the global
DATAFRAMESdictionary that stores loaded dataProvides functions for loading OpenFAST files in parallel
Implements file information retrieval
utils.py
Contains general utility functions used throughout the application:
Plot generation and customization functions
File path handling and unique identifiers generation
UI helper functions for creating badges and other components
components.py
Defines all the UI components and layout structure:
Creates the main application layout
Defines individual UI cards for file input, signal selection, plot controls, etc.
Provides functions to generate the tabbed interface
callbacks.py
Contains all the callback functions that enable interactivity:
File loading and management callbacks
Signal selection and time range callbacks
Plotting and FFT analysis callbacks
Export and download callbacks
Annotation management callbacks
tools/fft_analysis.py
A specialized module for FFT computation and analysis:
Provides the
FFTResultclass for storing resultsImplements various FFT calculation methods (direct FFT, Welch’s method, binning)
Handles signal preprocessing (windowing, detrending)
Data Flow
File Loading:
User inputs file paths in the UI
The file loading callback reads the files using
data_manager.pyLoaded dataframes are stored in the global
DATAFRAMESdictionaryFile information and status are displayed in the UI
Signal Selection:
Available signals are extracted from loaded dataframes
User selects signals for X and Y axes
Plotting:
User configures plot options and time range
The plotting callback retrieves data from
DATAFRAMESutils.pygenerates the plot using PlotlyThe plot is displayed in the UI
FFT Analysis:
User configures FFT parameters
The FFT callback retrieves data and calls the FFT module
Results are plotted and displayed
Export:
User requests HTML export
The export callback generates a downloadable HTML file with the current plot
Adding New Features
To add new features to the application:
New UI Components: Add them to
components.pyNew Functionality: Implement core logic in
utils.pyor create a new moduleNew Interactivity: Add callbacks to
callbacks.pyand register them inregister_callbacks()Update Documentation: Document new features in the README and other documentation files
Testing
The application includes tests for each module:
test_utils.py: Tests utility functionstest_fft_analysis.py: Tests FFT calculation functionstest_app.py: Tests basic application functionalitytest_app_with_files.py: Tests using actual OpenFAST files
Deployment
The application can be deployed in various environments:
Local development: Run
python app.pyContainerized: Use the provided Docker configuration
Production: Configure for WSGI deployment with Gunicorn or similar