@@ -0,0 +1,2288 @@
+%22%22%22microlensing related utilities%22%22%22%0A%0A# Copyright (c) Arnaud Cassan.%0A# Distributed under the terms of the MIT license.%0A%0Aimport numpy as np%0Aimport timeit%0Aimport os%0Aimport logging%0Afrom logging import info as printi%0Afrom logging import debug as printd%0Afrom logging import warning as printw%0A%0Adef verbosity(level, filename=None):%0A    %22%22%22Set verbosity flag%0A    %22%22%22%0A    # set I/O shell display%0A    tend, tun, tit = %22%5C033%5B0m%22, %22%5C033%5B0m%5C033%5B31;1m%22, %22%5C033%5B0m%5C033%5B3m%22%0A    %0A    if level == 'NONE':%0A        verbose = logging.CRITICAL%0A        logging.basicConfig(format='%25(message)s', level=verbose, filename=filename)%0A    elif level == 'WARNING':%0A        verbose = logging.WARNING%0A        logging.basicConfig(format=tun + 'Warning/Error : ' + tend + '%25(message)s', level=verbose, filename=filename)%0A    elif level == 'INFO':%0A        verbose = logging.INFO%0A        logging.basicConfig(format='%25(message)s', level=verbose, filename=filename)%0A    elif level == 'DEBUG':%0A        verbose = logging.DEBUG%0A        logging.basicConfig(format=tun + '%5B%25(process)d%5D ' + tend + '%25(message)s', level=verbose, filename=filename)%0A    else:%0A        raise(%22error level does not exist: correct options are 'NONE', 'WARNING', 'INFO' and 'DEBUG'%22)%0A%0Adef checkandtimeit():%0A    %22%22%22Check and time function%0A        %0A        Usage%0A        -----%0A        @checkandtimeit()%0A        def function(*args, **kwargs)%0A            (...)%0A        %22%22%22%0A    def _deco_verif(fonction):%0A        # set I/O shell display%0A        tend, tcol, tit = %22%5C033%5B0m%22, %22%5C033%5B47m%22, %22%5C033%5B3m%22%0A        def _new_verif(*args, **kwargs):%0A            printi(tcol + %22Begin execution:%22 + tend + tit + %22 %7B%7D%22.format(fonction.__name__) + tend)%0A            t1 = timeit.default_timer()%0A            ret = fonction(*args, **kwargs)%0A            t2 = timeit.default_timer()%0A            printi(tcol + %22End execution:%22 + tend + tit + %22 %7B%7D%22.format(fonction.__name__) + tend + %22 (executed in %7B:.2e%7Ds)%22.format(t2-t1))%0A            return ret%0A        return _new_verif%0A    return _deco_verif%0A%0Adef obsolete(func):%0A    %22%22%22Mark function as obsolete%0A        %0A        Usage%0A        -----%0A        @obsolete%0A        def function(*args, **kwargs)%0A            (...)%0A        %22%22%22%0A    def mfunc():%0A        raise RuntimeError(%22Function '%7B%7D' is obsolete%22.format(func.__name__))%0A    return mfunc%0A%0A

add utils