summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBirte Kristina Friesel <birte.friesel@uos.de>2023-12-14 09:55:14 +0100
committerBirte Kristina Friesel <birte.friesel@uos.de>2023-12-14 09:55:14 +0100
commit6850114d7bff5867686a9fe151e309a9c5548012 (patch)
treecdb6bcb52d5820004c564e9e369e9ce663c1dbc1 /lib
parentdb9811339c4b7cb1ed6ed7ee72774f3b27edb84c (diff)
_try_fits: make seen_parameter_combinations access more explicit
The filter is likely evaluated lazily enough for this to change nothing, but it's better to be explicit in this case...
Diffstat (limited to 'lib')
-rw-r--r--lib/paramfit.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/paramfit.py b/lib/paramfit.py
index a01cd3e..7a82985 100644
--- a/lib/paramfit.py
+++ b/lib/paramfit.py
@@ -167,9 +167,7 @@ def _try_fits(
# for each parameter combination:
for param_key in filter(
- lambda x: remove_index_from_tuple(x, param_index)
- not in seen_parameter_combinations
- and len(n_by_param[x])
+ lambda x: len(n_by_param[x])
and match_parameter_values(n_by_param[x][0], param_filter),
n_by_param.keys(),
):
@@ -180,6 +178,11 @@ def _try_fits(
# Ensure that each parameter combination is only optimized once. Otherwise, with parameters (1, 2, 5), (1, 3, 5), (1, 4, 5) and param_index == 1,
# the parameter combination (1, *, 5) would be optimized three times, both wasting time and biasing results towards more frequently occuring combinations of non-param_index parameters
+ if (
+ remove_index_from_tuple(param_key, param_index)
+ in seen_parameter_combinations
+ ):
+ continue
seen_parameter_combinations.add(remove_index_from_tuple(param_key, param_index))
# for each value of the parameter denoted by param_index (all other parameters remain the same):