proxtoolbox.proxoperators package¶
This package contains the ProxOperator abstract class and various concrete classes.
Submodules¶
proxtoolbox.proxoperators.ADMM_prox module¶
-
class
proxtoolbox.proxoperators.ADMM_prox.
ADMM_Context
(experiment)[source]¶ Bases:
object
Class containing data and helper functions for ADMM prox operators and ADMM related classes
-
class
proxtoolbox.proxoperators.ADMM_prox.
Prox_primal_ADMM_indicator
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
,proxtoolbox.proxoperators.ADMM_prox.ADMM_Context
Projecting onto physical (object) domain constraints, adapted for the ADMM algorithm This is an approximate projector onto a ball around the data determined by the Kullback-Leibler divergence, as appropriate for Poisson noise. The analysis of such approximate projections was studied in D.R.Luke, “Local Linear Convergence of Approximate Projections onto Regularized Sets”, Nonlinear Analysis, 75(2012):1531–1546.
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Oct 4, 2017.
-
class
proxtoolbox.proxoperators.ADMM_prox.
Approx_Pphase_FreFra_ADMM_Poisson
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
,proxtoolbox.proxoperators.ADMM_prox.ADMM_Context
Prox operator for computing the update to the auxilliary variables in the ADMM scheme subject to constraints in the image domain (the intensity measurements in the Fresnel/Fraunhofer domain.
The projection onto the data constraints is an approximate projector onto a ball around the data determined by the Kullback-Leibler divergence, as appropriate for Poisson noise. The analysis of such approximate projections was studied in D.R.Luke, “Local Linear Convergence of Approximate Projections onto Regularized Sets”, Nonlinear Analysis, 75(2012):1531–1546.
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Oct 4, 2017.
-
eval
(u, prox_idx=None)[source]¶ Projection onto the data constraints
Parameters: - u : cell
Image in the physical domain to be projected. assumed here to be a cell, the first element of which project onto the amplitude constraints
- prox_idx : int, optional
Index of this prox operator
Returns: - u_image : cell
The projection in the same format as u.
-
proxtoolbox.proxoperators.Approx_Pphase_FreFra_Poisson module¶
-
class
proxtoolbox.proxoperators.Approx_Pphase_FreFra_Poisson.
Approx_Pphase_FreFra_Poisson
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
Prox operator implementing projection onto Fourier magnitude constraints in the near field or far field with Poisson noise.
This is an approximate projector onto a ball around the data determined by the Kullback-Leibler divergence, as appropriate for Poisson noise. The analysis of such approximate projections was studied in D.R.Luke, “Local Linear Convergence of Approximate Projections onto Regularized Sets”, Nonlinear Analysis, 75(2012):1531–1546.
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) around Oct 3, 2017.
-
eval
(u, prox_idx=None)[source]¶ Projection onto Fourier magnitude constraints in the near field or far field with Poisson noise.
Parameters: - u : array-like
Function in the physical domain to be projected
- prox_idx : int, optional
Index of this prox operator
Returns: - u_new : array_like
The projection in the physical (time) domain in the same format as u.
-
proxtoolbox.proxoperators.CT_prox module¶
-
class
proxtoolbox.proxoperators.CT_prox.
CT_ProxOperator
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
Base class for CT prox operators
-
class
proxtoolbox.proxoperators.CT_prox.
P_hyperplane
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.CT_prox.CT_ProxOperator
Projection onto hyperplane
-
class
proxtoolbox.proxoperators.CT_prox.
P_sequential_hyperplane_odd
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.CT_prox.CT_ProxOperator
Hyperplane projection subroutine of the ART method for tomographic reconstruction of a density profile.
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on May 29, 2012.
-
class
proxtoolbox.proxoperators.CT_prox.
P_sequential_hyperplane_even
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.CT_prox.CT_ProxOperator
Hyperplane projection subroutine of the ART method for tomographic reconstruction of a density profile.
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on May 29, 2012.
proxtoolbox.proxoperators.P_Amod module¶
-
class
proxtoolbox.proxoperators.P_Amod.
P_Amod
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
Projection onto support constraints
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on June 1, 2017.
-
eval
(u, prox_idx=None)[source]¶ Projects the input data onto support constraints.
Parameters: - u : ndarray
Function in the physical domain to be projected
- prox_idx : int, optional
Index of this prox operator
Returns: - p_A : ndarray
The projection in the physical (time) domain. Leaves the phase alone on the support, resets amplitude to 1 and sets amplitude to 1 with 0 phase outside support
-
proxtoolbox.proxoperators.P_CDP module¶
-
class
proxtoolbox.proxoperators.P_CDP.
P_CDP
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
Prox operator that projects onto Fourier magnitude constraints with nonunitary, but invertible masks.
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Sept. 27, 2016.
proxtoolbox.proxoperators.P_M module¶
-
class
proxtoolbox.proxoperators.P_M.
P_M
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
Projection onto Fourier magnitude constraints
Initialization
Parameters: - config : dict - Dictionary containing the problem configuration. It must contain the following mapping:
- ‘M’ : array_like - non-negative real FOURIER DOMAIN CONSTRAINT
-
class
proxtoolbox.proxoperators.P_M.
P_M_masked
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.P_M.P_M
Projection onto Fourier magnitude constraints, leaving alone points masked by ‘fmask’
Initialization
Parameters: - experiment: experiment class
proxtoolbox.proxoperators.P_SP module¶
-
class
proxtoolbox.proxoperators.P_SP.
P_SP
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
Projection onto nonnegativity and support constraints
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on May 23, 2002.
proxtoolbox.proxoperators.P_Sparsity module¶
-
class
proxtoolbox.proxoperators.P_Sparsity.
P_Sparsity
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
Projection subroutine for projecting onto a sparsity constraint
Initialization
Parameters: - config : dict - Dictionary containing the problem configuration. It must contain the following mappings:
- ‘sparsity_parameter’ : int
-
class
proxtoolbox.proxoperators.P_Sparsity.
P_Sparsity_real
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.P_Sparsity.P_Sparsity
Projection subroutine for projecting onto a combined sparsity and realness constraint
order: realness, sparsity
Initialization
Parameters: - config : dict - Dictionary containing the problem configuration. It must contain the following mappings:
- ‘sparsity_parameter’ : int
-
class
proxtoolbox.proxoperators.P_Sparsity.
P_Sparsity_Symmetric
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.P_Sparsity.P_Sparsity
Projection subroutine for projecting onto a combined sparsity and symmetry constraint
order: symmetry, sparsity
-
class
proxtoolbox.proxoperators.P_Sparsity.
P_Sparsity_Symmetric_real
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.P_Sparsity.P_Sparsity_Symmetric
Projection subroutine for projecting onto a combined symmetry, sparsity and realness constraint
order: realness, symmetry, sparsity
-
class
proxtoolbox.proxoperators.P_Sparsity.
P_Sparsity_Superpixel
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.P_Sparsity.P_Sparsity
Apply sparsity on superpixels, i.e. on the binned array
-
class
proxtoolbox.proxoperators.P_Sparsity.
P_Sparsity_Superpixel_real
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.P_Sparsity.P_Sparsity_Superpixel
Apply real-valued sparsity on superpixels, i.e. on the binned array
proxtoolbox.proxoperators.P_amp_support module¶
-
class
proxtoolbox.proxoperators.P_amp_support.
P_amp_support
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
Projection onto support constraints
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on July 26, 2011.
-
eval
(u, prox_idx=None)[source]¶ Projects the input data onto support constraints. ‘abs_illumination’ is the object domain constraint (0-1 indicator function)
Parameters: - u : ndarray or a list of ndarray objects
Input data to be projected
- prox_idx : int, optional
Index of this prox operator
Returns: - p_amp : ndarray or a list of ndarray objects
The projection
-
proxtoolbox.proxoperators.P_avg module¶
-
class
proxtoolbox.proxoperators.P_avg.
P_avg
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
Projection onto the diagonal, averaging the input
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Feb. 19, 2018.
-
eval
(u, prox_index=None)[source]¶ Averages the input u. This is a projection onto onto the diagonal of a product space, but this routine dow not use that structure. The only difference with P_Diag is that the output is not copied onto the diagonal of the implicit product spcace.
Parameters: - u : ndarray a list of ndarray objects
Input data to be projected
- prox_idx : int, optional
Index of this prox operator
Returns: - u_avg : ndarray or a list of ndarray objects
The projection, the average.
-
proxtoolbox.proxoperators.P_diag module¶
-
class
proxtoolbox.proxoperators.P_diag.
P_diag
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
Projection onto the diagonal of a product space
-
eval
(u, prox_idx=None)[source]¶ Projects the input data onto the diagonal of the product space given by its dimensions.
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on July 26, 2011.
Parameters: - u : ndarray or a list of ndarray objects
Input data to be projected
- prox_idx : int, optional
Index of this prox operator
Returns: - u_diag : ndarray or a list of ndarray objects
The projection
-
proxtoolbox.proxoperators.Prox_product_space module¶
-
class
proxtoolbox.proxoperators.Prox_product_space.
Prox_product_space
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
Prox operator that projects onto constraints arranged in a product space.
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Oct 26, 2017.
-
eval
(u, prox_index=None)[source]¶ Projection subroutine onto constraints arranged in a product space.
Parameters: - u : ndarray or a list of ndarray objects
Input data to be projected
- prox_idx : int, optional
Index of this prox operator
Returns: - u_new : ndarray or a list of ndarray objects
The projection, in the product space.
-
proxtoolbox.proxoperators.propagators module¶
-
class
proxtoolbox.proxoperators.propagators.
PropagatorFFTn
(experiment)[source]¶ Bases:
object
Basic propagator which uses the n-dimensional fourier transform, transforming over all axes by default
Intialize propagator
Parameters: experiment – experiment class, can be used to pass options as attributes of the class
-
class
proxtoolbox.proxoperators.propagators.
InvPropagatorFFTn
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.propagators.PropagatorFFTn
Basic inverse propagator which uses the inverse n-dimensional fourier transform, transforming over all axes by default
Intialize propagator
Parameters: experiment – experiment class, can be used to pass options as attributes of the class
-
class
proxtoolbox.proxoperators.propagators.
PropagatorFFT2
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.propagators.PropagatorFFTn
Basic propagator which uses the two-dimensional fourier transform
Intialize propagator
Parameters: experiment – experiment class, can be used to pass options as attributes of the class
-
class
proxtoolbox.proxoperators.propagators.
InvPropagatorFFT2
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.propagators.PropagatorFFT2
Basic inverse propagator which uses the inverse two-dimensional fourier transform
Intialize propagator
Parameters: experiment – experiment class, can be used to pass options as attributes of the class
-
class
proxtoolbox.proxoperators.propagators.
Propagator_FreFra
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.propagators.Propagator_FreFra_Base
Propagator for near field or far field Fourier measurements.
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) around Jan 23, 2019.
-
eval
(u, prox_idx=None)[source]¶ Propagation function for near field or far field Fourier measurements.
Parameters: - u : array_like
Function in the physical domain to be projected
- prox_idx : int, optional
Index of the prox operator calling this method
Returns: - u_hat : array_like
the propagated field at the measurement plane
-
-
class
proxtoolbox.proxoperators.propagators.
InvPropagator_FreFra
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.propagators.Propagator_FreFra_Base
Inverse propagator for near field or far field Fourier measurements
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) around Jan 23, 2019.
-
eval
(p_Mhat, prox_idx=None)[source]¶ Inverse propagation function for near field or far field Fourier measurements.
Parameters: - p_Mhat : array_like
Function in the measurement plane to be propagated back to the physical plane
- prox_idx : int, optional
Index of the prox operator calling this method
Returns: - u_new : array_like
Propagated field at the object plane
-
proxtoolbox.proxoperators.proxoperator module¶
-
class
proxtoolbox.proxoperators.proxoperator.
ProxOperator
(experiment)[source]¶ Bases:
object
Generic interface for prox operators
Initialization method for a concrete instance
Parameters: - experiment : instance of Experiment class
Experiment object that will use this prox operaror
-
eval
(u, prox_idx=None)[source]¶ Applies a prox operator to some input data
Parameters: - u : ndarray or a list of ndarray objects
Input data to be projected
- prox_idx : int, optional
Index of this prox operator
Returns: - ndarray or a list of ndarray objects
Result of the application of the prox operator onto the input data
-
proxtoolbox.proxoperators.proxoperator.
magproj
(constr, u)[source]¶ Projection operator onto a magnitude constraint.
Inexact, but stable implementation of magnitude projection. See LukeBurkeLyon, SIREV 2002.
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on July 24, 2001.
Parameters: - constr : array_like
A nonnegative array that is the magnitude constraint.
- u : array_like
The function to be projected onto constr (can be complex).
Returns: - array_like
The projection.
proxtoolbox.proxoperators.ptychographyProx module¶
-
class
proxtoolbox.proxoperators.ptychographyProx.
ExplicitPtychographyProxOperator
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
Base class for Ptychography explicit prox opertaors
-
class
proxtoolbox.proxoperators.ptychographyProx.
Explicit_ptychography_scan_farfield_probe_ptwise
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.ptychographyProx.ExplicitPtychographyProxOperator
The probe update for the PHeBIE algorithm
Ref.: “Proximal Heterogeneous Block Implicit-Explicit Method and Application to Blind Ptychographic Diffraction Imaging”, R. Hesse, D. R. Luke, S. Sabach and M. K. Tam, SIAM J. on Imaging Sciences, 8(1):426–457 (2015).
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on 16th February 2019.
-
eval
(u, prox_idx=None)[source]¶ Evaluate this prox operator
Parameters: - u : Cell
Iterate. Assumes u[0] is the probe, u[1] is the object, u[2] is the block of variables (product space) satisfying the intensity measurements
- prox_idx : int, optional
Index of this prox operator
Returns: - u_new : Cell
The projection.
-
-
class
proxtoolbox.proxoperators.ptychographyProx.
Explicit_ptychography_scan_farfield_object_ptwise
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.ptychographyProx.ExplicitPtychographyProxOperator
The object update for the PHeBIE algorithm
Ref.: “Proximal Heterogeneous Block Implicit-Explicit Method and Application to Blind Ptychographic Diffraction Imaging”, R. Hesse, D. R. Luke, S. Sabach and M. K. Tam, SIAM J. on Imaging Sciences, 8(1):426–457 (2015).
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on 16th February 2019.
-
eval
(u, prox_idx=None)[source]¶ Evaluate this prox operator
Parameters: - u : Cell
Iterate. Assumes u[0] is the probe, u[1] is the object, u[2] is the block of variables (product space) satisfying the intensity measurements
- prox_idx : int, optional
Index of this prox operator
Returns: - u_new : Cell
The projection.
-
-
class
proxtoolbox.proxoperators.ptychographyProx.
Explicit_ptychography_image
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.ptychographyProx.ExplicitPtychographyProxOperator
This is the argument of the projection in Step 3 of Algorithm 4.1 of “Proximal Heterogeneous Block Implicit-Explicit Method and Application to Blind Ptychographic Diffraction Imaging”, R. Hesse, D. R. Luke, S. Sabach and M. K. Tam, SIAM J. on Imaging Sciences, 8(1):426–457 (2015).
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on 16th February 2019.
-
eval
(u, prox_idx=None)[source]¶ Evaluate this prox operator
Parameters: - u : Cell
Iterate. Assumes u[0] is the probe, u[1] is the object, u[2] is the block of variables (product space) satisfying the intensity measurements
- prox_idx : int, optional
Index of this prox operator
Returns: - u_new : Cell
The projection.
-
-
class
proxtoolbox.proxoperators.ptychographyProx.
P_ptychography_scan_farfield_probe
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
The probe update for the PHeBIE algorithm Ref.: “Proximal Heterogeneous Block Implicit-Explicit Method and Application to Blind Ptychographic Diffraction Imaging”, R. Hesse, D. R. Luke, S. Sabach and M. K. Tam, SIAM J. on Imaging Sciences, 8(1):426–457 (2015).
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on 16th February 2019.
-
class
proxtoolbox.proxoperators.ptychographyProx.
P_supp_amp_band
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
The object update for the PHeBIE algorithm Ref.: “Proximal Heterogeneous Block Implicit-Explicit Method and Application to Blind Ptychographic Diffraction Imaging”, R. Hesse, D. R. Luke, S. Sabach and M. K. Tam, SIAM J. on Imaging Sciences, 8(1):426–457 (2015).
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on 16th February 2019.
-
class
proxtoolbox.proxoperators.ptychographyProx.
Prox_ptychography_ptwise_diag
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.ptychographyProx.ExplicitPtychographyProxOperator
The object update for the PHeBIE algorithm
Ref.: “Proximal Heterogeneous Block Implicit-Explicit Method and Application to Blind Ptychographic Diffraction Imaging”, R. Hesse, D. R. Luke, S. Sabach and M. K. Tam, SIAM J. on Imaging Sciences, 8(1):426–457 (2015).
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on 16th February 2019.
-
eval
(u, prox_idx=None)[source]¶ Evaluate this prox operator
Parameters: - u : Cell
Cell of arrays in the domain to be projected. Assumes u[1] is the object, u[2] is the block of variables (product space) satisfying the intensity measurements
- prox_idx : int, optional
Index of this prox operator
Returns: - u_new : Cell
The projection.
-
-
class
proxtoolbox.proxoperators.ptychographyProx.
Prox_ptychography_product_space
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.ptychographyProx.ExplicitPtychographyProxOperator
Projection subroutine onto constraints arranged in a product space
Based on Matlab code written by Russell Luke (Inst. Fuer Numerische und Angewandte Mathematik, Universitaet Gottingen) on Oct 26, 2017.
-
eval
(u, prox_idx=None)[source]¶ Evaluate this prox operator
Parameters: - u : Cell
Cell of arrays in the domain to be projected. Assumes u[1] is the object, u[2] is the block of variables (product space) satisfying the intensity measurements.
- prox_idx : int, optional
Index of this prox operator
Returns: - u_new : Cell
The projection, a cell of arrays in the product space
-
proxtoolbox.proxoperators.sudokuProx module¶
-
class
proxtoolbox.proxoperators.sudokuProx.
SudokuProx
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.proxoperator.ProxOperator
Projection onto the given entries in a Sudoku problem
-
class
proxtoolbox.proxoperators.sudokuProx.
ProjGiven
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.sudokuProx.SudokuProx
Projection onto the given entries in a Sudoku problem
-
class
proxtoolbox.proxoperators.sudokuProx.
ProjSquare
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.sudokuProx.SudokuProx
Projection onto the given entries in a Sudoku problem
-
class
proxtoolbox.proxoperators.sudokuProx.
ProjColumn
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.sudokuProx.SudokuProx
Projection onto the given entries in a Sudoku problem
-
class
proxtoolbox.proxoperators.sudokuProx.
ProjRow
(experiment)[source]¶ Bases:
proxtoolbox.proxoperators.sudokuProx.SudokuProx
Projection onto the given entries in a Sudoku problem