Several datasets can be fitted simultaneously, either using the BornAgain fit facilities, or using external minimizers.
Add different simulation builders and data to an instance of FitObjective:
fit_objective = ba.FitObjective()
fit_objective.addFitPair(sim_builder1, data1[, weight1])
fit_objective.addFitPair(sim_builder2, data2[, weight2])
Each sim_builder is a callable that takes a parameter dict and returns
a Simulation object. The optional weights default to 1.
For a full example, see Examples > Fitting > Simultaneous fit.
See the honeycomb fit example, where differential evolution is called with an objective function that has contributions from several reflectometry datasets and models:
def objective_function(*args):
...
return <sum of squared relative differences>
result = scipy.optimize.differential_evolution(
objective_function,
...)