How ppalacios92/earthquakesignal works
Project Type and Purpose
• EarthquakeSignal is a Python library and CLI-style toolkit for processing, analyzing, and visualizing earthquake ground‐motion signals.
• It provides a modular API to load raw signal files (AT2, IG, RUP/BL formats), wrap them in a model object, compute engineering metrics (Arias Intensity, Fourier spectra, Newmark spectrum, ROTD), and produce summary tables or plots.
• Data Source (External filesystem or user-provided folders of .AT2/.txt files)
• Config Module
– settings.py holds global defaults (sampling rate, output paths, plot styles)
• Core Processing
– signal_loader.py reads raw files → EarthquakeSignal model
– core analyzers (arias_intensity, fourier_analyzer, newmark_spectrum_analyzer, rotd_analyzer, base_line, signal_components) compute metrics
• Model
– earthquake_signal.py defines EarthquakeSignal class (attributes: time series, metadata, computed results)
• Tools
– plotters (earthquake_plotter, fourier_plotter, newmark_plotter, arias_plotter, rotd_plotter) generate visualizations
– earthquake_summary and earthquake_comparison_plotter for aggregations and PDF/PNG exports
• Batch Processor
– earthquake_batch_processor.py orchestrates bulk workflows: read many inputs, apply core analyzers, route results to tools
• Examples
– Jupyter notebooks demonstrate end-to-end usage; include embedded data sets
1. Data Source → signal_loader
2. signal_loader → Model (EarthquakeSignal instances)
3. EarthquakeSignal → Core Analyzers → results stored back on the model
4. Model + Config → Tools (plotters / summary) → Output files (charts, tables)
5. Batch Processor calls steps 1–4 in sequence for multiple signals
Architectural Patterns & Design Principles
• Modular package structure: each concern in its own subpackage (core, models, tools, batch, config)
• Single Responsibility: loaders, analyzers, and plotters do one job each
• Inversion of Control via Config: centralized settings allow extending default behavior without code changes
• Extensibility: new analyzer or plotter plug-ins can be added by dropping a module into core or tools
Step-by-Step Construction
c. Inside core block, arrange loader at top feeding into analyzer cluster
f. At the bottom, overlay “Batch Processor” which invokes loader→analyzers→tools in a loop
h. Optionally, include “Examples / Notebooks” below as a consumer of the library
By breaking the system into these components, showing their interactions and layering them (I/O layer, processing layer, model layer, presentation layer, orchestration layer), you capture all essential architecture elements without over-engineering.