コード例 #1
0
ファイル: test_plotting.py プロジェクト: tyseraph/probfit
def test_draw_residual_blh_norm():
    np.random.seed(0)
    data = np.random.randn(1000)
    blh = BinnedLH(gaussian, data)
    blh.draw_residual(args=(0., 1.), norm=True)
    plt.ylim(-4., 3.)
    plt.xlim(-4., 3.)
コード例 #2
0
ファイル: test_plotting.py プロジェクト: tyseraph/probfit
def test_blh_with_parts():
    np.random.seed(0)
    data = np.random.randn(10000)
    shifted = data + 3.
    data = np.append(data, [shifted])
    g1 = rename(gaussian, ['x', 'lmu', 'lsigma'])
    g2 = rename(gaussian, ['x', 'rmu', 'rsigma'])
    allpdf = AddPdfNorm(g1, g2)
    blh = BinnedLH(allpdf, data)
    blh.draw(args=(0, 1, 3, 1, 0.5), parts=True)
コード例 #3
0
ファイル: test_plotting.py プロジェクト: marinang/probfit
def test_draw_residual_blh_norm_options():
    np.random.seed(0)
    data = np.random.randn(1000)
    blh = BinnedLH(gaussian, data)
    blh.draw_residual(args=(0., 1.),
                      norm=True,
                      color='green',
                      capsize=2,
                      grid=False,
                      zero_line=False)
コード例 #4
0
ファイル: testfit.py プロジェクト: mtresch/probfit
 def test_BinnedLH(self):
     # write a better test... this depends on subtraction
     f = gaussian
     assert_equal(list(describe(f)), ['x', 'mean', 'sigma'])
     lh = BinnedLH(gaussian, self.data, bound=[-3, 3])
     assert_equal(list(describe(lh)), ['mean', 'sigma'])
     assert_almost_equal(lh(0, 1), 20.446130781601543, 1)
     minuit = iminuit.Minuit(lh)
     assert_equal(minuit.errordef, 0.5)
コード例 #5
0
ファイル: test_fit.py プロジェクト: vishalbelsare/probfit
 def test_BinnedLH(self):
     # write a better test... this depends on subtraction
     f = gaussian
     assert list(describe(f)) == ["x", "mean", "sigma"]
     lh = BinnedLH(gaussian, self.data, bound=[-3, 3])
     assert list(describe(lh)) == ["mean", "sigma"]
     assert_allclose(lh(0, 1), 20.446130781601543, atol=1)
     minuit = iminuit.Minuit(lh)
     assert_allclose(minuit.errordef, 0.5)
コード例 #6
0
ファイル: testtoy.py プロジェクト: mtresch/probfit
def test_gen_toy2():
    pdf = gaussian
    np.random.seed(0)
    toy = gen_toy(pdf, 10000, (-5, 5), mean=0, sigma=1)
    binlh = BinnedLH(pdf, toy, bound=(-5, 5), bins=100)
    lh = binlh(0., 1.)
    for x in toy:
        assert (x < 5)
        assert (x >= -5)
    assert_equal(len(toy), 10000)
    assert (lh / 100. < 1.)
コード例 #7
0
ファイル: test_toy.py プロジェクト: vishalbelsare/probfit
def test_gen_toy2():
    pdf = gaussian
    np.random.seed(0)
    toy = gen_toy(pdf, 10000, (-5, 5), mean=0, sigma=1)
    binlh = BinnedLH(pdf, toy, bound=(-5, 5), bins=100)
    lh = binlh(0.0, 1.0)
    for x in toy:
        assert x < 5
        assert x >= -5
    assert len(toy) == 10000
    assert lh / 100.0 < 1.0
コード例 #8
0
ファイル: test_plotting.py プロジェクト: tyseraph/probfit
def test_draw_blh_extend_residual_norm():
    np.random.seed(0)
    data = np.random.randn(1000)
    blh = BinnedLH(Extended(gaussian), data, extended=True)
    blh.draw_residual(args=(0., 1., 1000), norm=True)
コード例 #9
0
ファイル: test_plotting.py プロジェクト: tyseraph/probfit
def test_draw_residual_blh_norm():
    np.random.seed(0)
    data = np.random.randn(1000)
    blh = BinnedLH(gaussian, data)
    blh.draw_residual(args=(0., 1.), norm=True, show_errbars=False)
コード例 #10
0
ファイル: test_plotting.py プロジェクト: iminuit/probfit
def test_draw_residual_blh_norm_options():
    np.random.seed(0)
    data = np.random.randn(1000)
    blh = BinnedLH(gaussian, data)
    blh.draw_residual(args=(0., 1.), norm=True, color='green', capsize=2,
                      grid=False, zero_line=False)
コード例 #11
0
ファイル: test_plotting.py プロジェクト: tyseraph/probfit
def test_draw_residual_blh():
    np.random.seed(0)
    data = np.random.randn(1000)
    blh = BinnedLH(gaussian, data)
    blh.draw_residual(args=(0., 1.))
コード例 #12
0
ファイル: test_plotting.py プロジェクト: tyseraph/probfit
def test_draw_blh_extend():
    np.random.seed(0)
    data = np.random.randn(1000)
    blh = BinnedLH(Extended(gaussian), data, extended=True)
    blh.draw(args=(0., 1., 1000))
コード例 #13
0
def test_draw_blh():
    np.random.seed(0)
    data = np.random.randn(1000)
    blh = BinnedLH(gaussian, data)
    blh.draw(args=(0.0, 1.0))
コード例 #14
0
ファイル: testplotting.py プロジェクト: bks/probfit
def test_draw_blh():
    np.random.seed(0)
    data = np.random.randn(1000)
    blh = BinnedLH(gaussian, data)
    plt.figure()
    blh.draw(args=(0., 1.))