ptyrad.core.losses#
Loss functions and soft regularizations calculated using forward simulations against experimental measurements
Functions
|
Calculate the contrast from objp zsum imgage for Hypertune purpose |
Classes
|
Computes the combined loss for ptychographic reconstruction, incorporating multiple loss components. |
- class ptyrad.core.losses.CombinedLoss(loss_params, device='cuda')[source]#
Bases:
ModuleComputes the combined loss for ptychographic reconstruction, incorporating multiple loss components.
This class implements various loss functions that are combined to optimize the reconstruction in ptychography. The loss components include losses based on Gaussian and Poisson statistics, PACBED loss, sparsity regularization, and similarity between different object modes.
- Parameters:
loss_params (dict) – A dictionary containing the configuration and weights for each of the loss components.
device (str, optional) – The device on which the computations will be performed, e.g., ‘cuda’. Defaults to ‘cuda’.
- get_loss_single(model_DP, measured_DP)[source]#
Computes the loss based on Gaussian statistics of the diffraction patterns.
- get_loss_poissn(model_DP, measured_DP)[source]#
Computes the loss based on Poisson statistics of the diffraction patterns.
- get_loss_pacbed(model_DP, measured_DP)[source]#
Computes the PACBED loss by comparing averaged diffraction patterns.
- get_loss_sparse(objp_patches, omode_occu)[source]#
Computes the sparsity regularization loss on object phase patches.