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# Demo params file for PSO dataset (https://doi.org/10.1126/science.abg2533).
6
7# Note that these parameters are highly customized for this dataset,
8# DON'T direcly copy it for your datasets, as the regularization / constraints might be relatively too strong,
9# and can cause inaccurate results or quantativeness issues.
10# Start from params/templates/ and refine it as suggested in params/walkthrough/
11
12init_params:
13 # Experimental params
14 probe_kv : 300 # [kV] Acceleration voltage
15 probe_conv_angle : 21.4 # [mrad] Semi-convergence angle for probe-forming aperture
16 probe_aberrations : {'C10': 200} # [Angstrom, degree] Aberration coefficients in Krivanel polar notations. C10 = -df, and positive C10 refers to overfocus (stronger lens).
17 meas_Npix : 256 # Detector pixel number, EMPAD is 128. Only supports square detector for simplicity
18 pos_N_scan_slow : 64 # Number of scan position along slow scan direction. Usually it's the vertical direction of acquisition GUI
19 pos_N_scan_fast : 64 # Number of scan position along fast scan direction. Usually it's the horizontal direction of acquisition GUI
20 pos_scan_step_size : 0.410 # [Angstrom] Step size between probe positions in a rectangular raster scan pattern
21 # Model complexity
22 probe_pmode_max : 4 # Maximum number of mixed probe modes
23 obj_Nlayer : 21 # Number of slices for multislice object
24 obj_slice_thickness : 10 # [Angstrom] Slice thickness (propagation distance) for multislice ptychography. Typical values are between 1 to 20 Ang.
25 # Preprocessing
26 meas_permute : null # Permute meas array with a list of ints to reorder datasets into (N_scans, ky, kx) if needed.
27 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.
28 meas_flipT : null # Flip meas orientation with a list of 3 binary booleans (0 or 1) as [flipud, fliplr, transpose]
29 meas_crop : [null,null,[68,188],[68,188]] # Crops the 4D dataset with [[scan_slow_start, scan_slow_end], [scan_fast_start, scan_fast_end], [ky_start, ky_end], [kx_start, kx_end]].
30 meas_pad : {'mode': 'on_the_fly', 'padding_type': 'power', 'target_Npix': 256, 'value': 0, 'threshold': 70} # Pads the diffraction pattern to side length = 'target_Npix' and correspondingly change the kMax, dx, Npix.
31 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.
32 # Input source and params
33 meas_params : {'path': 'data/PSO/sample_data_PrScO3.mat', 'key': 'dp'} # Supports EMPAD .raw, .hdf5, .mat, and .tif
34
35model_params:
36 detector_blur_std : 1 # [k-space px] Gaussian blur std of forward simulated diffraction patterns. Typical value is 0-1 px.
37
38loss_params:
39 loss_single: {'state': true, 'weight': 1.0, 'dp_pow': 0.5} # Amplitude noise model for typical dataset (dose-sufficient) under the maximum-likelihood formalism
40 loss_sparse: {'state': true, 'weight': 0.1, 'ln_order': 1} # L_n norm sparsity regularization calculated for object phase ('objp')
41
42constraint_params:
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 mirrored_amp : {'start_iter': 1, 'step': 1, 'end_iter': null, 'relax': 0.1, 'scale': 0.03, 'power': 4} # Apply a more flexible, ad hoc constraint for constraining amplitude using 1-scale*phase**power, which provide more arbitrary parameters to tune the constrained amplitude based on the phase.
45 obja_thresh : {'start_iter': 1, 'step': 1, 'end_iter': null, 'relax': 0, 'thresh': [0.96, 1.04]} # Thresholds the object amplitude around 1 with specified range in 'thresh'.
46 objp_postiv : {'start_iter': 1, 'step': 1, 'end_iter': null, 'relax': 0} # Apply a positivity constraint of the object phase by clipping negative values
47
48recon_params:
49 NITER: 200 # Total number of reconstruction iterations. 1 iteration means a full pass of all selected diffraction patterns.
50 BATCH_SIZE: {'size': 32, 'grad_accumulation': 1} # Number of diffraction patterns processed simultaneously to get the gradient update.
51 SAVE_ITERS: 10 # Number of completed iterations before saving the current reconstruction results (model, probe, object) and summary figures.
52 output_dir: 'output/PSO/'
53 recon_dir_affixes: ['minimal', 'model', 'loss', 'constraint'] # Customizable affixes of reconstruction folder name with presets like 'minimal', 'default', 'all'. See docs for 19 more detailed controls.
54 prefix: '' # Prefix this string to the reconstruction folder name. Note that a "_" will be automatically generated.
55 postfix: '' # Postfix this string to the reconstruction folder name. Note that a "_" will be automatically generated.