The blueprints of xptycho, a PyTorch implementation of PMACE ptychography. One blueprint per component; each describes the design the code implements. Start at the top and read down.
The PMACE algorithm of the two TCI papers, as xptycho runs it, organized by the five kinds of quantities it uses (measured data, forward-model parameters, unknowns, reconstruction parameters, run state); the forward model and the operators; one iteration with each step marked local or global; initialization; adding probe modes; the facts that matter for code; and the parameter names.
The mbirtorch pattern: a Scan holds the data, a PtychoModel holds the forward-model parameters, the reconstruction parameters, and the device settings and computes forward, simulate, and recon; a Sample holds the unknowns, an object and its probe, whether true or estimated. The model drawn in full with every method, the Sample and the record of its run, the HDF5 file format, the two directions through the model, the scripts, and position refinement as a method.
The design for carrying out the iteration on \(N_g\) GPUs of one node, all data in GPU memory, fully sharded as in mbirtorch: per-position arrays by position, the object image by row into bands with owners, small arrays broadcast. What each GPU holds and how large a scan fits; what each GPU computes and what moves between GPUs in every step; what crosses between host and GPU; how the user chooses the GPUs.
The scripts a user writes, one per use: the three demos, several GPUs, continuing and refining, the forward model alone. Every public name and every parameter by kind in one place.
How raw detector frames become a Scan: dark subtraction, removal of outlier frames, one center for the whole scan, cropping, and a window, each a function of arrays in memory, with one reader per file format. Checked against the preprocessed gold-ball frames of the reference code.