Fitting
By Carsten:
In practice, we do not want to have a fit for each separate value of the second (and third) motor position. It makes more sense to do a "projection" by summing all images that have the same second (third) motor position, and then fit the resulting 1D image stack. I guess the logical way would be to have the projection/summation as an independent widget.
The alternative for 2-motor scans is to write a fit function that depends on both motor positions (say m1
and m2
)
Intensity = background + normalization * amplitude * exp[ - 1/2 (m1 - m1_center)^2/(m1_width)^2 - 1/2 (m2 - m2_center)^2/(m2_width)^2 + (m1-m1_center)
(m2-m2_center)
(m1_m2_correlation)]
Fit
background, amplitude, m1_center, m2_center, m1_width, m2_width, m1_m2_correlation. m1_m2_correlation can be positive or negative. If it is zero, the two parameters are uncorrelated. In this way you only get one fit value per pixel.
Residuals
The idea of the residuals was to get a measure of the "goodness" of the fit. What is better (because if gives a single image) is something similar to a Chi-squared = sum over all motor positions (Image- Fit)^2
The 2D COM would be the combination of peak position from the two different projections. (or 3, but that is difficult to plot anyways). The COM calculation sums over all unused motor positions = uses a projection.