Skip to content

Commit 9c85562

Browse files
committed
Model update check
1 parent 88be7e6 commit 9c85562

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

c3/parametermap.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ def set_parameters(self, values: list, opt_map=None) -> None:
216216
for equiv_ids in opt_map:
217217
for par_id in equiv_ids:
218218
key = "-".join(par_id)
219-
model_updated = True if key in self.__par_ids_model else model_updated
219+
# We check if a model parameter has changed
220+
model_updated = key in self.__par_ids_model or model_updated
220221
try:
221222
par = self.__pars[key]
222223
except ValueError as ve:
@@ -231,7 +232,9 @@ def set_parameters(self, values: list, opt_map=None) -> None:
231232
f" {(par.offset + par.scale):.3}."
232233
) from ve
233234
val_indx += 1
234-
if model_updated:
235+
236+
# TODO: This check is too simple. Not every model parameter requires an update.
237+
if model_updated and self.model:
235238
self.model.update_model()
236239

237240
def get_parameters_scaled(self) -> np.ndarray:

0 commit comments

Comments
 (0)