From 7d52677812f9eb9796cc7adcf857047b23a3fee1 Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Mon, 14 Oct 2024 14:26:59 +0200 Subject: [PATCH] Avoid too much filtering in observations generation --- .../config/observations_generator.py | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/tests/ert/unit_tests/config/observations_generator.py b/tests/ert/unit_tests/config/observations_generator.py index 22c7723be66..90da212276f 100644 --- a/tests/ert/unit_tests/config/observations_generator.py +++ b/tests/ert/unit_tests/config/observations_generator.py @@ -152,7 +152,7 @@ def general_observations(draw, ensemble_keys, std_cutoff, names): positive_floats = st.floats( - min_value=0.1, max_value=1e25, allow_nan=False, allow_infinity=False + min_value=0.1, max_value=1e9, allow_nan=False, allow_infinity=False ) time_types = st.sampled_from(["date", "days", "restart", "hours"]) @@ -164,7 +164,7 @@ def summary_observations( kws = { "name": draw(names), "key": draw(summary_keys), - "error": draw( + "error_min": draw( st.floats( min_value=std_cutoff, max_value=std_cutoff * 1.1, @@ -172,19 +172,35 @@ def summary_observations( allow_infinity=False, ) ), - "error_min": draw( + "error_mode": draw(st.sampled_from(ErrorMode)), + } + if kws["error_mode"] == ErrorMode.ABS: + kws["error"] = draw( st.floats( min_value=std_cutoff, max_value=std_cutoff * 1.1, allow_nan=False, allow_infinity=False, ) - ), - "error_mode": draw(st.sampled_from(ErrorMode)), - "value": draw(positive_floats), - } - - assume(kws["error_mode"] == ErrorMode.ABS or kws["error"] < 2) + ) + kws["value"] = draw(positive_floats) + else: + kws["error"] = draw( + st.floats( + min_value=0.1, + max_value=2.0, + allow_nan=False, + allow_infinity=False, + ) + ) + kws["value"] = draw( + st.floats( + min_value=(std_cutoff / kws["error"]), + max_value=(std_cutoff / kws["error"]) * 1.1, + allow_nan=False, + allow_infinity=False, + ) + ) time_type = draw(time_types) if time_type == "date":