Ejemplo n.º 1
0
def test_clsts():
    '''
    Test for the "CLsTS" base class.
    '''
    alt = hep_spt.CLsHypo_discrete(poisson(8))
    null = hep_spt.CLsHypo_discrete(poisson(4))

    hep_spt.CLsTS(alt, null)
Ejemplo n.º 2
0
def test_clsts_discrete():
    '''
    Test for the "CLsTS_discrete" class.
    '''
    alt = hep_spt.CLsHypo_discrete(poisson(8))
    null = hep_spt.CLsHypo_discrete(poisson(4))

    h = hep_spt.CLsTS_discrete(alt, null)
Ejemplo n.º 3
0
def test_clshypo_discrete():
    '''
    Test for the "CLsHypo_discrete" class.
    '''
    h = hep_spt.CLsHypo_discrete(poisson(8))

    assert np.allclose(h(8), poisson(8).pmf(8))
Ejemplo n.º 4
0
def test_cls_ts():
    '''
    Test for the "cls_ts" function.
    '''
    mean = 8
    sigma = 2

    dh = hep_spt.CLsHypo_discrete(poisson(mean))
    ch = hep_spt.CLsHypo_continuous(norm(mean, sigma))

    with pytest.raises(RuntimeError):
        hep_spt.cls_ts(dh, ch)

    ts = hep_spt.cls_ts(dh, dh)

    res = ts.evaluate(mean)

    assert res.CLs == 1.
Ejemplo n.º 5
0
def test_cls_hypo():
    '''
    Test all the constructor related to the CLsHypo* classes.
    '''
    pm = 4
    pma = np.arange(pm, pm + 4)

    for m in (pm, pma):
        dh = hep_spt.CLsHypo_discrete(poisson(m))
        dh = hep_spt.cls_hypo(poisson, m)

    gm = 10
    gma = np.arange(gm, gm + 5)
    gs = 2
    gsa = np.arange(gs, gs + 5)

    for m, s in ((gm, gs), (gma, gsa)):
        ch = hep_spt.CLsHypo_continuous(norm(m, s))
        ch = hep_spt.cls_hypo(norm, m, s)