示例#1
0
def generate_f_test_out(slm1, slm2):
    D = {}
    slm_OUT = f_test(slm1, slm2)
    mykeys = ["X", "df", "SSE", "coef", "k", "t"]
    for key in mykeys:
        D[key] = getattr(slm_OUT, key)
    return D
示例#2
0
def dummy_test(infile, expfile):

    # load input test data
    ifile = open(infile, "br")
    idic = pickle.load(ifile)
    ifile.close()

    slm1 = SLM(Term(1), Term(1))
    slm2 = SLM(Term(1), Term(2))
    for key in idic.keys():
        if "1" in key:
            setattr(slm1, key[4:], idic[key])
        elif "2" in key:
            setattr(slm2, key[4:], idic[key])

    # run f test
    outdic = f_test(slm1, slm2)

    # load expected outout data
    efile = open(expfile, "br")
    expdic = pickle.load(efile)
    efile.close()

    testout = []

    for key in expdic.keys():
        comp = np.allclose(getattr(outdic, key),
                           expdic[key],
                           rtol=1e-05,
                           equal_nan=True)
        testout.append(comp)

    assert all(flag == True for (flag) in testout)