Welcome Ptychonaut!

PtyPy 1 is a framework for scientific ptychography compiled by P.Thibault, B. Enders, and others (see AUTHORS).

It is the result of years of experience in the field of ptychography condensed into a versatile python package. The package covers the whole path of ptychographic analysis after the actual experiment is completed - from data management to reconstruction to visualization.

The main idea of ptypy is: “Flexibility and Scalabality through abstraction”. Most often, you will find a class for every concept of ptychography in PtyPy. Using these or other more abstract base classes, new ideas may be developed in a rapid manner without the cumbersome overhead of data management , memory access or distributed computing. Additionally, PtyPy provides a rich set of utilities and helper functions, especially for input/output

Get started quickly here or with one of the examples in the templates directory.


  • Difference Map 4 algorithm engine with power bound constraint 5.

  • Maximum Likelihood 3 engine with preconditioners and regularizers.

  • A few more engines (RAAR, sDR, ePIE, …).

  • Fully parallelized using the Massage Passing Interface (MPI). Simply execute your script with:

    $ mpiexec/mpirun -n [nodes] python <your_ptypy_script>.py
  • GPU acceleration based on custom kernels, CuPy or PyCUDA/reikna. See examples in templates/accelerate, templates/engines/cupy and templates/engines/pycuda.

  • A client-server approach for visualization and control based on ZeroMQ . The reconstruction may run on a remote hpc cluster while your desktop computer displays the reconstruction progress.

  • Mixed-state reconstructions of probe and object 2 for overcoming partial coherence or related phenomena.

  • On-the-fly reconstructions (while data is being acquired) using the the PtyScan class in the linking mode linking mode