update_pixel_map_nm¶
-
pyrost.bin.update_pixel_map_nm(signatures, args, kwargs, defaults)¶ Update the pixel mapping by minimizing mean-squared-error (MSE). Perform an iterative Newton’s method within the search window of sw_ss, sw_fs size along the slow and fast axes accordingly in order to minimize the MSE. only works with 1D scans.
- 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) – Initial pixel mapping.
di (numpy.ndarray) – Sample’s translations along the slow detector axis in pixels.
dj (numpy.ndarray) – 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.
max_iter (int, optional) – Maximum number of iterations.
x_tol (float, optional) – Tolerance for termination by the change of u.
- Returns
u – Updated pixel mapping array.
- Return type
Notes
update_pixel_map_nm()employs finite difference of MSE instead of conventional numerical derivative. Finite difference yields smaller variance in the case of noise present in the data [MW]:\[\varepsilon (h) = \frac{f(x + h) - f(x)}{h}\]Where variance is minimized if \(h = h_M\):
\[h_M = 8^{0.25} \sqrt{\frac{\mathrm{Var}[f]} {\left| \max{f^{\prime\prime}} \right|}}\]See also
update_pixel_map_gsDescription of error metric which is being minimized.
References
- MW
Jorge J. Moré, and Stefan M. Wild, “Estimating Derivatives of Noisy Simulations”, ACM Trans. Math. Softw., Vol. 38, Number 3, April 2012.