def test_helper_poisson_exact(): pytest.skip('distribution stretch goal not yet implemented') centerq = [1, 5, 30, 400] * u.one ds.poisson(centerq, n_samples=1000) with pytest.raises(u.UnitsError) as exc: centerq = [1, 5, 30, 400] * u.kpc ds.poisson(centerq, n_samples=1000) assert exc.value.args[0] == ("Poisson distribution can only be computed " "for dimensionless quantities")
def test_helper_poisson_exact(): pytest.skip('distribution stretch goal not yet implemented') centerq = [1, 5, 30, 400] * u.one ds.poisson(centerq, n_samples=1000) with pytest.raises(u.UnitsError) as exc: centerq = [1, 5, 30, 400] * u.kpc ds.poisson(centerq, n_samples=1000) assert exc.value.args[0] == ("Poisson distribution can only be computed " "for dimensionless quantities")
def test_helper_poisson_samples(): centerqcounts = [1, 5, 30, 400] * u.count with NumpyRNGContext(12345): p_dist = ds.poisson(centerqcounts, n_samples=100) assert p_dist.shape == (4,) assert p_dist.distribution.shape == (4, 100) assert p_dist.unit == u.count p_min = np.min(p_dist) assert isinstance(p_min, Distribution) assert p_min.shape == () assert np.all(p_min >= 0) assert np.all(np.abs(p_dist.pdf_mean - centerqcounts) < centerqcounts)
def test_helper_poisson_samples(): centerqcounts = [1, 5, 30, 400] * u.count with NumpyRNGContext(12345): p_dist = ds.poisson(centerqcounts, n_samples=100) assert p_dist.shape == (4,) assert p_dist.distribution.shape == (4, 100) assert p_dist.unit == u.count p_min = np.min(p_dist) assert isinstance(p_min, Distribution) assert p_min.shape == () assert np.all(p_min >= 0) assert np.all(np.abs(p_dist.pdf_mean - centerqcounts) < centerqcounts)