From 25976e908a22e65b780d4bbbe7e88ca79409334f Mon Sep 17 00:00:00 2001 From: Jakob Wessel Date: Wed, 18 Dec 2024 20:31:04 +0000 Subject: [PATCH] Replaced x.size by x.shape to make it work for n-dimensional arrays --- ibicus/utils/_math_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ibicus/utils/_math_utils.py b/ibicus/utils/_math_utils.py index 11851ae..2c753a5 100644 --- a/ibicus/utils/_math_utils.py +++ b/ibicus/utils/_math_utils.py @@ -279,7 +279,7 @@ def cdf(self, x: np.ndarray, *fit: tuple) -> np.ndarray: else: return np.where( x == 0, - np.random.uniform(0, p0, x.size), + np.random.uniform(0, p0, x.shape), p0 + (1 - p0) * self.distribution.cdf(x, *fit_rainy_days), ) @@ -423,7 +423,7 @@ def cdf(self, x: np.ndarray, *fit: tuple) -> np.ndarray: """ x = np.where( x < self.censoring_threshold, - np.random.uniform(0, self.censoring_threshold, x.size), + np.random.uniform(0, self.censoring_threshold, x.shape), x, ) return scipy.stats.gamma.cdf(x, *fit)