01. Multi Slice

01. Multi Slice#

Description of this walkthrough goes here.

 1# Created with PtyRAD 0.1.0b13
 2# Documentation: https://ptyrad.readthedocs.io/en/latest/
 3# Detailed description for each option: https://ptyrad.readthedocs.io/en/latest/_autosummary/ptyrad.params.html
 4
 5# Multi-slice reconstruciton with depth regularization 'obj_zblur'
 6
 7# tBL_WSe2
 8
 9init_params:
10    # Experimental params
11    probe_kv               : 80 # [kV] Acceleration voltage
12    probe_conv_angle       : 24.9 # [mrad] Semi-convergence angle for probe-forming aperture
13    probe_aberrations      : {'C10': 0} # [Angstrom, degree] Aberration coefficients in Krivanel polar notations. C10 = -df, and positive C10 refers to overfocus (stronger lens).  
14    meas_Npix              : 128 # Detector pixel number, EMPAD is 128. Only supports square detector for simplicity
15    pos_N_scan_slow        : 128 # Number of scan position along slow scan direction. Usually it's the vertical direction of acquisition GUI
16    pos_N_scan_fast        : 128 # Number of scan position along fast scan direction. Usually it's the horizontal direction of acquisition GUI
17    pos_scan_step_size     : 0.4290 # [Angstrom] Step size between probe positions in a rectangular raster scan pattern
18    # Model complexity
19    probe_pmode_max        : 6 # Maximum number of mixed probe modes
20
21    ## NOTE: obj_Nlayer > 1 for multislice
22    ## NOTE: Set obj_slice_thickness such that thickness * Nlayer = total thickness
23    obj_Nlayer             : 6 # Number of slices for multislice object
24    obj_slice_thickness    : 2 # [Angstrom] Slice thickness (propagation distance) for multislice ptychography. Typical values are between 1 to 20 Ang.
25    
26    # Preprocessing
27    meas_permute           : null # Permute meas array with a list of ints to reorder datasets into (N_scans, ky, kx) if needed.
28    meas_reshape           : null # Reshape meas array with a list of 3 ints to convert the 4D diffraction dataset (Ry,Rx,ky,kx) into 3D (N_scans,ky,kx) for PtyRAD.
29    meas_flipT             : [1,0,0] # Flip meas orientation with a list of 3 binary booleans (0 or 1) as [flipud, fliplr, transpose]
30    pos_scan_affine        : null # Affine transformation [scale, asymmetry, rotation, shear] of scan patterns. e.g, [1,0,3,0], rotation and shear are in unit of degree.
31    # Input source and params
32    meas_params            : {'path': 'data/tBL_WSe2/Panel_g-h_Themis/scan_x128_y128.raw', 'key': null} # Supports EMPAD .raw, .hdf5, .mat, and .tif
33
34constraint_params:
35    
36    ## NOTE: Depth regularization is required for stable multislice ptychography reconstruction.
37    ##       By default, PtyRAD will automatically apply the 'obj_zblur' for Nlayer > 1 unless it's been explictly switched off by the user.
38    ##       The strength of 'obj_zblur' is specified by 'std' (in unit of layers), and default 'std' is 1.
39    ##       For the tBL-WSe2 dataset, the equivalent std can be as small as 1 Ang, i.e., std = 1 for 1-Ang-slice.
40    ##       For most thick samples like the PSO dataset, a safe starting point is 10 Ang, i.e., std = 1 for 10-Ang-slice, and slowly reduce the std if needed.
41    ##       Although fundamentally the depth resolution (~1-3 nm) is mostly limited by dose, multiple scattering, and convergence / collection angles,
42    ##       so there's not much benefit of pushing the equivalent std to be below 0.5 nm. 
43    obj_zblur     : {'start_iter': 1,    'step': 1, 'end_iter': null, 'obj_type': 'both', 'kernel_size': 5, 'std': 1} # Apply a "z-direction" 1D Gaussian blur to the object.
44
45recon_params:
46    NITER: 200 # Total number of reconstruction iterations. 1 iteration means a full pass of all selected diffraction patterns.
47    BATCH_SIZE: {'size': 32, 'grad_accumulation': 1} # Number of diffraction patterns processed simultaneously to get the gradient update.
48    SAVE_ITERS: 10 # Number of completed iterations before saving the current reconstruction results (model, probe, object) and summary figures.
49    output_dir: 'output/walkthrough/01_multi_slice/'
50
51    ## NOTE: Once users start exploring different constraints, it's clearer to include 'constraint' in the output folder name.
52    recon_dir_affixes: ['minimal', 'constraint'] # Customizable affixes of reconstruction folder name with presets like 'minimal', 'default', 'all'. See docs for 19 more detailed controls.
53    prefix_time: false # type: boolean, preset strings, and time format strings. Set to true to prepend a date str like '20240903_' in front of the reconstruction folder name