A mathematical framework for analyzing human biomechanics through multi-scale oscillatory coupling principles using consumer-grade wearable sensor data.
This project implements the theoretical framework described in docs/publication/consumer-grade-sensors-biomechanics.tex, providing tools for:
- Multi-scale oscillatory coupling analysis (10 hierarchical scales)
- Gear ratio transformations for O(1) complexity navigation
- Tri-dimensional state space coordinate computation
- Surface compliance effect quantification
- Activity-sleep mirror coupling analysis
- Performance prediction from coupling dynamics
- Decoupling threshold detection
The project consists of two components:
High-performance implementation of the mathematical framework for production use:
- FIT file parsing and time series extraction
- Multi-scale frequency decomposition
- Coupling strength computation
- Gear ratio analysis
- State space coordinate calculation
- Performance prediction models
Research and validation tools for empirical analysis:
- Statistical validation of theoretical predictions
- Visualization and exploratory analysis
- Comparative studies with traditional models
- Data quality assessment
- Result verification against Rust implementation
hehahe/
├── src/ # Rust core framework
│ ├── lib.rs # Library root
│ ├── main.rs # CLI application
│ ├── parsers/ # Data file parsers
│ │ ├── mod.rs
│ │ ├── fit.rs # FIT file parser
│ │ ├── gpx.rs # GPX parser
│ │ ├── tcx.rs # TCX parser
│ │ └── kml.rs # KML parser
│ ├── oscillatory/ # Oscillatory analysis
│ │ ├── mod.rs
│ │ ├── hierarchy.rs # 10-scale hierarchy
│ │ ├── coupling.rs # Coupling strength computation
│ │ ├── gear_ratio.rs # Gear ratio transformations
│ │ └── frequency.rs # Frequency domain analysis
│ ├── state_space/ # State coordinates
│ │ ├── mod.rs
│ │ ├── knowledge.rs # Knowledge dimension
│ │ ├── temporal.rs # Time dimension
│ │ └── entropy.rs # Entropy dimension
│ ├── models/ # Predictive models
│ │ ├── mod.rs
│ │ ├── performance.rs # Sprint performance
│ │ ├── sleep.rs # Sleep quality
│ │ ├── surface.rs # Surface compliance
│ │ └── coupling_decay.rs # Decoupling detection
│ └── utils/ # Utilities
│ ├── mod.rs
│ ├── signal.rs # Signal processing
│ └── math.rs # Mathematical utilities
├── upward/ # Python implementation (biomechanics)
│ ├── __init__.py
│ ├── muscle/ # Oscillatory muscle modeling
│ │ ├── __init__.py
│ │ ├── muscle_model.py # Extended Hill-type muscle model
│ │ ├── body_segmentation.py # Body segments as coupled oscillators
│ │ └── README.md
│ ├── analysis/ # Analysis tools
│ │ ├── __init__.py
│ │ ├── coupling.py # Coupling strength analysis
│ │ ├── frequency.py # Frequency domain analysis
│ │ └── gear_ratios.py # Gear ratio computation
│ ├── extractor/ # Data extraction
│ │ ├── __init__.py
│ │ ├── fit_parser.py # FIT file parsing
│ │ └── time_series.py # Time series extraction
│ ├── stabilography/ # Postural analysis
│ │ └── postural_sway.py # Oscillatory postural analysis
│ ├── examples/ # Example scripts
│ │ ├── __init__.py
│ │ └── muscle_oscillatory_demo.py # Comprehensive demo
│ ├── config.py
│ ├── requirements.txt
│ ├── setup.py
│ └── README.md
├── tests/ # Rust tests
│ ├── integration/
│ └── unit/
├── docs/ # Documentation
│ ├── oscillations/ # Theoretical documents
│ ├── biomechanics/
│ ├── biology/
│ ├── publication/
│ ├── notes/ # Jupyter notebooks (reference)
│ └── api/ # API documentation
├── data/ # Data directory (gitignored)
│ ├── raw/ # Raw FIT/GPX/TCX/KML files
│ ├── processed/ # Processed time series
│ └── results/ # Analysis results
├── Cargo.toml # Rust dependencies
├── pyproject.toml # Python project config
├── .gitignore
└── README.md
Requirements:
- Rust 1.70+ (install via rustup)
# Build the project
cargo build --release
# Run tests
cargo test
# Install CLI tool
cargo install --path .Requirements:
- Python 3.9+
- pip or uv
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
cd upward
pip install -r requirements.txt
# Or install in development mode
pip install -e .# Parse FIT file and compute coupling analysis
hehahe analyze --input data/raw/activity.fit --output data/processed/
# Batch process directory
hehahe batch --input-dir data/raw/ --output-dir data/processed/
# Predict sprint performance
hehahe predict-sprint --input data/processed/training_session.json
# Analyze sleep quality
hehahe analyze-sleep --input data/raw/sleep.fitfrom upward.muscle import OscillatoryMuscleModel, LowerLimbModel
# Create muscle model with oscillatory coupling
muscle = OscillatoryMuscleModel()
# Define excitation and length functions
def excitation(t):
return 1.0 if 0.5 <= t <= 2.0 else 0.01
def muscle_tendon_length(t):
return 0.31 # Isometric contraction
# Simulate with oscillatory coupling
results = muscle.simulate_muscle_with_coupling(
excitation, muscle_tendon_length,
enable_coupling=True
)
# Analyze performance
metrics = muscle.compute_performance_metrics(results)
print(f"Peak force: {metrics['peak_force']:.2f} N")
print(f"Average coupling: {metrics['average_coupling']:.3f}")
# Body segment simulation
limb = LowerLimbModel(body_mass=70, height=1.75)
gait_results = limb.simulate_gait_cycle(stride_frequency=1.5)# Run comprehensive demo with all examples
cd upward/examples
python muscle_oscillatory_demo.py
# This generates multiple visualization plots demonstrating:
# - Classical vs oscillatory muscle models
# - Multi-scale frequency decomposition
# - Dynamic coupling during activation
# - Body segment coordination
# - Performance prediction from couplingExpected fields:
-
Activity Sessions:
- Timestamp
- Heart rate (bpm)
- Cadence (steps/min)
- Speed (m/s)
- Altitude (m)
- Temperature (°C)
- Accelerometer data (if available)
- Ground contact time (ms, if available)
- Vertical oscillation (cm, if available)
-
Sleep Sessions:
- Timestamp
- Sleep stage (awake/light/deep/REM)
- Heart rate
- Movement
- Respiration rate (if available)
- FIT: Primary format (Garmin, Suunto, Polar, etc.)
- GPX: GPS tracks (position, elevation, time)
- TCX: Training Center XML (heart rate, cadence)
- KML: Google Earth format (position, time)
- Quantum Membrane (10¹²-10¹⁵ Hz)
- Intracellular (10³-10⁶ Hz)
- Cellular (10⁻¹-10² Hz)
- Tissue (10⁻²-10¹ Hz)
- Neural (1-100 Hz)
- Neuromuscular (0.01-20 Hz)
- Cardiovascular (0.01-5 Hz)
- Locomotor (0.5-3 Hz)
- Circadian (10⁻⁵ Hz)
- Allometric (10⁻⁸-10⁻⁵ Hz)
Coupling Strength:
C_ij(t) = |1/T ∫₀ᵀ A_i(φ_j(t+τ)) e^(iφ_i(t+τ)) dτ|
Gear Ratio:
R_{i→j} = ω_i / ω_j
State Coordinates:
s = (s_knowledge, s_time, s_entropy)
Decoupling Threshold:
C_critical = 1/(N-1) √(Σω_k² / Σω_k)
- FIT file parsing: ~2ms per file
- Coupling computation: ~50ms per session
- Full analysis pipeline: ~100ms per session
- Memory usage: <10MB per session
- Statistical validation: ~500ms per comparison
- Visualization generation: ~2s per plot
- Batch analysis: ~1s per session
[profile.release]
opt-level = 3
lto = true
codegen-units = 1Configure analysis parameters in validation/config.py:
- Frequency band definitions
- Coupling thresholds
- Surface compliance factors
- Sleep stage parameters
# Unit tests
cargo test
# Integration tests
cargo test --test '*'
# Benchmarks
cargo bench# Unit tests
pytest validation/tests/
# With coverage
pytest --cov=validation validation/tests/
# Specific test
pytest validation/tests/test_coupling.pyAll data processing occurs locally. No data is transmitted externally. Ensure compliance with data protection regulations when handling personal health data.
This is a research project. Contributions should:
- Maintain mathematical rigor
- Include comprehensive tests
- Document theoretical basis
- Provide validation results
If you use this framework in research, please cite:
@article{sachikonye2024oscillatory,
title={Multi-Scale Oscillatory Coupling Analysis for Human Biomechanics Using Consumer-Grade Wearable Sensors},
author={Sachikonye, Kundai Farai},
journal={In preparation},
year={2024}
}[To be determined]
See docs/publication/consumer-grade-sensors-biomechanics.tex for complete theoretical foundation and references.
Kundai Farai Sachikonye kundai.sachikonye@tum.de
Current Status: Initial implementation phase
- Theoretical framework documentation
- Rust core implementation
- Python validation framework
- FIT file parser
- Coupling analysis algorithms
- State space computation
- Performance prediction models
- Empirical validation with 4+ years of data
- Documentation and examples