Beispiel #1
0
def test_ExtendedBinnedNLL_mask():
    c = ExtendedBinnedNLL([1, 1000, 2], [0, 1, 2, 3], expon_cdf)
    assert c.ndata == 3

    c_unmasked = c(2)
    c.mask = np.arange(3) != 1
    assert c(2) < c_unmasked
    assert c.ndata == 2
Beispiel #2
0
def test_ExtendedBinnedNLL_mask():
    c = ExtendedBinnedNLL([1, 1000, 2], [0, 1, 2, 3], lambda x, a: a * x)

    assert c(2) == pytest.approx(-700, rel=0.1)
    c.mask = np.arange(3) != 1
    assert c(2) == pytest.approx(2, rel=0.1)