Add array test
@@ -212,3 +212,26 @@ def test_wstat_sum():
assert stat_sum.n_bkg == 2.5
assert_allclose(stat_sum.alpha, 0.0925925925925925)
+def test_cash_sum_array():
+ new_size = (2, 10, 3)
+ on = np.array([1, 2, 3])
+ bkg = np.array([0.5, 0.7, 1.3])
+
+ on = np.resize(on, new_size)
+ bkg = np.resize(bkg, new_size)
+
+ stat = CashCountsStatistic(on, bkg)
+ stat_sum = stat.sum(axis=(2))
+
+ assert stat_sum.n_on.shape == (2,10)
+ assert_allclose(stat_sum.n_on, 6)
+ assert_allclose(stat_sum.n_bkg, 2.5)
+
+ stat_sum = stat.sum(axis=(0,1))
+
+ assert stat_sum.n_on.shape == (3,)
+ assert_allclose(stat_sum.n_on, (20, 40, 60))
+ assert_allclose(stat_sum.n_bkg, (10, 14, 26))
+
+
+
