PtychographyLinearOperator#

class deepinv.physics.PtychographyLinearOperator(img_size, probe=None, shifts=None, device='cpu', **kwargs)[source]#

Bases: LinearPhysics

Forward linear operator for phase retrieval in ptychography.

Models multiple applications of the shifted probe and Fourier transform on an input image.

This operator performs multiple 2D Fourier transforms on the probe function applied to the shifted input image according to specific offsets, and concatenates them. The probe function is applied element by element to the input image.

\[\begin{split}B = \left[ \begin{array}{c} B_1 \\ B_2 \\ \vdots \\ B_{n_{\text{img}}} \end{array} \right], B_l = F \text{diag}(p) T_l, \quad l = 1, \dots, n_{\text{img}},\end{split}\]

where \(F\) is the 2D Fourier transform, \(\text{diag}(p)\) is associated with the probe \(p\) and \(T_l\) is a 2D shift.

Parameters:
A(x, **kwargs)[source]#

Applies the forward operator to the input image x by shifting the probe, multiplying element-wise, and performing a 2D Fourier transform.

Parameters:

x (torch.Tensor) – Input image tensor.

Returns:

Concatenated Fourier transformed tensors after applying shifted probes.

A_adjoint(y, **kwargs)[source]#

Applies the adjoint operator to y.

Parameters:

y (torch.Tensor) – Transformed image data tensor of size (batch_size, n_img, height, width).

Returns:

Reconstructed image tensor.

get_overlap_img(shifts)[source]#

Computes the overlapping image intensities from probe shifts, used for normalization.

Parameters:

shifts (array_like) – Array of probe shifts.

Returns:

Tensor representing the overlap image.

shift(x, x_shift, y_shift, pad_zeros=True)[source]#

Applies a shift to the tensor x by x_shift and y_shift.

Parameters:
  • x (torch.Tensor) – Input tensor.

  • x_shift (int) – Shift in x-direction.

  • y_shift (int) – Shift in y-direction.

  • pad_zeros (bool) – If True, pads shifted regions with zeros.

Returns:

Shifted tensor.