Repository navigation
v0.4.2
Highlights
Interactive Streamlit GUI
nlsq guiCLI command: Launch interactive curve fitting interface- Data import from CSV, Excel, JSON, and HDF5 files
- Built-in model library with 15+ common functions
- Custom model definition with JAX/NumPy syntax
- Real-time parameter adjustment with sliders
- Interactive visualization with residual plots
- Export fitted parameters and covariance matrix
Package Restructure (v0.4.2 Architecture)
-
Subpackage organization: Logical grouping of modules
nlsq/ ├── core/ # Core optimization (minpack, least_squares, trf) ├── interfaces/ # Protocol definitions for dependency injection ├── streaming/ # Large dataset handling ├── caching/ # Performance optimization (memory pool, smart cache) ├── stability/ # Numerical stability (guard, SVD fallback) ├── precision/ # Precision controls (mixed precision, normalizer) └── utils/ # Utilities (validators, diagnostics, logging) -
Protocol interfaces package (
nlsq/interfaces/): Dependency injection supportCacheProtocol,BoundedCacheProtocol: Cache implementationsOptimizerProtocol,LeastSquaresOptimizerProtocol: Optimizer interfacesDataSourceProtocol: Data source abstractionJacobianProtocol: Jacobian computation interfaceResultProtocol: Optimization result containers
Performance Optimizations
- Lazy imports (43% faster import): Specialty modules loaded on first access
- Import time reduced from ~1084ms to ~620ms
- Vectorized sparse Jacobian (37-50x speedup): O(nnz) NumPy operations
- Handles 100k×50 matrices in <150ms
Code Modernization
- Python 3.12+ type hints: Updated
Union→|,Optional[X]→X | None - Dataclass
__slots__: Addedslots=Trueto dataclasses for memory efficiency
Test Results
- Tests: 2,904+ passing (100% success rate)
- Coverage: ~82% (exceeds 80% target)
- Platforms: Ubuntu ✅ | macOS ✅ | Windows ✅
Backward Compatibility
- 100% API backward compatible
- All public imports preserved via
__init__.pyre-exports - Old import paths work via module aliases
Installation
pip install nlsq==0.4.2
# With GUI support
pip install nlsq[gui]==0.4.2
# With all optional dependencies
pip install nlsq[all]==0.4.2See CHANGELOG.md for full details.