From f46402fd87f33daf2da4050010973bd00b6c5bae Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sun, 19 Jun 2022 09:36:31 -0500 Subject: [PATCH] Adding docstrings to normalize methods --- openmc/stats/univariate.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openmc/stats/univariate.py b/openmc/stats/univariate.py index 6875f4e4f0..bbac4c030f 100644 --- a/openmc/stats/univariate.py +++ b/openmc/stats/univariate.py @@ -142,6 +142,7 @@ class Discrete(Univariate): return np.random.choice(self.x, n_samples, p=self.p) def normalize(self): + """Normalize the probabilities stored on the distribution""" norm = sum(self.p) self.p = [val / norm for val in self.p] @@ -892,6 +893,7 @@ class Tabular(Univariate): return np.cumsum(c) def normalize(self): + """Normalize the probabilities stored on the distribution""" self.p = np.asarray(self.p) / self.cdf().max() def sample(self, n_samples=1, seed=None): @@ -1115,6 +1117,7 @@ class Mixture(Univariate): return out def normalize(self): + """Normalize the probabilities stored on the distribution""" norm = sum(self.probability) self.probability = [val / norm for val in self.probability]