Skip to content

Commit

Permalink
feat: allow normalizing of sampled values in latin hypercube
Browse files Browse the repository at this point in the history
  • Loading branch information
mdtanker committed Nov 19, 2024
1 parent 7bd98e9 commit b01c210
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/invert4geom/uncertainty.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,19 @@ def create_lhc(

# add sampled values to parameters dict
for j, (k, v) in enumerate(param_dict.items()):
if v.get("norm_limits", None) is not None:
norm_limits = v["norm_limits"]
lhc.samples[:, j] = utils.normalize(
lhc.samples[:, j],
low=norm_limits[0],
high=norm_limits[1],
)
if v.get("log", False) is True:
v["sampled_values"] = 10 ** lhc._samples[:, j] # pylint: disable=protected-access
else:
v["sampled_values"] = lhc.samples[:, j] # pylint: disable=protected-access
if v.get("dtype", None) is int:
v["sampled_values"] = v["sampled_values"].round().astype(int)

log.info(
"Sampled '%s' parameter values; mean: %s, min: %s, max: %s",
Expand Down

0 comments on commit b01c210

Please sign in to comment.