From 37ac3788db401bdbdf1916b75866ae512cb40822 Mon Sep 17 00:00:00 2001 From: Moritz Reiber Date: Tue, 1 Oct 2024 17:17:18 +0200 Subject: [PATCH] fix overwriting of already registered parameters --- hannah/nas/parameters/parametrize.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hannah/nas/parameters/parametrize.py b/hannah/nas/parameters/parametrize.py index 8661a649..24587fd0 100644 --- a/hannah/nas/parameters/parametrize.py +++ b/hannah/nas/parameters/parametrize.py @@ -61,21 +61,21 @@ def init_fn(self, *args, **kwargs): for p in params: n = name + f"_{idx}" self._PARAMETERS[n] = p - elif isinstance(arg, Sequence): + elif isinstance(arg, Sequence): # FIXME: Strings are registered as sequence for idx, param in enumerate(arg): if is_parametrized(param): if isinstance(param, Parameter): if not param.is_registered(): param.register() - n = f"{name}_{idx}" - self._PARAMETERS[n] = param + n = f"{name}_{idx}" + self._PARAMETERS[n] = param if isinstance(param, Expression): params = extract_parameter_from_expression(param) for idx2, p in enumerate(params): if not p.is_registered(): p.register() - n = f"{name}_{idx}_{idx2}" - self._PARAMETERS[n] = p + n = f"{name}_{idx}_{idx2}" + self._PARAMETERS[n] = p for name, arg in kwargs.items(): if isinstance(arg, (list, tuple)):