Standard

Standard#

The sweet spot for most users. It exposes the most commonly tuned parameters (like basic constraints, and learning rates) without overwhelming you with niche settings. Start here for standard datasets.

 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# Standard params file with common PtyRAD options (~40) and light comments for a more flexible fresh reconstruciton
 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    obj_Nlayer             : 6 # Number of slices for multislice object
21    obj_slice_thickness    : 2 # [Angstrom] Slice thickness (propagation distance) for multislice ptychography. Typical values are between 1 to 20 Ang.
22    # Preprocessing
23    meas_permute           : null # Permute meas array with a list of ints to reorder datasets into (N_scans, ky, kx) if needed.
24    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.
25    meas_flipT             : [1,0,0] # Flip meas orientation with a list of 3 binary booleans (0 or 1) as [flipud, fliplr, transpose]
26    meas_crop              : null # Crop 4D dataset as [[scan_slow_start, scan_slow_end], [scan_fast_start, scan_fast_end], [ky_start, ky_end], [kx_start, kx_end]].
27    meas_pad               : null # Pad diffraction patterns to larger kMax. e.g., {'mode': 'on_the_fly', 'padding_type': 'power', 'target_Npix': 256, 'value': 0, 'threshold': 70}
28    meas_resample          : null # Resample diffraction patterns. e.g., {'mode': 'on_the_fly', 'scale_factors': [2,2]}
29    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.
30    # Input source and params
31    meas_params            : {'path': 'data/tBL_WSe2/Panel_g-h_Themis/scan_x128_y128.raw', 'key': null} # Supports EMPAD .raw, .hdf5, .mat, and .tif
32
33model_params:
34    detector_blur_std   : null # [k-space px] Gaussian blur std of forward simulated diffraction patterns. Typical value is 0-1 px.
35    update_params:
36        obja            : {'start_iter': 1, 'lr': 5.0e-4, 'end_iter': null} # object amplitude
37        objp            : {'start_iter': 1, 'lr': 5.0e-4, 'end_iter': null} # object phase
38        probe           : {'start_iter': 1, 'lr': 1.0e-4, 'end_iter': null} # probe
39        probe_pos_shifts: {'start_iter': 1, 'lr': 5.0e-4, 'end_iter': null} # sub-px probe positions
40
41loss_params:
42    loss_single: {'state': true, 'weight': 1.0, 'dp_pow': 0.5} # Amplitude noise model for typical dataset (dose-sufficient) under the maximum-likelihood formalism
43    loss_poissn: {'state': false, 'weight': 1.0, 'dp_pow': 1.0, 'eps': 1.0e-6} # Poisson noise model for low dose dataset under maximum likelihood formalism
44    loss_sparse: {'state': false, 'weight': 0.1, 'ln_order': 1} # L_n norm sparsity regularization calculated for object phase ('objp')
45
46constraint_params:
47    ortho_pmode   : {'start_iter': 1,    'step': 1, 'end_iter': null} # Orthogonalize the mixed-state probe
48    fix_probe_int : {'start_iter': 1,    'step': 1, 'end_iter': null} # Fix the probe intensity to remove the object-probe intensity ambiguity
49    obj_rblur     : {'start_iter': null,    'step': 1, 'end_iter': null, 'obj_type': 'both', 'kernel_size': 5, 'std': 0.4} # Apply a "lateral" 2D Gaussian blur to the object
50    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
51    obja_thresh   : {'start_iter': 1,    'step': 1, 'end_iter': null, 'relax': 0, 'thresh': [0.96, 1.04]} # Apply a thresholding of object amplitude
52    objp_postiv   : {'start_iter': null,    'step': 1, 'end_iter': null, 'relax': 0} # Apply a positivity constraint of the object phase by clipping negative values
53
54recon_params:
55    NITER: 200 # Total number of reconstruction iterations. 1 iteration means a full pass of all selected diffraction patterns.
56    BATCH_SIZE: {'size': 32, 'grad_accumulation': 1} # Number of diffraction patterns processed simultaneously to get the gradient update.
57    SAVE_ITERS: 10 # Number of completed iterations before saving the current reconstruction results (model, probe, object) and summary figures.
58    output_dir: 'output/tBL_WSe2/'
59    recon_dir_affixes: ['default'] # Customizable affixes of reconstruction folder name with presets like 'minimal', 'default', 'all'. See docs for 19 more detailed controls.
60    prefix: '' # Prefix this string to the reconstruction folder name. Note that a "_" will be automatically generated.
61    postfix: '' # Postfix this string to the reconstruction folder name. Note that a "_" will be automatically generated.
62    compiler_configs: {'enable': false} # Set to {'enable': true} to enable PyTorch JIT compilation for a 1.3-1.9x speedup on supported hardware.