summaryrefslogtreecommitdiff
path: root/lib/paramfit.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2021-03-17 17:56:01 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2021-03-17 17:56:01 +0100
commit53546c9c52b4b45525726babbeb01f7532922783 (patch)
tree7b71e101619134f19a1da57c7dbda99940649294 /lib/paramfit.py
parent162a0c287f5dab664e9168a60d76c9f8da07e46a (diff)
always handle co-dependent parameters
Diffstat (limited to 'lib/paramfit.py')
-rw-r--r--lib/paramfit.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/paramfit.py b/lib/paramfit.py
index eed8eed..8bc7505 100644
--- a/lib/paramfit.py
+++ b/lib/paramfit.py
@@ -29,7 +29,7 @@ class ParallelParamFit:
"""Create a new ParallelParamFit object."""
self.fit_queue = list()
- def enqueue(self, key, param, args):
+ def enqueue(self, key, param, args, kwargs=dict()):
"""
Add state_or_tran/attribute/param_name to fit queue.
@@ -41,7 +41,7 @@ class ParallelParamFit:
:param args: [by_param, param_index, safe_functions_enabled, param_filter]
by_param[(param 1, param2, ...)] holds measurements.
"""
- self.fit_queue.append({"key": (key, param), "args": args})
+ self.fit_queue.append({"key": (key, param), "args": args, "kwargs": kwargs})
def fit(self):
"""
@@ -102,11 +102,11 @@ class ParallelParamFit:
def _try_fits_parallel(arg):
"""
- Call _try_fits(*arg['args']) and return arg['key'] and the _try_fits result.
+ Call _try_fits(*arg['args'], **arg["kwargs"]) and return arg['key'] and the _try_fits result.
Must be a global function as it is called from a multiprocessing Pool.
"""
- return {"key": arg["key"], "result": _try_fits(*arg["args"])}
+ return {"key": arg["key"], "result": _try_fits(*arg["args"], **arg["kwargs"])}
def _try_fits(