update_translations_gs

pyrost.bin.update_translations_gs(signatures, args, kwargs, defaults)

Update the sample pixel translations by minimizing total mean-squared-error (:math:$MSE_{total}$). Perform a grid search within the search window of sw_ss size in pixels for sample translations along the slow axis, and of sw_fs size in pixels for sample translations along the fast axis in order to minimize the total MSE.

Parameters
  • I_n (numpy.ndarray) – Measured intensity frames.

  • W (numpy.ndarray) – Measured frames’ whitefield.

  • I0 (numpy.ndarray) – Reference image of the sample.

  • u (numpy.ndarray) – The pixel mapping between the data at the detector’s plane and the reference image at the reference plane.

  • di (numpy.ndarray) – Initial sample’s translations along the slow detector axis in pixels.

  • dj (numpy.ndarray) – Initial sample’s translations along the fast detector axis in pixels.

  • sw_ss (int) – Search window size in pixels along the slow detector axis.

  • sw_fs (int) – Search window size in pixels along the fast detector axis.

  • ls (float) – Reference image length scale in pixels.

Returns

dij – Updated sample pixel translations.

Return type

numpy.ndarray

Notes

The following error metric is being minimized:

\[MSE_{total} = \frac{1}{N M}\sum_{i, j} \left( \frac{\sum_{n} \left( I_g[n] - I_{ref}[ii_n, jj_n] \right)^2}{\sum_{n} \left(I_g[n] - 1 \right)^2} \right)\]

Where \(I_g[n]\) is a kriged intensity profile of the particular detector coordinate \(I_n[n, i, j]\). Intensity profile \(I_n[n, i, j]\) is kriged with gaussian radial basis function \(\phi\):

\[I_g[n] = \frac{\sum_{\Delta i, \Delta j} I_n[n, i + \Delta i, j + \Delta j] W[i + \Delta i, j + \Delta j] \phi[\Delta u[0], \Delta u[1]]} {\sum_{\Delta i, \Delta j} W[i + \Delta i, j + \Delta j]^2 \phi[\Delta u[0], \Delta u[1]]}\]
\[\Delta u[0] = u[0, i + \Delta i, j + \Delta j] - u[0, i, j]\]
\[\Delta u[1] = u[1, i + \Delta i, j + \Delta j] - u[1, i, j]\]
\[\phi [\Delta ii_{ref}, \Delta jj_{ref}] = \exp\left[{-\frac{(\Delta ii_{ref})^2 + (\Delta jj_{ref})^2}{ls^2}}\right]\]