From 6c3e71385de5d73044aa2bdec051ec0d6a0ef840 Mon Sep 17 00:00:00 2001 From: mbaak Date: Sat, 23 Dec 2023 09:36:04 +0100 Subject: [PATCH 1/2] FIX: numpy random multinomial requires integer number of samples --- phik/simulation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phik/simulation.py b/phik/simulation.py index 9aa68ae..9808774 100644 --- a/phik/simulation.py +++ b/phik/simulation.py @@ -35,7 +35,7 @@ def sim_2d_data(hist:np.ndarray, ndata:int=0) -> np.ndarray: """ if ndata <= 0: - ndata = hist.sum() + ndata = int(np.round(hist.sum())) if ndata <= 0: raise ValueError('ndata (or hist.sum()) has to be positive') From 424b70929dc1a311182f78487d2515cc26ba0a09 Mon Sep 17 00:00:00 2001 From: mbaak Date: Sat, 30 Dec 2023 17:52:13 +0100 Subject: [PATCH 2/2] FIX: implement suggested change --- phik/simulation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phik/simulation.py b/phik/simulation.py index 9808774..1eb8d61 100644 --- a/phik/simulation.py +++ b/phik/simulation.py @@ -35,7 +35,7 @@ def sim_2d_data(hist:np.ndarray, ndata:int=0) -> np.ndarray: """ if ndata <= 0: - ndata = int(np.round(hist.sum())) + ndata = int(np.rint(hist.sum())) if ndata <= 0: raise ValueError('ndata (or hist.sum()) has to be positive')