Skip to content

Commit

Permalink
Avoid too much filtering in observations generation
Browse files Browse the repository at this point in the history
  • Loading branch information
eivindjahren committed Oct 14, 2024
1 parent 921fd3c commit 7d52677
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions tests/ert/unit_tests/config/observations_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

Expand All @@ -164,27 +164,43 @@ 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,
allow_nan=False,
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":
Expand Down

0 comments on commit 7d52677

Please sign in to comment.