Ptychography’s additional classes¶
Basic Parameter Structure¶
-
class
proxtoolbox.Problems.ptychography.
Pty
(phi, obj, probe)[source]¶ Bases:
object
In the Ptychography problem phi, the object and the probe do not have the same dimensions. This class combines them into a single data structure. Some standard operators are overloaded for convenience.
Initialization
Parameters: - phi : array_like
The p-th diffraction pattern
- obj : array_like
The object
- probe : array_like
The probe
-
__init__
(phi, obj, probe)[source]¶ Initialization
Parameters: - phi : array_like
The p-th diffraction pattern
- obj : array_like
The object
- probe : array_like
The probe
-
__weakref__
¶ list of weak references to the object (if defined)
ProxOperators¶
-
class
proxtoolbox.Problems.ptychography.
P_rodenburg
(config)[source]¶ Bases:
proxtoolbox.ProxOperators.proxoperators.ProxOperator
Rodenburg’s Ptychography algorithm
Notes
- Done by
- Pär Mattsson, Universität Göttingen, 2013
- Matthew Tam, CARMA Centre, University of Newcastle, 2014
Initialization
-
class
proxtoolbox.Problems.ptychography.
P_rodenburg_probe_fixed
(config)[source]¶ Bases:
proxtoolbox.Problems.ptychography.P_rodenburg
Rodenburg’s Ptychography algorithm
Initialization
-
class
proxtoolbox.Problems.ptychography.
P_thibault_f
(config)[source]¶ Bases:
proxtoolbox.ProxOperators.proxoperators.ProxOperator
Fourier magnitude update for the Thibault et al. algorithm
Initialization
-
class
proxtoolbox.Problems.ptychography.
P_thibault_o
(config)[source]¶ Bases:
proxtoolbox.ProxOperators.proxoperators.ProxOperator
The object update for the Thibault et al. algorithm, with probe fixed
Initialization
-
class
proxtoolbox.Problems.ptychography.
P_thibault_op
(config)[source]¶ Bases:
proxtoolbox.ProxOperators.proxoperators.ProxOperator
The simultaneous probe and object update for the Thibault et al. algorithm
Initialization
-
class
proxtoolbox.Problems.ptychography.
P_PHeBIE_probe
(config)[source]¶ Bases:
proxtoolbox.ProxOperators.proxoperators.ProxOperator
Probe update for the PHeBIE algorithm
Initialization
-
class
proxtoolbox.Problems.ptychography.
P_PHeBIE_probe_ptwise
(config)[source]¶ Bases:
proxtoolbox.Problems.ptychography.P_PHeBIE_probe
Probe update for the PHeBIE algorithm
Initialization
-
class
proxtoolbox.Problems.ptychography.
P_PHeBIE_object
(config)[source]¶ Bases:
proxtoolbox.ProxOperators.proxoperators.ProxOperator
Object update for the PHeBIE algorithm
Initialization
-
class
proxtoolbox.Problems.ptychography.
P_PHeBIE_object_ptwise
(config)[source]¶ Bases:
proxtoolbox.Problems.ptychography.P_PHeBIE_object
Object update for the PHeBIE algorithm
Initialization
-
class
proxtoolbox.Problems.ptychography.
P_PHeBIE_phi
(config)[source]¶ Bases:
proxtoolbox.ProxOperators.proxoperators.ProxOperator
Phi update for the PHeBIE algorithm
Initialization
Statistics¶
-
class
proxtoolbox.Problems.ptychography.
PtychographyStats
(config)[source]¶ Bases:
object
The Ptychography algorithms have special statistics. The necessary routines are collected in this class.
Initialization
-
__weakref__
¶ list of weak references to the object (if defined)
-
_dftregistration
(buf1ft, buf2ft, usfac=1)[source]¶ Efficient subpixel image registration by crosscorrelation.
Parameters: - buf1ft : array_like - Fourier transform of the reference image
- buf2ft : array_like - Fourier transform of the image to register
- usfac : int, optional - Upsampling factor
Returns: - error : number - Translation invariant normalized RMS error between f and g
- diffphase : number - Global phase difference between the two images
- row_shift : number - Pixel shifts between images (rows)
- col_shift : number - Pixel shifts between images (columns)
References
[1] Manuel Guizar-Sicairos, Samuel T. Thurman, James R. Fienup, “Efficient subpixel image registration algorithms”, Opt.Lett. 33, 156-158 (2008)
-
_dftups
(inp, nor=None, noc=None, usfac=1, roff=0, coff=0)[source]¶ Upsampled DFT by matrix multiplications
Parameters: - inp : array_like - Input data
- nor, noc : int, optional - Number of pixels in the output unsampled DFT (Default = inp.shape)
- usfac : number, optional - Upsampling factor (Default = 1)
- roff, coff : int, optional - Row and column offsets (Default = 0)
Returns: - ndarray - DFT
-
change
(x1, x2)[source]¶ Computes the change for x1 and x2
Parameters: - x1 : Pty - Input 1
- x2 : Pty - Input 2
Returns: - float - The change
-
Blocking¶
-
class
proxtoolbox.Problems.ptychography.
Blocking_meta
(config)[source]¶ Bases:
proxtoolbox.Algorithms.algorithms.Algorithm
A meta-algorithm used if a blocking scheme is applied. Although this is probably not the most efficient implementation if blocking schemes, it can be applied independently of the algorithm.
Initialization
-
_do_block
(u, b, tol)[source]¶ Creates and solves the subproblem for the current block
Parameters: - u : Pty - Input data
- b : int - Current block’s index
- tol : number - Tolerance
Returns: - sequence of array_like - A tuple of the form (phi,obj,probe)
-
-
ptychography.
_unwrap_do_block
(**kwarg)¶
-
ptychography.
_unwrap_do_view
(**kwarg)¶
Algorithms¶
-
class
proxtoolbox.Problems.ptychography.
PALM
(config)[source]¶ Bases:
proxtoolbox.Algorithms.algorithms.Algorithm
Proximal alternating (linearized) minimization algorithm
Parameters: - config : dict
Dictionary containing the problem configuration. It must contain the following mappings:
- projector_sequence: sequence of Proxoperator
Sequence of prox operators to be used. (The classes, no instances)
- Nx: int
Row-dim of the product space elements
- Ny: int
Column-dim of the product space elements
- Nz: int
Depth-dim of the product space elements
- dim: int
Size of the product space
- normM: number
?
- ignore_error: boolean
Whether to ignore errors
-
__init__
(config)[source]¶ Parameters: - config : dict
Dictionary containing the problem configuration. It must contain the following mappings:
- projector_sequence: sequence of Proxoperator
Sequence of prox operators to be used. (The classes, no instances)
- Nx: int
Row-dim of the product space elements
- Ny: int
Column-dim of the product space elements
- Nz: int
Depth-dim of the product space elements
- dim: int
Size of the product space
- normM: number
?
- ignore_error: boolean
Whether to ignore errors
-
run
(u, tol, maxiter)[source]¶ Runs the algorithm one some input data
Parameters: - u : array_like - Input data
- tol : number - Tolerance
- maxiter : int - Maximum number of iterations
Returns: - u : array_like - Result
- u_final : array_like - Result
- iters : int - Number of iterations the algorithm performed
- change : array_like - The percentage change in the norm
- gap : array_like - Squared gap distance normalized by the magnitude constraint
-
class
proxtoolbox.Problems.ptychography.
RAAR_PALM
(config)[source]¶ Bases:
proxtoolbox.Algorithms.algorithms.Algorithm
RAAR implementation that produces error statistics comparable to PALM
Parameters: - config : dict
Dictionary containing the problem configuration. It must contain the following mappings:
- projector_sequence: sequence of ProxOperator
Sequence of prox operators to be used. (The classes, no instances). For RAAR_PALM it must contain 2 ProxOperators.
- Nx: int
Row-dim of the product space elements
- Ny: int
Column-dim of the product space elements
- Nz: int
Depth-dim of the product space elements
- dim: int
Size of the product space
- beta0: number
Starting relaxation parmater
- beta_max: number
Maximum relaxation parameter
- beta_switch: int
Iteration at which beta moves from beta0 -> beta_max
- normM: number
?
- ignore_error: boolean
Whether to ignore errors
-
__init__
(config)[source]¶ Parameters: - config : dict
Dictionary containing the problem configuration. It must contain the following mappings:
- projector_sequence: sequence of ProxOperator
Sequence of prox operators to be used. (The classes, no instances). For RAAR_PALM it must contain 2 ProxOperators.
- Nx: int
Row-dim of the product space elements
- Ny: int
Column-dim of the product space elements
- Nz: int
Depth-dim of the product space elements
- dim: int
Size of the product space
- beta0: number
Starting relaxation parmater
- beta_max: number
Maximum relaxation parameter
- beta_switch: int
Iteration at which beta moves from beta0 -> beta_max
- normM: number
?
- ignore_error: boolean
Whether to ignore errors
-
run
(u, tol, maxiter)[source]¶ Runs the algorithm one some input data
Parameters: - u : array_like - Input data
- tol : number - Tolerance
- maxiter : int - Maximum number of iterations
Returns: - tmp_u1 : array_like - Result
- tmp_u1.copy() : array_like - Copy of result
- iters : int - Number of iterations the algorithm performed
- change : array_like - The percentage change in the norm
- custom_errors : array_like - Squared gap distance normalized by the magnitude constraint