Exemplo n.º 1
0
def test_rejection_sample_2d_single_sample_with_rejection():
    def kernel(p):
        return p[0] + p[1]

    pts = testmod.rejection_sample_2d(kernel, 2)
    assert (pts[0] == approx(0.3))
    assert (pts[1] == approx(0.4))
Exemplo n.º 2
0
def test_rejection_sample_2d_some_rejection():
    def kernel(p):
        return p[0] + p[1]

    pts = testmod.rejection_sample_2d(kernel, 2, samples=3)
    np.testing.assert_allclose(pts[0], [0.1, 0.4, 0.5])
    np.testing.assert_allclose(pts[1], [0.5, 0.2, 0.1])
Exemplo n.º 3
0
def test_rejection_sample_2d_multiple_passes():
    def kernel(p):
        return p[0] + p[1]

    pts = testmod.rejection_sample_2d(kernel, 2, samples=2)
    np.testing.assert_allclose(pts[0], [0.1, 0.1])
    np.testing.assert_allclose(pts[1], [0.5, 0.5])