8. Extending NLSQ¶
This chapter covers extending NLSQ with custom protocols, plugins, and testing strategies.
8.1. Chapter Overview¶
- Custom Protocols (10 min)
Implementing new protocols for custom components.
- Plugin Development (10 min)
Creating NLSQ extensions and plugins.
- Testing Strategies (10 min)
Testing custom components and extensions.
8.2. Extension Points¶
NLSQ can be extended at multiple levels:
Custom Optimizers: Implement OptimizerProtocol
Custom Preprocessors: Implement DataPreprocessorProtocol
Custom Covariance: Implement CovarianceComputerProtocol
Custom Caches: Implement CacheProtocol
from nlsq.interfaces import OptimizerProtocol
class MyOptimizer:
def optimize(self, fun, x0, **kwargs):
# Your optimization logic
pass
# Use with NLSQ infrastructure
optimizer: OptimizerProtocol = MyOptimizer()