Ptychography#

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

Bases: PhaseRetrieval

Ptychography forward operator.

Corresponding to the operator

\[\forw{x} = \left| Bx \right|^2\]

where \(B\) is the linear forward operator defined by a deepinv.physics.PtychographyLinearOperator object.

Parameters:
  • img_size (tuple) – Shape of the input image.

  • probe (None, torch.Tensor) – A tensor of shape img_size representing the probe function. If None, a disk probe is generated with deepinv.physics.phase_retrieval.build_probe function.

  • shifts (None, torch.Tensor) – A 2D array of shape (n_img, 2) corresponding to the shifts for the probe. If None, shifts are generated with deepinv.physics.phase_retrieval.generate_shifts function.

  • device (torch.device, str) – Device “cpu” or “gpu”.


Examples:

>>> from deepinv.physics import Ptychography
>>> import torch
>>> img_size = (1, 64, 64)  # input image
>>> physics = Ptychography(img_size=img_size)
>>> x = torch.randn(img_size, dtype=torch.cfloat)
>>> y = physics(x)  # Apply the Ptychography forward operator
>>> print(y.shape) # 25 probe positions by default
torch.Size([1, 25, 64, 64])

Examples using Ptychography:#

Ptychography phase retrieval

Ptychography phase retrieval