From ec1a34c2d448545a26dc005c2842382141bf0bdc Mon Sep 17 00:00:00 2001 From: Feda Curic Date: Fri, 8 Sep 2023 07:42:10 +0200 Subject: [PATCH] Fix bug where truncated normal was not truncated (cherry picked from commit d54ed181370385a0004c26dd18cf21c81a35a738) --- src/ert/config/gen_kw_config.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ert/config/gen_kw_config.py b/src/ert/config/gen_kw_config.py index 1eef206de10..fbc0340170d 100644 --- a/src/ert/config/gen_kw_config.py +++ b/src/ert/config/gen_kw_config.py @@ -332,8 +332,7 @@ def trans_normal(x: float, arg: List[float]) -> float: def trans_truncated_normal(x: float, arg: List[float]) -> float: _mean, _std, _min, _max = arg[0], arg[1], arg[2], arg[3] y = x * _std + _mean - max(min(y, _max), _min) # clamp - return y + return max(min(y, _max), _min) # clamp @staticmethod def trans_lognormal(x: float, arg: List[float]) -> float: