modelCacher1d
- sherpa.models.model.modelCacher1d(func: Callable) Callable[source] [edit on github]
A decorator to cache ArithmeticModel evaluations.
Apply to the
calcmethod of a model to allow the model evaluation to be cached. The decision is based on theintegratesetting, the evaluation grid, parameter values, and the keywords sent to the model.For historic reasons, this decorator was implemented for 1D models first. However, it is general enough that it works in higher dimensions, too. It can be used as either
@modelCacher1dor@modelCacher; the names are aliases for each other.Notes
The keywords are included in the hash calculation even if they are not relevant for the model (as there’s no easy way to find this out).
Examples
Allow
MyModelmodel evaluations to be cached:def MyModel(ArithmeticModel): ... @modelCacher def calc(self, p, *args, **kwargs): ...