ptyrad.core.models.ptycho#
Optimizable model of the ptychographic reconstruction using automatic differentiation (AD)
This is the PyTorch model that holds optimizable tensors and interacts with loss and constraints.
Classes
|
Main optimization class for ptychographic reconstruction using automatic differentiation (AD). |
- class ptyrad.core.models.ptycho.PtychoModel(init_variables, model_params, device='cuda')[source]#
Bases:
ModuleMain optimization class for ptychographic reconstruction using automatic differentiation (AD).
This class is responsible for initializing the model parameters, setting up the optimizer, and performing forward passes to compute diffraction patterns based on the given input indices.
- device#
Device to run computations on (‘cuda:0’ by default).
- Type:
str
- detector_blur_std#
Standard deviation for detector blur, or None if no blur.
- Type:
float
- lr_params#
Learning rate parameters for optimizable tensors.
- Type:
dict
- opt_obja#
Amplitude of the object.
- Type:
torch.Tensor
- opt_objp#
Phase of the object.
- Type:
torch.Tensor
- opt_obj_tilts#
Tilts of the object.
- Type:
torch.Tensor
- opt_probe#
Probe function.
- Type:
torch.Tensor
- opt_probe_pos_shifts#
Shifts for the probe positions.
- Type:
torch.Tensor
- omode_occu#
Occupation mode.
- Type:
torch.Tensor
- H#
Propagator matrix.
- Type:
torch.Tensor
- measurements#
Measurements for the ptychographic reconstruction.
- Type:
torch.Tensor
- N_scan_slow#
Number of scans in the slow direction.
- Type:
torch.Tensor
- N_scan_fast#
Number of scans in the fast direction.
- Type:
torch.Tensor
- crop_pos#
Cropping positions.
- Type:
torch.Tensor
- slice_thickness#
slice thickness (dz) parameter.
- Type:
torch.Tensor
- dx#
Pixel size in the x direction.
- Type:
torch.Tensor
- dk#
K-space sampling interval.
- Type:
torch.Tensor
- scan_affine#
Affine transformation for scan.
- Type:
affine.Affine
- tilt_obj#
Whether object tilts are being optimized.
- Type:
bool
- probe_int_sum#
Sum of squared probe intensities.
- Type:
torch.Tensor
- optimizable_tensors#
Dictionary of tensors that can be optimized.
- Type:
dict
- Parameters:
init_variables (dict) – Dictionary of initial variables required for the model.
model_params (dict) – Dictionary of model parameters including learning rates and blur stds.
device (str) – Device to run computations on. Default is ‘cuda:0’.
- create_grids()[source]#
Create the grids for shifting probes, selecting obj ROI, and Fresnel propagator in a vectorized approach