I’m looking for a package or an algorithm, alternatively an explanation of why what I want is impossible or bad:
I have a set of data
x1, y1 ≈ f.(x1) and one
x2, y2 ≈ a*f.(x2) .+ b for some natural black box function
f and constants
a, b. I would like to merge these two datasets by scaling and shifting
y2, essentially finding
b. The physical motivation is, for instance, spectrometry of the same features using different integration times.
If enough of
x2 has “close neighbors” in
x1, this is easy to do decently manually, but I find surprisingly little information on automating the process. My current approach is to minimize wrt
p the sum over each possible pair of points
(x1[i], y1[i]), (x2[j], y2[j]) of the error function
(p*y2+p - y1)^2/(1 + (x2 - x1)^2/w^2)
where the points are weighted by the lorentzian
1/(1 + Δx^2/w^2) of width
w chosen as some multiple of
mean(diff(x)). Results are not great so far.
Has anyone here seen anything similar to this? Image stitching seems adjacent, but not a perfect match.