Spaces:
Running
Running
Commit ·
5ffa131
1
Parent(s): f1ca3d3
chore: finalized working pip environment
Browse files- .env.example +0 -0
- .gitignore +8 -0
- app.py +0 -0
- config/settings.py +0 -0
- docs/api_reference.md +0 -0
- docs/architecture.md +217 -0
- docs/research_notes.md +0 -0
- modules/__init__.py +0 -0
- modules/bioacoustic/__init__.py +0 -0
- modules/bioacoustic/audiogram_data.py +0 -0
- modules/bioacoustic/bis_calculator.py +0 -0
- modules/imo_compliance/__init__.py +0 -0
- modules/imo_compliance/compliance_checker.py +0 -0
- modules/input_engine/__init__.py +0 -0
- modules/input_engine/design_input.py +0 -0
- modules/mitigation/__init__.py +0 -0
- modules/mitigation/recommender.py +0 -0
- modules/urn_database/__init__.py +0 -0
- modules/urn_database/db_manager.py +0 -0
- modules/urn_prediction/__init__.py +0 -0
- modules/urn_prediction/ai_layer.py +0 -0
- modules/urn_prediction/physics_layer.py +0 -0
- requirements.txt +142 -0
- tests/__init__.py +0 -0
- tests/test_modules.py +0 -0
.env.example
ADDED
|
File without changes
|
.gitignore
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
venv/
|
| 2 |
+
__pycache__/
|
| 3 |
+
*.pyc
|
| 4 |
+
.env
|
| 5 |
+
*.ipynb_checkpoints
|
| 6 |
+
models/trained/*.pt
|
| 7 |
+
data/raw/*
|
| 8 |
+
data/processed/*
|
app.py
ADDED
|
File without changes
|
config/settings.py
ADDED
|
File without changes
|
docs/api_reference.md
ADDED
|
File without changes
|
docs/architecture.md
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SONARIS Project Architecture
|
| 2 |
+
|
| 3 |
+
**Full Name:** Ship-Ocean Noise Acoustic Radiated Intelligence System
|
| 4 |
+
**License:** MIT
|
| 5 |
+
**Python:** 3.10+
|
| 6 |
+
|
| 7 |
+
This document describes the complete folder structure of the SONARIS repository and the intended contents of every file.
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
## Folder Tree
|
| 12 |
+
|
| 13 |
+
```
|
| 14 |
+
sonaris/
|
| 15 |
+
|
|
| 16 |
+
|-- app.py # Streamlit entry point; assembles all module UIs into one application
|
| 17 |
+
|-- requirements.txt # All Python dependencies, pinned with minimum version constraints
|
| 18 |
+
|-- .env.example # Template for environment variables (database path, API keys, debug flags)
|
| 19 |
+
|-- .gitignore # Ignores venv, __pycache__, .env, model weights, large data files
|
| 20 |
+
|-- LICENSE # MIT License text
|
| 21 |
+
|-- README.md # Project overview, architecture summary, setup instructions
|
| 22 |
+
|-- CONTRIBUTING.md # Contribution guidelines: code standards, PR process, scientific validation
|
| 23 |
+
|-- CHANGELOG.md # Version history and release notes
|
| 24 |
+
|
|
| 25 |
+
|-- docs/
|
| 26 |
+
| |-- architecture.md # This file: folder structure and per-file descriptions
|
| 27 |
+
| |-- methodology.md # Scientific methodology: FW-H equation, MFCC application, BIS scoring
|
| 28 |
+
| |-- imo_guidelines.md # Summary of IMO MEPC.1/Circ.906 Rev.1 (2024) limits used in Module 3
|
| 29 |
+
| |-- datasets.md # Dataset descriptions, download instructions, and citation information
|
| 30 |
+
| |-- api_reference.md # Python API reference for headless use of each module
|
| 31 |
+
| |-- deployment.md # Instructions for deploying to Hugging Face Spaces and Streamlit Cloud
|
| 32 |
+
|
|
| 33 |
+
|-- sonaris/ # Main Python package
|
| 34 |
+
| |-- __init__.py # Package init; exposes URNPredictor, ComplianceChecker, BioacousticImpact
|
| 35 |
+
| |
|
| 36 |
+
| |-- module1_input/ # Module 1: Design Input Engine
|
| 37 |
+
| | |-- __init__.py
|
| 38 |
+
| | |-- input_schema.py # Pydantic models defining and validating all vessel input parameters
|
| 39 |
+
| | |-- input_ui.py # Streamlit UI component for Module 1: form fields, units, help tooltips
|
| 40 |
+
| | |-- parameter_utils.py # Derived parameter calculations (e.g. advance ratio J from RPM and speed)
|
| 41 |
+
| | |-- validators.py # Range checks and cross-parameter validation (e.g. propeller diameter vs draft)
|
| 42 |
+
| |
|
| 43 |
+
| |-- module2_urn/ # Module 2: URN Prediction Core
|
| 44 |
+
| | |-- __init__.py
|
| 45 |
+
| | |-- predictor.py # Main URNPredictor class: orchestrates physics and AI layers, returns spectrum
|
| 46 |
+
| | |-- physics_layer.py # OpenFOAM run management and libAcoustics FW-H post-processing wrapper
|
| 47 |
+
| | |-- ai_layer.py # Loads trained model, runs inference, returns residual correction to physics output
|
| 48 |
+
| | |-- feature_engineering.py # MFCC extraction, spectral envelope fitting, 1/3-octave band aggregation
|
| 49 |
+
| | |-- model_architecture.py # PyTorch definition of the 1D-CNN + LSTM URN prediction network
|
| 50 |
+
| | |-- train.py # Training script: data loading, loss function, optimizer, checkpoint saving
|
| 51 |
+
| | |-- evaluate.py # Evaluation script: computes per-band MAE, RMSE against held-out test set
|
| 52 |
+
| | |-- uncertainty.py # Monte Carlo dropout for prediction confidence interval estimation
|
| 53 |
+
| | |-- spectrum_utils.py # Conversion utilities: Pa to dB, 1/1-octave to 1/3-octave, frequency array generation
|
| 54 |
+
| |
|
| 55 |
+
| |-- module3_compliance/ # Module 3: IMO Compliance Checker
|
| 56 |
+
| | |-- __init__.py
|
| 57 |
+
| | |-- checker.py # ComplianceChecker class: loads limits, compares spectrum, returns verdict per band
|
| 58 |
+
| | |-- imo_limits.py # Hard-coded URN limits from MEPC.1/Circ.906 Rev.1 by vessel type and frequency band
|
| 59 |
+
| | |-- report_generator.py # Builds the downloadable PDF compliance report using ReportLab
|
| 60 |
+
| | |-- compliance_ui.py # Streamlit UI component: compliance bar chart, pass/fail table, download button
|
| 61 |
+
| |
|
| 62 |
+
| |-- module4_bioacoustics/ # Module 4: Marine Bioacoustic Impact Module
|
| 63 |
+
| | |-- __init__.py
|
| 64 |
+
| | |-- impact_scorer.py # BioacousticImpact class: computes BIS per species group from input spectrum
|
| 65 |
+
| | |-- audiograms.py # Digitized hearing sensitivity curves for all 5 functional hearing groups
|
| 66 |
+
| | |-- masking_model.py # Psychoacoustic masking model: excitation patterns, masking threshold calculation
|
| 67 |
+
| | |-- harmonic_overlap.py # Finds ship tonal peaks within +/- 1/3 octave of published species call frequencies
|
| 68 |
+
| | |-- species_calls.py # Published frequency ranges for vocalizations of each target species group
|
| 69 |
+
| | |-- bis_scoring.py # BIS formula: integrates masked proportion of species frequency range (0-100 scale)
|
| 70 |
+
| | |-- bioacoustics_ui.py # Streamlit UI: spectrogram overlay, BIS gauges, species selection panel
|
| 71 |
+
| |
|
| 72 |
+
| |-- module5_mitigation/ # Module 5: Mitigation Recommendation Engine
|
| 73 |
+
| | |-- __init__.py
|
| 74 |
+
| | |-- recommender.py # MitigationRecommender class: takes compliance gaps and BIS, returns ranked actions
|
| 75 |
+
| | |-- speed_optimizer.py # Predicts URN reduction as a function of speed reduction for given vessel type
|
| 76 |
+
| | |-- propeller_advisor.py # Maps compliance gap magnitude to specific propeller geometry modification targets
|
| 77 |
+
| | |-- hull_treatment.py # Recommends hull panel damping treatments based on dominant tonal frequencies
|
| 78 |
+
| | |-- routing_advisor.py # Generates routing avoidance polygons around marine protected areas and known habitats
|
| 79 |
+
| | |-- mitigation_ui.py # Streamlit UI: ranked recommendation cards with estimated dB reduction per action
|
| 80 |
+
| |
|
| 81 |
+
| |-- module6_database/ # Module 6: Open URN Database
|
| 82 |
+
| | |-- __init__.py
|
| 83 |
+
| | |-- models.py # SQLAlchemy ORM models: Ship, URNRecord, Submission, UserContribution
|
| 84 |
+
| | |-- database.py # Database engine setup, session factory, connection handling
|
| 85 |
+
| | |-- crud.py # Create, read, update, delete operations for all database tables
|
| 86 |
+
| | |-- submission_pipeline.py # Validates, normalizes, and ingests community-submitted URN records
|
| 87 |
+
| | |-- quality_control.py # Checks submissions against ShipsEar/QiandaoEar22 baseline distributions
|
| 88 |
+
| | |-- search.py # Query functions: filter by vessel type, speed, frequency band, submission date
|
| 89 |
+
| | |-- database_ui.py # Streamlit UI: search interface, submission form, record detail view
|
| 90 |
+
| | |-- migrations/ # Alembic migration scripts directory
|
| 91 |
+
| | |-- env.py # Alembic environment configuration
|
| 92 |
+
| | |-- versions/ # Auto-generated migration version files go here
|
| 93 |
+
| |
|
| 94 |
+
| |-- shared/ # Shared utilities used by more than one module
|
| 95 |
+
| |-- __init__.py
|
| 96 |
+
| |-- constants.py # Physical constants, frequency band definitions, species group identifiers
|
| 97 |
+
| |-- logging_config.py # Loguru logger configuration applied consistently across all modules
|
| 98 |
+
| |-- config.py # Loads and exposes .env and config.yaml settings to all modules
|
| 99 |
+
| |-- file_utils.py # Helpers for reading/writing WAV, CSV, JSON, and HDF5 files
|
| 100 |
+
| |-- plot_utils.py # Shared Matplotlib/Plotly helper functions for consistent chart styling
|
| 101 |
+
|
|
| 102 |
+
|-- models/ # Trained model weights and metadata (git-ignored for large files)
|
| 103 |
+
| |-- urn_predictor_v1.pt # Saved PyTorch model checkpoint after initial training run
|
| 104 |
+
| |-- urn_predictor_v1_meta.json # Training metadata: dataset split, hyperparameters, validation metrics
|
| 105 |
+
|
|
| 106 |
+
|-- data/ # Local data storage (git-ignored except for structure and seed files)
|
| 107 |
+
| |-- raw/ # Raw downloaded datasets, unmodified
|
| 108 |
+
| | |-- shipsear/ # ShipsEar dataset audio files and metadata
|
| 109 |
+
| | |-- qiandaoear22/ # QiandaoEar22 dataset audio files and metadata
|
| 110 |
+
| | |-- audiograms/ # Published audiogram CSVs per species group
|
| 111 |
+
| |
|
| 112 |
+
| |-- processed/ # Preprocessed features ready for model training
|
| 113 |
+
| | |-- mfcc_features.h5 # Extracted MFCC feature matrix for all training samples
|
| 114 |
+
| | |-- octave_spectra.h5 # 1/3-octave spectra computed from all training audio files
|
| 115 |
+
| | |-- labels.csv # Vessel type labels and metadata for each training sample
|
| 116 |
+
| |
|
| 117 |
+
| |-- seed/ # Small seed data committed to the repository
|
| 118 |
+
| |-- imo_limits.json # IMO MEPC.1/Circ.906 Rev.1 limit tables in machine-readable form
|
| 119 |
+
| |-- species_audiograms.json # Digitized audiogram data for all 5 functional hearing groups
|
| 120 |
+
| |-- species_calls.json # Published vocalization frequency ranges per species group
|
| 121 |
+
|
|
| 122 |
+
|-- notebooks/ # Research and development notebooks
|
| 123 |
+
| |-- 01_dataset_exploration.ipynb # Initial exploration of ShipsEar and QiandaoEar22 distributions
|
| 124 |
+
| |-- 02_feature_engineering.ipynb # MFCC pipeline development and 1/3-octave band analysis
|
| 125 |
+
| |-- 03_model_training.ipynb # URN prediction model training experiments and loss curves
|
| 126 |
+
| |-- 04_compliance_validation.ipynb # Verification of compliance checker against known test cases
|
| 127 |
+
| |-- 05_bioacoustic_analysis.ipynb # BIS scoring development and masking model calibration
|
| 128 |
+
| |-- 06_mitigation_experiments.ipynb # Speed-noise relationship analysis for mitigation module
|
| 129 |
+
| |-- 07_database_schema_design.ipynb # URN database schema development and query prototyping
|
| 130 |
+
|
|
| 131 |
+
|-- scripts/ # Standalone scripts for data preparation and model management
|
| 132 |
+
| |-- download_shipsear.py # Downloads ShipsEar dataset from source and places it in data/raw/shipsear/
|
| 133 |
+
| |-- download_qiandaoear.py # Downloads QiandaoEar22 dataset and places it in data/raw/qiandaoear22/
|
| 134 |
+
| |-- preprocess_audio.py # Runs full audio-to-features pipeline and writes to data/processed/
|
| 135 |
+
| |-- train_model.py # CLI wrapper around module2_urn/train.py for scheduled training runs
|
| 136 |
+
| |-- export_model.py # Exports trained model to ONNX format for deployment environments
|
| 137 |
+
| |-- init_database.py # Creates database schema and loads seed data on first setup
|
| 138 |
+
| |-- seed_database.py # Populates URN database with curated example records for demonstration
|
| 139 |
+
|
|
| 140 |
+
|-- tests/ # Test suite
|
| 141 |
+
| |-- __init__.py
|
| 142 |
+
| |-- conftest.py # Shared pytest fixtures: sample vessel parameters, synthetic spectra, db session
|
| 143 |
+
| |
|
| 144 |
+
| |-- test_module1/
|
| 145 |
+
| | |-- test_input_schema.py # Tests that valid and invalid vessel parameter inputs are handled correctly
|
| 146 |
+
| | |-- test_validators.py # Tests for all cross-parameter validation rules
|
| 147 |
+
| |
|
| 148 |
+
| |-- test_module2/
|
| 149 |
+
| | |-- test_feature_engineering.py # Tests MFCC output shape, 1/3-octave band count, and numerical stability
|
| 150 |
+
| | |-- test_model_architecture.py # Tests model forward pass shape and output range
|
| 151 |
+
| | |-- test_spectrum_utils.py # Tests dB conversion, band aggregation, and frequency array generation
|
| 152 |
+
| |
|
| 153 |
+
| |-- test_module3/
|
| 154 |
+
| | |-- test_checker.py # Tests compliance verdicts against known pass and fail spectra
|
| 155 |
+
| | |-- test_report_generator.py # Tests PDF generation and checks that required sections are present
|
| 156 |
+
| |
|
| 157 |
+
| |-- test_module4/
|
| 158 |
+
| | |-- test_masking_model.py # Tests masking threshold outputs against published psychoacoustic reference values
|
| 159 |
+
| | |-- test_bis_scoring.py # Tests BIS edge cases: zero noise, full masking, single frequency input
|
| 160 |
+
| |
|
| 161 |
+
| |-- test_module5/
|
| 162 |
+
| | |-- test_recommender.py # Tests that recommendations are ranked and non-empty for all compliance scenarios
|
| 163 |
+
| | |-- test_speed_optimizer.py # Tests speed-to-noise reduction curve against known ship data
|
| 164 |
+
| |
|
| 165 |
+
| |-- test_module6/
|
| 166 |
+
| |-- test_crud.py # Tests all database read and write operations against an in-memory SQLite instance
|
| 167 |
+
| |-- test_quality_control.py # Tests rejection of out-of-distribution and malformed URN submissions
|
| 168 |
+
|
|
| 169 |
+
|-- config/
|
| 170 |
+
|-- config.yaml # Default configuration: model paths, database URL, logging level, band definitions
|
| 171 |
+
|-- logging.yaml # Loguru handler configuration for file and console output
|
| 172 |
+
```
|
| 173 |
+
|
| 174 |
+
---
|
| 175 |
+
|
| 176 |
+
## File Count Summary
|
| 177 |
+
|
| 178 |
+
| Directory | Files |
|
| 179 |
+
|---|---|
|
| 180 |
+
| Root | 8 |
|
| 181 |
+
| docs/ | 6 |
|
| 182 |
+
| sonaris/ (package) | 52 |
|
| 183 |
+
| models/ | 2 |
|
| 184 |
+
| data/ | 9 |
|
| 185 |
+
| notebooks/ | 7 |
|
| 186 |
+
| scripts/ | 8 |
|
| 187 |
+
| tests/ | 17 |
|
| 188 |
+
| config/ | 2 |
|
| 189 |
+
| **Total** | **111** |
|
| 190 |
+
|
| 191 |
+
---
|
| 192 |
+
|
| 193 |
+
## Module to Directory Mapping
|
| 194 |
+
|
| 195 |
+
| Module | Directory |
|
| 196 |
+
|---|---|
|
| 197 |
+
| Module 1: Design Input Engine | `sonaris/module1_input/` |
|
| 198 |
+
| Module 2: URN Prediction Core | `sonaris/module2_urn/` |
|
| 199 |
+
| Module 3: IMO Compliance Checker | `sonaris/module3_compliance/` |
|
| 200 |
+
| Module 4: Marine Bioacoustic Impact | `sonaris/module4_bioacoustics/` |
|
| 201 |
+
| Module 5: Mitigation Recommendation Engine | `sonaris/module5_mitigation/` |
|
| 202 |
+
| Module 6: Open URN Database | `sonaris/module6_database/` |
|
| 203 |
+
| Shared Utilities | `sonaris/shared/` |
|
| 204 |
+
|
| 205 |
+
---
|
| 206 |
+
|
| 207 |
+
## Key Design Decisions
|
| 208 |
+
|
| 209 |
+
**Single package, modular internals.** All six modules live inside the `sonaris/` package. This means the Python API (`from sonaris import URNPredictor`) works without any knowledge of the internal module structure, while the internals remain cleanly separated.
|
| 210 |
+
|
| 211 |
+
**Seed data is version-controlled; raw audio is not.** The `data/seed/` directory (IMO limits, audiograms, species call ranges) is committed to the repository so the tool works out of the box. Raw audio datasets are large and externally hosted; the download scripts in `scripts/` handle retrieval.
|
| 212 |
+
|
| 213 |
+
**Model weights are not committed.** Trained `.pt` files live in `models/` which is git-ignored. The `scripts/train_model.py` script reproduces them from the processed dataset. A pre-trained checkpoint will be hosted separately on Hugging Face Hub.
|
| 214 |
+
|
| 215 |
+
**Migrations directory is tracked.** The `sonaris/module6_database/migrations/` directory and its `env.py` are committed. Individual migration version files are generated by Alembic as the schema evolves and should also be committed.
|
| 216 |
+
|
| 217 |
+
**One UI file per module.** Each module has a `_ui.py` file that defines its Streamlit component as a callable function. `app.py` imports and assembles these into a single multi-page application. This keeps UI logic out of the scientific core.
|
docs/research_notes.md
ADDED
|
File without changes
|
modules/__init__.py
ADDED
|
File without changes
|
modules/bioacoustic/__init__.py
ADDED
|
File without changes
|
modules/bioacoustic/audiogram_data.py
ADDED
|
File without changes
|
modules/bioacoustic/bis_calculator.py
ADDED
|
File without changes
|
modules/imo_compliance/__init__.py
ADDED
|
File without changes
|
modules/imo_compliance/compliance_checker.py
ADDED
|
File without changes
|
modules/input_engine/__init__.py
ADDED
|
File without changes
|
modules/input_engine/design_input.py
ADDED
|
File without changes
|
modules/mitigation/__init__.py
ADDED
|
File without changes
|
modules/mitigation/recommender.py
ADDED
|
File without changes
|
modules/urn_database/__init__.py
ADDED
|
File without changes
|
modules/urn_database/db_manager.py
ADDED
|
File without changes
|
modules/urn_prediction/__init__.py
ADDED
|
File without changes
|
modules/urn_prediction/ai_layer.py
ADDED
|
File without changes
|
modules/urn_prediction/physics_layer.py
ADDED
|
File without changes
|
requirements.txt
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# =============================================================================
|
| 2 |
+
# SONARIS - Ship-Ocean Noise Acoustic Radiated Intelligence System
|
| 3 |
+
# requirements.txt
|
| 4 |
+
# =============================================================================
|
| 5 |
+
# Pin strategy: minimum stable versions that are mutually compatible.
|
| 6 |
+
# Tested on Python 3.10+. Use a virtual environment.
|
| 7 |
+
# =============================================================================
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
# -----------------------------------------------------------------------------
|
| 11 |
+
# Core Scientific Computing
|
| 12 |
+
# -----------------------------------------------------------------------------
|
| 13 |
+
numpy>=1.24.0
|
| 14 |
+
pandas>=2.0.0
|
| 15 |
+
scipy>=1.10.0 # signal processing, FFT, spectral analysis
|
| 16 |
+
h5py>=3.8.0 # reading/writing HDF5 files for large acoustic datasets
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
# -----------------------------------------------------------------------------
|
| 20 |
+
# Audio and Acoustic Processing
|
| 21 |
+
# -----------------------------------------------------------------------------
|
| 22 |
+
librosa>=0.10.0 # MFCC extraction, 1/3-octave analysis, spectral features
|
| 23 |
+
soundfile>=0.12.1 # reading WAV/FLAC hydrophone recordings (libsndfile backend)
|
| 24 |
+
audioread>=3.0.0 # fallback audio decoding backend for librosa
|
| 25 |
+
resampy>=0.4.2 # high-quality audio resampling used internally by librosa
|
| 26 |
+
sounddevice>=0.4.6 # live audio capture for future real-time hydrophone input
|
| 27 |
+
|
| 28 |
+
# -----------------------------------------------------------------------------
|
| 29 |
+
# Machine Learning and Deep Learning
|
| 30 |
+
# -----------------------------------------------------------------------------
|
| 31 |
+
torch>=2.0.0 # primary deep learning framework (1D-CNN + LSTM URN model)
|
| 32 |
+
torchvision>=0.15.0 # image transforms for spectrogram-based model inputs
|
| 33 |
+
torchaudio>=2.0.0 # audio processing ops that integrate with torch pipelines
|
| 34 |
+
scikit-learn>=1.3.0 # classical ML, feature scaling, cross-validation, metrics
|
| 35 |
+
joblib>=1.3.0 # model serialization and parallel processing
|
| 36 |
+
optuna>=3.2.0 # hyperparameter optimization for the URN prediction model
|
| 37 |
+
torchmetrics>=1.0.0 # standardized metrics for PyTorch model evaluation
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# -----------------------------------------------------------------------------
|
| 41 |
+
# Signal Processing and Acoustics
|
| 42 |
+
# -----------------------------------------------------------------------------
|
| 43 |
+
PyWavelets>=1.4.1 # wavelet transforms for multi-resolution acoustic analysis
|
| 44 |
+
acoustics>=0.2.0 # 1/3-octave band filters, dB conversions, acoustic utilities
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
# -----------------------------------------------------------------------------
|
| 48 |
+
# Visualization
|
| 49 |
+
# -----------------------------------------------------------------------------
|
| 50 |
+
matplotlib>=3.7.0
|
| 51 |
+
seaborn>=0.12.0
|
| 52 |
+
plotly>=5.15.0 # interactive spectrograms and compliance charts in the UI
|
| 53 |
+
kaleido>=0.2.1 # static image export for Plotly (used in PDF reports)
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
# -----------------------------------------------------------------------------
|
| 57 |
+
# Web UI
|
| 58 |
+
# -----------------------------------------------------------------------------
|
| 59 |
+
streamlit>=1.25.0
|
| 60 |
+
streamlit-option-menu>=0.3.6 # sidebar navigation component for multi-module UI
|
| 61 |
+
streamlit-plotly-events>=0.0.6 # click events on Plotly charts inside Streamlit
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
# -----------------------------------------------------------------------------
|
| 65 |
+
# Database and ORM
|
| 66 |
+
# -----------------------------------------------------------------------------
|
| 67 |
+
sqlalchemy>=2.0.0 # ORM layer over SQLite (dev) and PostgreSQL (prod)
|
| 68 |
+
alembic>=1.11.0 # database migration management as schema evolves
|
| 69 |
+
psycopg2-binary>=2.9.6 # PostgreSQL adapter for production deployment
|
| 70 |
+
# sqlite3 is included in Python stdlib, no install needed
|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
# -----------------------------------------------------------------------------
|
| 74 |
+
# PDF Report Generation
|
| 75 |
+
# -----------------------------------------------------------------------------
|
| 76 |
+
reportlab>=4.0.0 # IMO compliance report generation (full layout control)
|
| 77 |
+
fpdf2>=2.7.4 # lightweight fallback PDF generation if needed
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
# -----------------------------------------------------------------------------
|
| 81 |
+
# Data Validation and Configuration
|
| 82 |
+
# -----------------------------------------------------------------------------
|
| 83 |
+
pydantic>=2.0.0 # input validation for vessel parameter objects in Module 1
|
| 84 |
+
python-dotenv>=1.0.0 # loads .env config (database URLs, API keys, paths)
|
| 85 |
+
pyyaml>=6.0 # config files for model hyperparameters and module settings
|
| 86 |
+
marshmallow>=3.20.0 # schema serialization for URN database entries
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
# -----------------------------------------------------------------------------
|
| 90 |
+
# HTTP and External Data
|
| 91 |
+
# -----------------------------------------------------------------------------
|
| 92 |
+
requests>=2.31.0 # fetching external datasets, AIS data, IMO document URLs
|
| 93 |
+
httpx>=0.24.0 # async HTTP client for future AIS integration
|
| 94 |
+
aiohttp>=3.8.5 # async requests for concurrent data fetching
|
| 95 |
+
|
| 96 |
+
|
| 97 |
+
# -----------------------------------------------------------------------------
|
| 98 |
+
# Geospatial (Module 5 routing avoidance)
|
| 99 |
+
# -----------------------------------------------------------------------------
|
| 100 |
+
shapely>=2.0.0 # geometric operations on marine protected area polygons
|
| 101 |
+
pyproj>=3.6.0 # coordinate reference system transformations
|
| 102 |
+
folium>=0.14.0 # interactive map rendering for routing avoidance overlays
|
| 103 |
+
geopandas>=0.13.0 # spatial dataframes for shipping lane and MPA data
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
# -----------------------------------------------------------------------------
|
| 107 |
+
# Utilities
|
| 108 |
+
# -----------------------------------------------------------------------------
|
| 109 |
+
tqdm>=4.65.0 # progress bars for dataset loading and model training
|
| 110 |
+
loguru>=0.7.0 # structured logging across all modules
|
| 111 |
+
rich>=13.4.0 # formatted console output during CLI runs
|
| 112 |
+
click>=8.1.0 # CLI interface for headless/batch SONARIS runs
|
| 113 |
+
tenacity>=8.2.0 # retry logic for external data fetches
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
# -----------------------------------------------------------------------------
|
| 117 |
+
# Development and Jupyter Support
|
| 118 |
+
# -----------------------------------------------------------------------------
|
| 119 |
+
jupyter>=1.0.0
|
| 120 |
+
jupyterlab>=4.0.0
|
| 121 |
+
ipykernel>=6.23.0
|
| 122 |
+
ipywidgets>=8.0.0 # interactive widgets in research notebooks
|
| 123 |
+
nbconvert>=7.6.0 # exporting notebooks to HTML/PDF for documentation
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
# -----------------------------------------------------------------------------
|
| 127 |
+
# Testing
|
| 128 |
+
# -----------------------------------------------------------------------------
|
| 129 |
+
pytest>=7.4.0
|
| 130 |
+
pytest-cov>=4.1.0 # coverage reporting
|
| 131 |
+
pytest-mock>=3.11.0 # mocking for unit tests on audio I/O and model inference
|
| 132 |
+
hypothesis>=6.82.0 # property-based testing for signal processing functions
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
# -----------------------------------------------------------------------------
|
| 136 |
+
# Code Quality
|
| 137 |
+
# -----------------------------------------------------------------------------
|
| 138 |
+
black>=23.7.0 # code formatting
|
| 139 |
+
isort>=5.12.0 # import sorting
|
| 140 |
+
flake8>=6.1.0 # linting
|
| 141 |
+
mypy>=1.4.0 # static type checking
|
| 142 |
+
pre-commit>=3.3.0 # git hooks to enforce formatting before commits
|
tests/__init__.py
ADDED
|
File without changes
|
tests/test_modules.py
ADDED
|
File without changes
|