Skip to content

Commit

Permalink
Rename SMALL_NUMBER with FIRST_POSITIVE_NUMBER
Browse files Browse the repository at this point in the history
Renaming for the sake of clarity - see corresponding comment in PR review.
  • Loading branch information
zsarnoczay authored Nov 22, 2024
1 parent f025231 commit 5072927
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pelicun/uq.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
from pelicun.base import Logger

colorama.init()
SMALL_NUMBER = 1.0e-10
FIRST_POSITIVE_NUMBER = 1.0e-10


def scale_distribution(
Expand Down Expand Up @@ -516,7 +516,7 @@ def _mvn_scale(x: np.ndarray, rho: np.ndarray) -> np.ndarray:
rho_0 = np.eye(n_dims, n_dims)

a = mvn.pdf(x, mean=np.zeros(n_dims), cov=rho_0)
a[a < SMALL_NUMBER] = SMALL_NUMBER
a[a < FIRST_POSITIVE_NUMBER] = FIRST_POSITIVE_NUMBER

b = mvn.pdf(x, mean=np.zeros(n_dims), cov=rho)

Expand Down Expand Up @@ -1429,7 +1429,7 @@ def _ensure_positive_probability_difference(
If a negative probability difference is found.
"""
if np.any((p_b - p_a) < SMALL_NUMBER):
if np.any((p_b - p_a) < FIRST_POSITIVE_NUMBER):
msg = (
'The probability mass within the truncation limits is '
'too small and the truncated distribution cannot be '
Expand Down

0 comments on commit 5072927

Please sign in to comment.