modelCacher1d

sherpa.models.model.modelCacher1d(func: Callable) Callable[source] [edit on github]

A decorater to cache 1D ArithmeticModel evalutions.

Apply to the calc method of a 1D model to allow the model evaluation to be cached. The decision is based on the _use_caching attribute of the cache along with the integrate setting, the evaluation grid, parameter values, and the keywords sent to the model.

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).

Example

Allow MyModel model evaluations to be cached:

def MyModel(ArithmeticModel):
    ...
    @modelCacher1d
    def calc(self, p, *args, **kwargs):
        ...