コード例 #1
0
ファイル: opt_path.py プロジェクト: catenate15/Pilgrim
def compare_tcommon(tcommon, tcommon2, rstfile, eps=0.01):
    exception = Exc.RstDiffVar(Exception)
    exception._rst = rstfile
    if tcommon2 is None: return
    the_vars = ("ch", "mtp", "atonums", "masses", "mu")
    for idx, var in enumerate(the_vars):
        exception._var = var
        var1, var2 = tcommon[idx], tcommon2[idx]
        if type(var1) == type(1) or type(var1) == type(1.0):
            var1 = [var1]
            var2 = [var2]
        for ii, jj in zip(var1, var2):
            if abs(ii - jj) > eps: raise exception
コード例 #2
0
ファイル: opt_path.py プロジェクト: catenate15/Pilgrim
def compare_tpath(tpath, tpath2, rstfile, eps=1e-8):
    exception = Exc.RstDiffVar(Exception)
    exception._rst = rstfile
    if tpath2 is None: return
    the_vars = ("method", "mu", "ds", "hsteps", "cubic")
    for idx, var in enumerate(the_vars):
        exception._var = var
        var1, var2 = tpath[idx], tpath2[idx]
        if type(var1) != type(var2): raise exception
        if type(var1) == type(""):
            if var1 != var2: raise exception
        if type(var1) == type(1.0):
            if abs(var1 - var2) > eps: raise exception