Overview
BcdiMeso implements phase retrieval in operator-style format. This means that the multiplication (*) and power (^) operators are used to apply operators to some current state. This may look like the following:
state = State(intens, gVecs, recSupport, x, y, z, rho, ux, uy, uz)
optimizeState = OptimizeState(state, primitiveRecipLattice, numPeaks)
optimizeState^100 * state
This short script applies 100 stochastic gradient descent iterations iterations. This makes it easy to implement very complex recipes for phase retrieval algorithms.
API
BcdiMeso.State
— TypeState(intensities, gVecs, recSupport, x, y, z, rho, ux, uy, uz)
Create the reconstruction state. intensities
is a vector of fully measured diffraction peaks, gVecs
is a vector of peak locations, and recSupport
is a vector of masks over the intensities that removes those intenities from the reconstruction process. The positions of real space points (x
, y
, and z
) must be passed in as well as the magnitude of the electron density rho
and the displacement field (ux
, uy
, and uz
).
The initialization process shifts each peak to be centered (i.e. the center of mass of the peak is moved to the center of the image).
BcdiMeso.OptimizeState
— TypeOptimizeState(state, primitiveRecipLattice, numPeaks)
Create an object that performs an iteration of stochastic gradient descent. numPeaks
number of peaks are selected randomly. One step of gradient descent is taken using the More-Thuente linesearch.
This implimentation takes into account effects of small angle measurement usually ignored in the BCDI problem. This is described in [1] although this implimentation will be faster because a NUFFT is used instead of many FFTs.