correct_global_phase#

deepinv.optim.phase_retrieval.correct_global_phase(x_recon, x, threshold=1e-5, verbose=False)[source]#

Corrects the global phase of the reconstructed image.

Warning

Do not mix the order of the reconstructed and original images since this function modifies x_recon in place.

The global phase shift is comptued per image and per channel as:

\[e^{-i \phi} = \frac{\conj{\hat{x}} \cdot x}{|x|^2},\]

where \(\conj{\hat{x}}\) is the complex conjugate of the reconstructed image, \(x\) is the reference image, and \(|x|^2\) is the squared magnitude of the reference image.

The global phase shift is then applied to the reconstructed image as:

\[\hat{x} = \hat{x} \cdot e^{-i \phi},\]

for the corresponding image and channel.

param torch.Tensor x_recon:

Reconstructed image.

param torch.Tensor x:

Original image.

param float threshold:

Threshold to determine if the global phase shift is constant. Default is 1e-5.

param bool verbose:

If True, prints information about the global phase shift. Default is False.

return:

The corrected image.

Examples using correct_global_phase:#

Ptychography phase retrieval

Ptychography phase retrieval

Random phase retrieval and reconstruction methods.

Random phase retrieval and reconstruction methods.