slmsuite.holography.analysis.fit_affine
- fit_affine(x, y, guess_affine=None, plot=False)[source]
For two sets of points with equal length, find the best-fit affine transformation that transforms from the first basis to the second. Best fit is defined as minimization on the least squares euclidean norm.
\[\vec{y} = M \cdot \vec{x} + \vec{b}\]- Parameters
x (array_like) – Array of vectors of shape
(2, N)
in the style offormat_2vectors()
.y (array_like) – Array of vectors of shape
(2, N)
in the style offormat_2vectors()
.plot (bool) – Whether to produce a debug plot.
- Returns
A dictionary with fields
"M"
and"b"
.- Return type
dict