diff options
author | Birte Kristina Friesel <birte.friesel@uos.de> | 2024-01-22 16:02:29 +0100 |
---|---|---|
committer | Birte Kristina Friesel <birte.friesel@uos.de> | 2024-01-22 16:02:29 +0100 |
commit | f4c6b5e18d0e57c5346903a453a3343909f49228 (patch) | |
tree | 416f9a92054acc7c504a82820c3180753bc5969a /lib | |
parent | 944abc8a150ab6a92ec3e1cdacf8797093123c82 (diff) |
Support LUT model independent of --skip-param-stats
Diffstat (limited to 'lib')
-rw-r--r-- | lib/model.py | 6 | ||||
-rw-r--r-- | lib/parameters.py | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/model.py b/lib/model.py index dadbe02..8f93bd3 100644 --- a/lib/model.py +++ b/lib/model.py @@ -261,11 +261,7 @@ class AnalyticModel: for k, v in attr.items(): static_model[name][k] = v.get_static(use_mean=use_mean) lut_model[name][k] = dict() - if not v.by_param: - raise RuntimeError( - f"ModelAttribute({name}, {k}).by_param is None. Did you run ParallelParamStats.compute?" - ) - for param, model_value in v.by_param.items(): + for param, model_value in v.get_by_param().items(): lut_model[name][k][param] = v.get_lut(param, use_mean=use_mean) def lut_median_getter(name, key, **kwargs): diff --git a/lib/parameters.py b/lib/parameters.py index 667bcae..7cb1314 100644 --- a/lib/parameters.py +++ b/lib/parameters.py @@ -583,7 +583,7 @@ class ModelAttribute: self.median = None # LUT model used as upper bound of model accuracy - self.by_param = None # set via ParallelParamStats + self.by_param = None # set via ParallelParamStats or get_by_param # param model override self.function_override = None @@ -825,6 +825,11 @@ class ModelAttribute: return np.mean(self.by_param[param]) return np.median(self.by_param[param]) + def get_by_param(self): + if self.by_param is None: + self.by_param = partition_by_param(self.data, self.param_values) + return self.by_param + def get_data_for_paramfit(self, safe_functions_enabled=False): ret = list() for param_index, param_name in enumerate(self.param_names): |