Exemplo n.º 1
0
def test_scipy_poisson_limit():
    '''Test that the lower-level routine gives the snae number.

    Test numbers are from table1 1, 3 in
    Kraft, Burrows and Nousek in
    `ApJ 374, 344 (1991) <https://ui.adsabs.harvard.edu/abs/1991ApJ...374..344K>`_
    '''
    assert_allclose(funcs._scipy_kraft_burrows_nousek(5, 2.5, .99),
                    (0, 10.67), rtol=1e-3)
    assert_allclose(funcs._scipy_kraft_burrows_nousek(np.int32(5.), 2.5, .99),
                    (0, 10.67), rtol=1e-3)
    assert_allclose(funcs._scipy_kraft_burrows_nousek(np.int64(5.), 2.5, .99),
                    (0, 10.67), rtol=1e-3)
    assert_allclose(funcs._scipy_kraft_burrows_nousek(5, np.float32(2.5), .99),
                    (0, 10.67), rtol=1e-3)
    assert_allclose(funcs._scipy_kraft_burrows_nousek(5, np.float64(2.5), .99),
                    (0, 10.67), rtol=1e-3)
    assert_allclose(funcs._scipy_kraft_burrows_nousek(5, 2.5, np.float32(.99)),
                    (0, 10.67), rtol=1e-3)
    assert_allclose(funcs._scipy_kraft_burrows_nousek(5, 2.5, np.float64(.99)),
                    (0, 10.67), rtol=1e-3)
    conf = funcs.poisson_conf_interval([5, 6], 'kraft-burrows-nousek',
                                       background=[2.5, 2.],
                                       confidence_level=[.99, .9])
    assert_allclose(conf[:, 0], (0, 10.67), rtol=1e-3)
    assert_allclose(conf[:, 1], (0.81, 8.99), rtol=5e-3)
Exemplo n.º 2
0
def test_scipy_poisson_limit():
    '''Test that the lower-level routine gives the snae number.

    Test numbers are from table1 1, 3 in
    Kraft, Burrows and Nousek in
    `ApJ 374, 344 (1991) <http://adsabs.harvard.edu/abs/1991ApJ...374..344K>`_
    '''
    assert_allclose(funcs._scipy_kraft_burrows_nousek(5., 2.5, .99),
                    (0, 10.67), rtol=1e-3)
    conf = funcs.poisson_conf_interval([5., 6.], 'kraft-burrows-nousek',
                                       background=[2.5, 2.],
                                       conflevel=[.99, .9])
    assert_allclose(conf[:, 0], (0, 10.67), rtol=1e-3)
    assert_allclose(conf[:, 1], (0.81, 8.99), rtol=5e-3)