ptypy.engines.posref.AnnealingRefine#
- class ptypy.engines.posref.AnnealingRefine(position_refinement_parameters, Cobj, metric='fourier')#
Bases:
PositionRefine- __init__(position_refinement_parameters, Cobj, metric='fourier')#
Annealing Position Refinement. Refines the positions by the following algorithm:
A.M. Maiden, M.J. Humphry, M.C. Sarahan, B. Kraus, J.M. Rodenburg, An annealing algorithm to correct positioning errors in ptychography, Ultramicroscopy, Volume 120, 2012, Pages 64-72 :param position_refinement_parameters: The parameter tree for the refinement :type position_refinement_parameters: ptypy.utils.parameters.Param :param Cobj: The current pbject container object :type Cobj: ptypy.core.classes.Container :param metric: “fourier” or “photon” :type metric: str
Methods
__init__(position_refinement_parameters, Cobj)Annealing Position Refinement.
cleanup()Cleans up every iteration
estimate_fourier_metric(di_view, obj)Calculates error based on DM fourier error estimate.
estimate_photon_metric(di_view, obj)Calculates error based on reduced likelihood estimate.
update_constraints(iteration)update_view_position(di_view)Refines the positions by the following algorithm:
Attributes
citation_dictionary- cleanup()#
Cleans up every iteration
- estimate_fourier_metric(di_view, obj)#
Calculates error based on DM fourier error estimate.
- Parameters:
di_view (ptypy.core.classes.View) – A diffraction view for which we wish to calculate the error.
obj (numpy.ndarray) – The current calculated object for which we wish to evaluate the error against.
- Returns:
The calculated fourier error
- Return type:
np.float
- estimate_photon_metric(di_view, obj)#
Calculates error based on reduced likelihood estimate.
- Parameters:
di_view (ptypy.core.classes.View) – A diffraction view for which we wish to calculate the error.
obj (numpy.ndarray) – The current calculated object for which we wish to evaluate the error against.
- Returns:
The calculated fourier error
- Return type:
np.float
- update_constraints(iteration)#
- Parameters:
iteration (int) – The current iteration of the engine.
- update_view_position(di_view)#
Refines the positions by the following algorithm:
A.M. Maiden, M.J. Humphry, M.C. Sarahan, B. Kraus, J.M. Rodenburg, An annealing algorithm to correct positioning errors in ptychography, Ultramicroscopy, Volume 120, 2012, Pages 64-72
Algorithm Description: Calculates random shifts around the original position and calculates the fourier error. If the fourier error decreased the randomly calculated postion will be used as new position.
- Parameters:
di_view (ptypy.core.classes.View) – A diffraction view that we wish to refine.
- Returns:
A length 2 numpy array with the position increments for x and y co-ordinates respectively
- Return type:
numpy.ndarray