Skip to content

ptycho/ptypy

Repository files navigation

Phase Focus Limited of Sheffield, UK, has an international portfolio of patents and pending applications which relate to ptychography. A current list is available here.

Phase Focus grants royalty free licences of its patent rights for non-commercial academic research use, for reconstruction of simulated data and for reconstruction of data obtained at synchrotrons at X-ray wavelengths. These licenses can be applied for online by clicking on this link.

Phase Focus asserts that the software we have made available for download may be capable of being used in circumstances which may fall within the claims of one or more of the Phase Focus patents. Phase Focus advises that you apply for a licence from it before downloading any software from this website.


PtyPy - Ptychography Reconstruction for Python

ptypysite

https://github.com/ptycho/ptypy/actions/workflows/test.yml/badge.svg?branch=master

Welcome Ptychonaut!

PtyPy [1] [2] is a framework for scientific ptychography compiled by P. Thibault and B. Enders and other authors (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 and output

To get started quickly, please find the official documentation on the project pages or have a look at the examples in the templates directory.

Features

  • Difference Map [4] algorithm engine with power bound constraint [6].

  • Maximum Likelihood [5] 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 -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 [3] 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

Installation

Installation should be as simple as

$ pip install .

or, as a user,

$ pip install . --user

Dependencies

Ptypy depends on standard python packages:
  • numpy
  • scipy
  • h5py
  • matplotlib & pillow (optional - required for plotting)
  • mpi4py (optional - required for parallel computing)
  • pyzmq (optional - required for the plotting client)

GPU support

We support an accelerated version of PtyPy for CUDA-capable GPUs based on our own kernels and the CuPy package. We recommend to install the dependencies for this version like so.

$ conda env create -f accelerate/cuda_cupy/dependencies.yml
$ conda activate ptypy_cupy
(ptypy_cupy)$ pip install .

Quicklinks

Contribute

Support

If you are having issues, please let us know.

References

[1]Pronounced typy, forget the p, as in psychology.
[2]B.Enders and P.Thibault, Proc. R. Soc. A 472, doi
[3]P.Thibault and A.Menzel, Nature 494, 68 (2013), doi
[4]P.Thibault, M.Dierolf et al., Science 321, 7 (2009), doi
[5]P.Thibault and M.Guizar-Sicairos, New J. of Phys. 14, 6 (2012), doi
[6]K.Giewekemeyer et al., PNAS 108, 2 (2007), suppl. material, doi