How It Works - sanitaravel/Space-Launch-Telemetry-Analyzer GitHub Wiki
How Starship Analyzer Works
This page explains the technical details behind Starship Analyzer's functionality.
Processing Pipeline
Starship Analyzer uses a multi-stage pipeline to extract and analyze data from SpaceX Starship launch videos:
- Frame Extraction: Video frames are extracted and queued for processing
- OCR Processing: Specialized regions of interest (ROIs) are analyzed to extract telemetry
- Engine Detection: Computer vision techniques identify active engines
- Fuel Level Detection: Analysis of propellant gauge indicators for LOX and CH4 tank levels
- Data Cleaning: Statistical methods remove outliers and noise
- Analysis: Calculates acceleration, G-forces, and performance metrics
- Visualization: Generates plots showing vehicle performance, engine status, and fuel consumption
Core Components
Engine Detection
The engine detection system:
- Uses predefined pixel coordinates to monitor specific regions where engines are visible
- Applies brightness thresholds to determine if an engine is firing
- Tracks patterns of engine activation through the flight
Telemetry Extraction
The OCR processing system:
- Targets specific regions of the video frame where telemetry data appears
- Applies preprocessing to enhance text visibility
- Uses EasyOCR to extract numerical data such as altitude, speed, and timestamps
- Applies validation rules to filter out incorrect readings
Fuel Level Analysis
The fuel level detection:
- Identifies fuel gauge locations in the video frame
- Measures pixel positions of gauge indicators
- Converts pixel positions to percentage values
- Tracks both LOX and CH4 levels for booster and ship stages
Data Processing
Once raw data is extracted:
- Outliers are identified and removed
- Time-series smoothing is applied
- Data is synchronized to mission time (T-0)
- Derived metrics are calculated (acceleration, G-force)
- Data is structured for analysis and visualization
Visualization Engine
The visualization component:
- Generates time-synchronized plots
- Creates engine activation timelines
- Produces comparative analysis between flights
- Supports interactive exploration of data points
- Exports to multiple formats (PNG, SVG, CSV)
Project Architecture
The application follows a modular architecture:
starship_analyzer/
├── ocr/ # Optical Character Recognition subsystem
│ ├── engine_detection.py # Engine state detection
│ ├── extract_data.py # Main data extraction logic
│ ├── fuel_level_extraction.py # Fuel level detection
│ └── ocr.py # Text recognition from telemetry
├── plot/ # Data processing and visualization tools
│ ├── data_processing.py # Data cleaning and calculation
│ ├── flight_plotting.py # Single flight visualization
│ ├── comparison_plotting.py # Multiple flight comparison
│ └── interactive_viewer.py # Interactive plot viewer
├── processing/ # Video and frame processing engine
│ ├── frame_processing.py # Single frame analysis
│ └── video_processing.py # Batch processing of videos
├── ui/ # User interface components
├── utils/ # Utility functions and helpers
├── setup/ # Installation and setup modules
├── main.py # Application entry point
Technical Details
Performance Optimization
The application employs several performance optimization techniques:
- Parallel processing of video frames using Python's multiprocessing
- GPU acceleration via CUDA when available
- Memory management for large video files
- Batch processing to balance memory usage and throughput
Data Handling
All extracted data is structured in a consistent format:
- CSV files for raw telemetry data
- JSON configuration files for analysis parameters
- Pandas DataFrames for internal data manipulation
- Synchronized timestamps across all data sources
Example Data Flow
A typical data extraction and analysis workflow:
- User selects Starship launch video
- Frames are extracted at configurable intervals
- Each frame is processed to extract:
- Speed and altitude from telemetry overlay
- Engine status for each visible engine
- Fuel level indicators
- Mission timestamps
- Raw data is compiled into structured format
- Analysis calculates derived metrics
- Visualization presents the results as interactive plots