Skip to content
Snippets Groups Projects
Commit 5265bd32 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

wrapped for Py

parent 7b19ac42
No related branches found
No related tags found
1 merge request!1966provide FitObjective::addFitPair, to replace addSimulationAndData
......@@ -188,6 +188,27 @@ class ObserverCallbackWrapper(PyObserverCallback):
self.callback_container.append(wrp)
return self.addSimulationAndData_cpp(wrp, data, *args, **kwargs)
def addFitPair(self, callback, expData, *args):
"""
Sets simulation and experimental data to the fit objective.
Optionally accepts experimental data uncertainties and
user-defined dataset weight.
Arguments:
callback -- user-defined function returning fully-defined bornagain.ISimulation object.
The function must use fit parameter dictionary as its input.
expData -- Datafield containing experimental data.
weight -- user-defined weight of the dataset. If not specified, defaults to 1.0.
"""
if not hasattr(self, 'callback_container'):
self.callback_container = []
wrp = SimulationBuilderWrapper(callback)
self.callback_container.append(wrp) # needed ???
return self.addFitPair_cpp(wrp, data, *args)
def convert_params(self, params):
"""
Converts parameters to what FitObjective::evaluate expects
......
......@@ -2451,6 +2451,27 @@ class FitObjective(object):
self.callback_container.append(wrp)
return self.addSimulationAndData_cpp(wrp, data, *args, **kwargs)
def addFitPair(self, callback, expData, *args):
"""
Sets simulation and experimental data to the fit objective.
Optionally accepts experimental data uncertainties and
user-defined dataset weight.
Arguments:
callback -- user-defined function returning fully-defined bornagain.ISimulation object.
The function must use fit parameter dictionary as its input.
expData -- Datafield containing experimental data.
weight -- user-defined weight of the dataset. If not specified, defaults to 1.0.
"""
if not hasattr(self, 'callback_container'):
self.callback_container = []
wrp = SimulationBuilderWrapper(callback)
self.callback_container.append(wrp) # needed ???
return self.addFitPair_cpp(wrp, data, *args)
def convert_params(self, params):
"""
Converts parameters to what FitObjective::evaluate expects
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment