pypty.dpc¶
get_curl
¶
Compute the standard deviation of the curl of a rotated DPC vector field. This is the objective function for minimization. This particular function was copied from a DPC plugin written by Jordan Hachtel.
| PARAMETER | DESCRIPTION |
|---|---|
angle
|
Rotation angle in radians.
TYPE:
|
dpcx
|
X-component of the DPC signal.
TYPE:
|
dpcy
|
Y-component of the DPC signal.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Standard deviation of the curl after rotation. |
get_curl_derivative
¶
Compute the derivative of the curl-based objective function with respect to rotation angle.
| PARAMETER | DESCRIPTION |
|---|---|
angle
|
Rotation angle in radians.
TYPE:
|
dpcx
|
X-component of the DPC signal.
TYPE:
|
dpcy
|
Y-component of the DPC signal.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Derivative of the curl-based objective function. |
GetPLRotation
¶
Estimate rotation angle that minimizes the curl of the DPC signal.
| PARAMETER | DESCRIPTION |
|---|---|
dpcx
|
X-component of the DPC signal (2D array).
TYPE:
|
dpcy
|
Y-component of the DPC signal (2D array).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
float
|
Optimal rotation angle in radians. |
fft_based_dpc
¶
FFT-based DPC phase reconstruction. If you setted up the pypty_params properly, you would only need to specify the hpass and lpass values, both are non-negative floats.
| PARAMETER | DESCRIPTION |
|---|---|
pypty_params
|
PyPty parameter dictionary with dataset and calibration settings.
TYPE:
|
hpass
|
High-pass filtering coefficient (default is 0).
TYPE:
|
lpass
|
Low-pass filtering coefficient (default is 0).
TYPE:
|
save
|
Whether to save the reconstructed phase (default is False).
TYPE:
|
comx
|
Precomputed center-of-mass x-component.
TYPE:
|
comy
|
Precomputed center-of-mass y-component.
TYPE:
|
plot
|
If True, display the phase reconstruction.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
pot
|
Reconstructed 2D phase image.
TYPE:
|
pypty_params
|
Updated parameter dictionary with computed COM and rotation angle.
TYPE:
|
iterative_dpc
¶
Iterative DPC phase reconstruction. If you setted up the pypty_params properly, you would only need to specify the hpass and lpass values, both are non-negative floats.
| PARAMETER | DESCRIPTION |
|---|---|
pypty_params
|
PyPty parameter dictionary.
TYPE:
|
num_iterations
|
Number of gradient descent iterations (default is 100).
TYPE:
|
beta
|
Step reduction factor for backtracking (default is 0.5).
TYPE:
|
hpass
|
High-pass filtering coefficient (default is 0).
TYPE:
|
lpass
|
Low-pass filtering coefficient (default is 0).
TYPE:
|
step_size
|
Initial gradient descent step size (default is 0.1).
TYPE:
|
COMx
|
X-component of COM map.
TYPE:
|
COMy
|
Y-component of COM map.
TYPE:
|
px_size
|
Scan step size in Ångströms.
TYPE:
|
print_flag
|
Whether to print progress information (default is False).
TYPE:
|
save
|
Whether to save the result to disk (default is False).
TYPE:
|
select
|
Optional binary mask to constrain reconstruction.
TYPE:
|
plot
|
If True, plot the reconstruction result.
TYPE:
|
use_backtracking
|
Whether to use backtracking line search (default is True).
TYPE:
|
pad_width
|
Padding width to suppress FFT boundary artifacts (default is 5).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
padded_phase
|
Reconstructed 2D phase image.
TYPE:
|
iterative_poisson_solver
¶
Iterative solver for Poisson equation given a Laplacian map.
| PARAMETER | DESCRIPTION |
|---|---|
laplace
|
Input 2D array representing the Laplacian of the desired phase.
TYPE:
|
num_iterations
|
Number of iterations (default is 100).
TYPE:
|
beta
|
Step size reduction factor (default is 0.5).
TYPE:
|
hpass
|
High-pass filtering parameter (default is 0).
TYPE:
|
lpass
|
Low-pass filtering parameter (default is 0).
TYPE:
|
select
|
Optional binary mask to restrict updates.
TYPE:
|
px_size
|
Pixel size in Ångströms (default is 1).
TYPE:
|
print_flag
|
If True, print convergence status (default is False).
TYPE:
|
step_size
|
Initial gradient descent step size (default is 0.1).
TYPE:
|
use_backtracking
|
Whether to use backtracking line search (default is True).
TYPE:
|
pad_width
|
Number of pixels to pad around the solution (default is 1).
TYPE:
|
xp
|
Backend array library (NumPy or CuPy, default is NumPy).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ndarray
|
Reconstructed 2D phase from the input Laplacian. |