Ptychography#
- class deepinv.physics.Ptychography(img_size=None, probe=None, shifts=None, device='cpu', geometry=None, **kwargs)[source]#
Bases:
PhaseRetrievalPtychography forward operator
\[\forw{x} = \left| Bx \right|^2,\]where \(B\) is the linear operator
deepinv.physics.PtychographyLinearOperator.- Parameters:
img_size (tuple) – Shape
(1, H, W)of the input object.probe (None, torch.Tensor) – Probe of shape
(1, H_p, W_p). Its spatial shape determines the diffraction-pattern shape and may be smaller than the object. IfNone, a disk probe is generated.shifts (None, torch.Tensor) – Scan positions of shape
(n_img, 2)in pixels, in(row, column)order. IfNone, shifts are generated withdeepinv.physics.phase_retrieval.generate_shifts().device (torch.device, str) – Device
"cpu"or"cuda".geometry (None, deepinv.physics.phase_retrieval.PtychographyGeometry) – Optional experimental geometry defining the object-plane pixel size and detector sampling. Currently only
deepinv.physics.phase_retrieval.FarFieldPtychographyGeometryis supported. IfNone, shifts and probe are in pixels.
- Examples:
>>> from deepinv.physics import FarFieldPtychographyGeometry, Ptychography >>> import torch >>> img_size = (1, 64, 64) # object shape >>> detector_shape = (32, 32) # probe and diffraction-pattern shape >>> geometry = FarFieldPtychographyGeometry( ... wavelength=632.8e-9, ... object_detector_distance=5e-2, ... detector_shape=detector_shape, ... detector_pixel_size=(36e-6, 36e-6), ... ) >>> physics = Ptychography(img_size=img_size, geometry=geometry) >>> physics.geometry is geometry True >>> 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, 32, 32])
- property geometry: PtychographyGeometry | None#
Physical geometry associated with the linear ptychography operator.