Developer Guide¶
This section is for contributors and developers who want to understand Homodyne’s internal design, run the test suite, or submit improvements.
Getting Started
Design & Architecture
Quick Reference¶
Task |
Command |
|---|---|
Install with dev extras |
|
Run unit tests |
|
Run full suite with coverage |
|
Format + lint + type-check |
|
Build documentation |
|
Code quality stack:
Formatting: Black
Linting: Ruff
Type checking: MyPy (strict mode at API boundaries)
Package manager: uv (
uv.lockis the single source of truth)
Architecture Overview¶
homodyne/
├── core/ # Physics kernel — JIT-compiled JAX
│ ├── jax_backend.py # Meshgrid-mode residuals (NLSQ)
│ ├── physics_cmc.py # Element-wise residuals (CMC)
│ ├── physics_utils.py # Shared: safe_exp, safe_sinc, etc.
│ ├── models.py # OO model interface
│ ├── theory.py # g1/g2 calculations
│ └── homodyne_model.py # Unified model facade
├── optimization/
│ ├── nlsq/ # Trust-region LM (primary)
│ └── cmc/ # Consensus Monte Carlo (secondary)
├── data/ # HDF5 loading, validation
├── config/ # YAML config management
├── cli/ # Entry points, shell completion
└── device/ # CPU/NUMA detection
Key design decisions:
NLSQ uses
jax_backend.py(meshgrid mode — all (t1, t2) pairs batched).CMC uses
physics_cmc.py(element-wise mode — per-shard vectors).No shared mutable state across the two paths.
physics_utils.pyprovides shared utilities (safe_exp,safe_sinc,calculate_diffusion_coefficient).
See System Architecture for module-level design decisions, Architecture Decision Records for Architecture Decision Records (ADRs), and Architecture Deep Dives for detailed subsystem architecture documentation.
Version information:
Homodyne: 2.23.3.dev3
Python: 3.12+
JAX: 0.8.2+ (CPU-only)
Package manager: uv