I have got 2 (simulation) data sets and 2 (experimental) reference data sets.
As the simulation was performed numerically, no method/function is known, just the simulation data is available.
The 2 data sets share parameters that I want to extract by fitting simulation to reference data.
I did not find any python functionality to perform such a fitting / minimization / optimization using just data sets instead of a fitting function / model.
Concretely: I have the following: two equations:
e1 = a * s1 + b * t1 + c * u1 and
e2 = a * s2 + b * t2 + c * u2 and
I want to figure out the parameters a, b, c.
e1, e2 are experimental NxN np.arrays (can be visualized in a heatmap or can be considered as f(x,y) ) and
s1, s2, t1, t2, u1, u2 are MxM np.arrays containing simulation data.
I want left and right hand sides of the equations (heatmaps) to be as similar as possible and also consider both equations alike to get to know a, b, c.
It would take effort to make N = M but it could be done. I know, I have to use two models but I only know how to pass matching 1xN experimental and simulation arrays to the models.
I wrote a wrapper around scipy called symfit
which makes this fitting this kind of problem straightforward, so I think you might be interested in using it. Using symfit
for your problem, you could write
from symfit import parameters, variables, Fit, Model
e1, e2, s1, s2, t1, t2, u1, u2 = variables('e1, e2, s1, s2, t1, t2, u1, u2')
a, b, c = parameters('a, b, c')
model = Model({
e1: a * s1 + b * t1 + c * u1,
e2: a * s2 + b * t2 + c * u2,
})
fit = Fit(model, u1=u1data, s1=s1data, ...)
fit_result = fit.execute()
print(fit_result)
See the documentation for more information. Good luck!