BaseComponent#
- class BaseComponent(model, verbose=False, params=None)[source]#
Bases:
objectBase class for all laser-measles components.
Components follow a uniform interface with __call__(model, tick) method for execution during simulation loops.
Initialize the component.
- Parameters:
model (
BaseLaserModel) – The model instance this component belongs to.verbose (
bool) – Whether to enable verbose output. Defaults to False.
- select_function(numpy_func, numba_func)[source]#
Select between numpy and numba implementations based on model configuration.
This method provides a convenient way for components to choose between numpy and numba implementations based on model parameters and environment variables.
- Parameters:
numpy_func (
Any) – The numpy implementation function.numba_func (
Any) – The numba implementation function.
- Return type:
Any- Returns:
The selected function implementation.
Example
>>> # In a component's __init__ or _initialize method: >>> self.update_func = self.select_function(numpy_update, numba_update)