From 87fa4c3088bb9e22da15a829668625e42a93984c Mon Sep 17 00:00:00 2001 From: "ngo-nghi-truyen.huynh" Date: Sat, 20 Apr 2024 23:11:04 +0200 Subject: [PATCH] FIX PR: sort keys in standardize_optmize_options_bounds instead of standardize_net --- smash/core/simulation/_standardize.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/smash/core/simulation/_standardize.py b/smash/core/simulation/_standardize.py index 7166da97..24b09f17 100644 --- a/smash/core/simulation/_standardize.py +++ b/smash/core/simulation/_standardize.py @@ -250,6 +250,8 @@ def _standardize_simulation_optimize_options_bounds( f"included in the feasible domain ]{low}, {upp}[ in bounds optimize_options" ) + bounds = {key: bounds[key] for key in parameters} + return bounds @@ -311,14 +313,13 @@ def _standardize_simulation_optimize_options_descriptor( def _standardize_simulation_optimize_options_net( - model: Model, parameters: np.ndarray, bounds: dict, net: Net | None, **kwargs + model: Model, bounds: dict, net: Net | None, **kwargs ) -> Net: - bounds = {key: bounds[key] for key in parameters} # reorder bounds by parameters - bound_values = list(bounds.values()) - - ncv = len(parameters) nd = model.setup.nd + bound_values = list(bounds.values()) + ncv = len(bound_values) + active_mask = np.where(model.mesh.active_cell == 1) ntrain = active_mask[0].shape[0] @@ -388,7 +389,7 @@ def _standardize_simulation_optimize_options_net( diff = np.not_equal(net_bounds, bound_values) - for i, name in enumerate(parameters): + for i, name in enumerate(bounds.keys()): if diff[i].any(): warnings.warn( f"net optimize_options: Inconsistent value(s) between the bound in scaling layer and "