

Defocused probe ptychography
In this tutorial notebook, we will perform both differential phase contrast (DPC) and ptychographic phase reconstructions from a simulated 4D-STEM dataset.
Downloads
Acknowledgements
This tutorial was created by the py4DSTEM instructor team:
- Colin Ophus (clophus@lbl.gov)
- Stephanie Ribet (sribet@lbl.gov)
- Georgios Varnavides (gvarnavides@berkeley.edu)
The 4D-STEM dataset used here was simulated by Colin Ophus using the reference implementation of partitioned PRISM which can be found at the Github repo for superPRISM. We have also added the common experiment artifacts of probe descan which varies over the field of view and shot noise.
Updated 2023 July 12
0.14.2
load the data
DataCube( A 4-dimensional array of shape (32, 32, 200, 200) called 'datacube', with dimensions: Rx = [0,1,2,...] pixels Ry = [0,1,2,...] pixels Qx = [0,1,2,...] pixels Qy = [0,1,2,...] pixels )
DiffractionSlice( A 2-dimensional array of shape (200, 200) called 'diffractionslice', with dimensions: dim0 = [0,1,2,...] pixels dim1 = [0,1,2,...] pixels )
Let's plot some of the probe positions:

Calibration
We will manually enter the diffraction space sampling and the real space step size between adjacent STEM probes:
Calibration( A Metadata instance called 'calibration', containing the following fields: Q_pixel_size: 0.025 R_pixel_size: 5.0 Q_pixel_units: A^-1 R_pixel_units: A )
DPC
First, we perform the preprocessing steps. These include:
- measuring the center of mass (CoM) for all probe postions.
- fitting the probe descan to a plane wave or another function.
- determining the best-fit rotation between real and reciprocal space.
- calculating the corrected CoM images.


Next we perform the DPC reconstruction:

The reconsruction clearly shows the object on the substrate. However, the resolution is limited to the STEM probe sampling - we only recover one phase value per probe position. In order to perform superresolution imaging (i.e. recover spatial frequencies outside of the numerical aperture / probe semiangle), we will need to peform a ptychographic reconstruction.
Ptychography
We perform similar pre-processing for ptychography as we do for DPC.
Getting a good guess for the rotation between real space and diffraction space is essential to getting a good reconstruction in defocused probe ptychography.

Next, we perform the ptychographic reconstruction.
There are various options we can tune below, but this reconstruction converges quite rapidly due to the sample being close to a weak phase object (the thickest region of the sample consists of 4 graphene layers).

We then plot the final reconstructed phase:






