Introduction#

Support-Constrained Phase Retrieval#

phastphase is a package for solving the support-constrained phase retrieval problem: Given a set of intensities \(\textbf{y}\), find a complex object \(\textbf{x}\) satisfying:

\[\left| \mathcal{F}\{\textbf{x}\} \right|^2 \approx \textbf{y}\]

Where \(\mathcal{F}\) is the zero padded DFT - i.e. \(\textbf{x}\) is zero-padded to the size of \(\textbf{y}\)

For the problem to be well-posed, the length of \(\textbf{y}\) must be at least twice the length of \(\textbf{x}\) in each dimension. Formally if \(\textbf{m}\) is the shape-tuple of \(\textbf{y}\), and \(\textbf{n}\) is the shape-tuple of \(\textbf{x}\) we must have: \(\textbf{m} \geq 2 \textbf{n}\).

phastphase and Schwarz Objects#

Phase Retrieval is strongly NP-Hard, so only specific instances can be solved efficiently. phastphase works for a class of objects known as Schwarz objects. These are objects defined by the phase of their Z-transforms. To be a Schwarz object, on the poly-Torus there must exist and integer tuple \(\textbf{w}\) such that the Z-transform satisfies.

\[|\text{arg}(X(\textbf{z})) - \text{arg}(\textbf{z}^\textbf{w})| \leq \frac{\pi}{2}\]

\(\textbf{w}\) is known as the “winding tuple” of \(\textbf{x}\) and is automatically determined by phastphase from \(\textbf{y}\).

Why phastphase?#

phastphase implements the Fast Phase Retrieval algorithm, the first polynomial time algorithm to provably succeed at Fourier phase retrieval without requiring phase masks or nearfield information. Other features include:

  • It’s phast! Using GPU acceleration, recoveries take seconds on full-HD images. The underlying algorithm has a worst-case arithmetic complexity of \(O(N\log(N)\) for images with \(N\) pixels.

  • phastphase can use nearfield information if available to broaden the class of objects it can recover.

  • User Friendly! phastphase takes numpy arrays, cupy arrays, and pytorch tensors!

Basic Use#

Phase retrieval can be performed by invoking phastphase.retrieve(). There is only one required argument, the intensities \(\textbf{y}\). However, also supplying the shape tuple of \(\textbf{x}\) is highly encouraged. If the shape tuple of \(\textbf{x}\) is not supplied, the method will assume critical oversampling. The critical sampling assumption appears to work well most of the time, but leads to poor behavior in some cases.