def use_astromodels_memoization(switch, cache_size=_CACHE_SIZE):
    """
    Activate/deactivate memoization temporarily

    :param switch: True (memoization on) or False (memoization off)
    :param cache_size: number of previous evaluation of functions to keep in memory. Default: 100
    :return:
    """

    global _WITH_MEMOIZATION
    global _CACHE_SIZE

    old_status = bool(_WITH_MEMOIZATION)
    old_cache_size = int(_CACHE_SIZE)

    _WITH_MEMOIZATION = bool(switch)
    _CACHE_SIZE = int(cache_size)

    yield

    _WITH_MEMOIZATION = old_status
    _CACHE_SIZE = old_cache_size
def use_astromodels_memoization ( switch , cache_size = _CACHE_SIZE ) : global _WITH_MEMOIZATION global _CACHE_SIZE old_status = bool ( _WITH_MEMOIZATION ) old_cache_size = int ( _CACHE_SIZE ) _WITH_MEMOIZATION = bool ( switch ) _CACHE_SIZE = int ( cache_size ) yield _WITH_MEMOIZATION = old_status _CACHE_SIZE = old_cache_size
Activate/deactivate memoization temporarily

    :param switch: True (memoization on) or False (memoization off)
    :param cache_size: number of previous evaluation of functions to keep in memory. Default: 100
    :return: