Key Features | Getting Started | Installation | Documentation
PtyLab is an inverse modeling toolbox for Conventional (CP) and Fourier (FP) ptychography in a unified framework. For more information please check the paper.
- Classic engines: ePIE, mPIE, mqNewton, qNewton
- Advanced corrections: position correction, defocus correction (zPIE), angle correction (aPIE), orthogonal probe relaxation (OPR)
- Multi-modal: multi-slice, multi-wavelength, mixed-state object and probe
- Multiple propagators: Fraunhofer, Fresnel, Angular Spectrum (ASP), scaled ASP, polychromatic variants
- GPU acceleration: same code runs on CPU and GPU
The reconstructed output is a 6D array of shape (nlambda, nosm, npsm, nslice, No, No):
| Dim | Meaning |
|---|---|
nlambda |
wavelengths |
nosm |
object state mixture |
npsm |
probe state mixture |
nslice |
depth slices |
No |
output frame size |
Try the demo in Google Colab:
For more use cases, start with the tutorials in our documentation, then see the example_scripts directory.
Install from PyPI within your virtual environment:
pip install ptylabFor faster installs, we recommend uv: uv pip install ptylab
To utilize GPU for faster reconstruction, enable GPU support:
uv pip install "ptylab[gpu]" # supports CUDA 12Check whether GPU is correctly configured with uv run ptylab check gpu. For additional information, check the installation guide.
For the development setup, running the tests and building the documentation locally, see the development guide in the documentation.
If you use this package, please cite:
@article{Loetgering:23,
author = {Lars Loetgering and Mengqi Du and Dirk Boonzajer Flaes and Tomas Aidukas and Felix Wechsler and Daniel S. Penagos Molina and Max Rose and Antonios Pelekanidis and Wilhelm Eschen and J\"{u}rgen Hess and Thomas Wilhein and Rainer Heintzmann and Jan Rothhardt and Stefan Witte},
journal = {Opt. Express},
number = {9},
pages = {13763--13797},
publisher = {Optica Publishing Group},
title = {PtyLab.m/py/jl: a cross-platform, open-source inverse modeling toolbox for conventional and Fourier ptychography},
volume = {31},
month = {Apr},
year = {2023},
doi = {10.1364/OE.485370},
}