astromodels.core.memoization module

astromodels.core.memoization.memoize(method)[source]

A decorator for functions of sources which memoize the results of the last _CACHE_SIZE calls,

Parameters

method – method to be memoized

Returns

the decorated method

astromodels.core.memoization.use_astromodels_memoization(switch, cache_size=20)[source]

Activate/deactivate memoization temporarily

Parameters
  • switch – True (memoization on) or False (memoization off)

  • cache_size – number of previous evaluation of functions to keep in memory. Default: 100

Returns