phaser: a unified and extensible framework for fast electron ptychography
Source abstract
Abstract
We present phaser, an open-source Python package that provides a unified interface to both conventional and autodifferentiation-based ptychographic algorithms. Features such as mixed-state probe, probe position correction, and multislice ptychography make experimental reconstructions practical and robust. Reconstructions are specified in a declarative format and can be run from a command line, Jupyter notebook, or web interface. Multiple computational backends are supported to provide maximum flexibility. We report reconstruction success for a variety of experimental datasets, and detail the effects of regularization on convergence and reconstruction quality. Reconstruction speed is benchmarked for single-slice and multislice reconstructions and compared to state-of-the-art packages. The software promises to speed the application and development of ptychographic methods for materials science.
Source: openalex_inverted_index · Quality: baseline
Research context
OpenAlex topics: Advanced X-ray Imaging Techniques · Advanced Electron Microscopy Techniques and Applications · Crystallography and Radiation Phenomena
SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.
References (82)
Show source-provided references
1. Jiang, Y. et al. Electron ptychography of 2D materials to deep sub-ångström resolution. Nature 559, 343–349 (2018).10.1038/s41586-018-0298-5 ↗
2. Chen, Z. et al. Mixed-state electron ptychography enables sub-angstrom resolution imaging with picometer precision at low dose. Nat. Commun. 11, 2994 (2020).10.1038/s41467-020-16688-6 ↗
3. Chen, Z. et al. Electron ptychography achieves atomic-resolution limits set by lattice vibrations. Science 372, 826–831 (2021).10.1126/science.abg2533 ↗
4. Sha, H., Cui, J. & Yu, R. Deep sub-angstrom resolution imaging by electron ptychography with misorientation correction. Sci. Adv. 8, eabn2275 (2022).10.1126/sciadv.abn2275 ↗
5. Sha, H. et al. Ptychographic measurements of varying size and shape along zeolite channels. Sci. Adv. 9, eadf1151 (2023).10.1126/sciadv.adf1151 ↗
6. Chen, Z., Shao, Y.-T., Jiang, Y. & Muller, D. Three-dimensional imaging of single dopants inside crystals using multislice electron ptychography. Microsc. Microanal. 27, 2146–2148 (2021).10.1017/S1431927621007741 ↗
7. Gilgenbach, C., Chen, X., Xu, M. & LeBeau, J. Three-dimensional analysis of nanoscale dislocation loops with multislice electron ptychography. Microsc. Microanal. 29, 286–287 (2023).10.1093/micmic/ozad067.132 ↗
8. Kim, J. et al. Revealing the interplay of local environments and ionic transport in perovskite solid electrolytes. ACS Nano 18, 31234–31243 (2024).10.1021/acsnano.4c09552 ↗
9. Dong, Z. et al. Visualization of oxygen vacancies and self-doped ligand holes in La3Ni2O7-delta. Nature 630, 847–852 (2024).10.1038/s41586-024-07482-1 ↗
10. Zhu, M. et al. Insights into chemical and structural order at planar defects in Pb2MgWO6 using multislice electron ptychography. ACS Nano. 19, 5568–5576 (2025).10.1021/acsnano.4c14833 ↗
11. Rodenburg, J. M. & Bates, R. H. T. The theory of super-resolution electron microscopy via Wigner-distribution deconvolution. Philos. Trans. R. Soc. Lond. Ser. A Phys. Eng. Sci. 339, 521–553 (1992).
12. Rodenburg, J. M. Ptychography and related diffractive imaging methods. in (ed Hawkes) Advances in Imaging and Electron Physics, Vol. 150, 87–184 (Elsevier, 2008).10.1016/S1076-5670(07)00003-1 ↗
13. Rodenburg, J. & Maiden, A. Ptychography. in (eds Hawkes, P. W. & Spence, J. C. H.) Springer Handbook of Microscopy, 819–904 (Springer International Publishing, 2019).10.1007/978-3-030-00069-1_17 ↗
14. Rodenburg, J. M. & Faulkner, H. M. L. A phase retrieval algorithm for shifting illumination. Appl. Phys. Lett. 85, 4795–4797 (2004).10.1063/1.1823034 ↗
15. Maiden, A. M. & Rodenburg, J. M. An improved ptychographical phase retrieval algorithm for diffractive imaging. Ultramicroscopy 109, 1256–1262 (2009).10.1016/j.ultramic.2009.05.012 ↗
16. Rodenburg, J. M. et al. Hard-X-ray lensless imaging of extended objects. Phys. Rev. Lett. 98, 034801 (2007).10.1103/PhysRevLett.98.034801 ↗
17. Marrison, J., Räty, L., Marriott, P. & O’Toole, P. Ptychography - a label free, high-contrast imaging technique for live cells using quantitative phase information. Sci. Rep. 3, 2369 (2013).10.1038/srep02369 ↗
18. Humphry, M., Kraus, B., Hurst, A., Maiden, A. & Rodenburg, J. Ptychographic electron microscopy using high-angle dark-field scattering for sub-nanometre resolution imaging. Nat. Commun. 3, 730 (2012).10.1038/ncomms1733 ↗
19. D’Alfonso, A. J. et al. Deterministic electron ptychography at atomic resolution. Phys. Rev. B 89, 064101 (2014).10.1103/PhysRevB.89.064101 ↗
20. Wang, P., Zhang, F., Gao, S., Zhang, M. & Kirkland, A. I. Electron ptychographic diffractive imaging of boron atoms in LaB6 crystals. Sci. Rep. 7, 2857 (2017).10.1038/s41598-017-02778-x ↗
21. Maiden, A. M., Humphry, M. J. & Rodenburg, J. M. Ptychographic transmission microscopy in three dimensions using a multi-slice approach. J. Opt. Soc. Am. A 29, 1606 (2012).10.1364/JOSAA.29.001606 ↗
22. Tsai, E. H. R., Usov, I., Diaz, A., Menzel, A. & Guizar-Sicairos, M. X-ray ptychography with extended depth of field. Opt. Express 24, 29089–29108 (2016).10.1364/OE.24.029089 ↗
23. Cowley, J. M., Moodie, A. F. & IUCr. The scattering of electrons by atoms and crystals. I. A new theoretical approach. https://scripts.iucr.org/cgi-bin/paper?S0365110X57002194. Vol 10, 609–619 (International Union of Crystallography, 1957).10.1107/S0365110X57002194 ↗
24. Thibault, P. & Menzel, A. Reconstructing state mixtures from diffraction measurements. Nature 494, 68–71 (2013).10.1038/nature11806 ↗
25. Dwyer, C., Erni, R. & Etheridge, J. Measurement of effective source distribution and its importance for quantitative interpretation of STEM images. Ultramicroscopy 110, 952–957 (2010).10.1016/j.ultramic.2010.01.007 ↗
26. Thibault, P. & Guizar-Sicairos, M. Maximum-likelihood refinement for coherent diffractive imaging. New J. Phys. 14, 063004 (2012).10.1088/1367-2630/14/6/063004 ↗
27. Odstrčil, M., Menzel, A. & Guizar-Sicairos, M. Iterative least-squares solver for generalized maximum-likelihood ptychography. Opt. Express 26, 3108 (2018).10.1364/OE.26.003108 ↗
28. Godard, P., Allain, M., Chamard, V. & Rodenburg, J. Noise models for low counting rate coherent diffraction imaging. Opt. Express 20, 25914–25934 (2012).10.1364/OE.20.025914 ↗
29. Giewekemeyer, K. et al. Quantitative biological imaging by ptychographic X-ray diffraction microscopy. Proc. Natl. Acad. Sci. USA 107, 529–534 (2010).10.1073/pnas.0905846107 ↗
30. Thibault, P., Dierolf, M., Bunk, O., Menzel, A. & Pfeiffer, F. Probe retrieval in ptychographic coherent diffractive imaging. Ultramicroscopy 109, 338–343 (2009).10.1016/j.ultramic.2008.12.011 ↗
31. Van den Broek, W. & Koch, C. T. General framework for quantitative three-dimensional reconstruction from arbitrary detection geometries in TEM. Phys. Rev. B 87, 184108 (2013).10.1103/PhysRevB.87.184108 ↗
32. Candès, E. J., Li, X. & Soltanolkotabi, M. Phase retrieval via Wirtinger flow: theory and algorithms. IEEE Trans. Inf. Theory 61, 1985–2007 (2015).10.1109/TIT.2015.2399924 ↗
33. Nashed, Y. S. G., Peterka, T., Deng, J. & Jacobsen, C. Distributed automatic differentiation for ptychography. Procedia Comput. Sci. 108, 404–414 (2017).10.1016/j.procs.2017.05.101 ↗
34. Kandel, S. et al. Using automatic differentiation as a general framework for ptychographic reconstruction. Opt. Express 27, 18653–18672 (2019).10.1364/OE.27.018653 ↗
35. Schloz, M. et al. Overcoming information reduced data and experimentally uncertain parameters in ptychography with regularized optimization. Opt. Express 28, 28306 (2020).10.1364/OE.396925 ↗
36. Du, M. et al. Adorym: a multi-platform generic X-ray image reconstruction framework based on automatic differentiation. Opt. Express 29, 10000–10035 (2021).10.1364/OE.418296 ↗
37. Seifert, J., Bouchet, D., Loetgering, L. & Mosk, A. P. Efficient and flexible approach to ptychography using an optimization framework based on automatic differentiation. OSA Contin. 4, 121–128 (2021).10.1364/OSAC.411174 ↗
38. Diederichs, B., Herdegen, Z., Strauch, A., Filbir, F. & Müller-Caspary, K. Exact inversion of partially coherent dynamical electron scattering for picometric structure retrieval. Nat. Commun. 15, 101 (2024).10.1038/s41467-023-44268-x ↗
39. Enders, B. & Thibault, P. A computational framework for ptychographic reconstructions. Proc. R. Soc. A Math. Phys. Eng. Sci. 472, 20160640 (2016).
40. Wakonig, K. et al. PtychoShelves, a versatile high-level framework for high-performance analysis of ptychographic data. J. Appl. Crystallogr. 53, 574–586 (2020).10.1107/S1600576720001776 ↗
41. Loetgering, L. et al. PtyLab.m/py/jl: a cross-platform, open-source inverse modeling toolbox for conventional and Fourier ptychography. Opt. Express 31, 13763–13797 (2023).10.1364/OE.485370 ↗
42. Lee, C.-H., Zeltmann, S. E., Yoon, D., Ma, D. & Muller, D. A. PtyRAD: a high-performance and flexible ptychographic reconstruction framework with automatic differentiation. Preprint at http://arxiv.org/abs/2505.07814 (2025).10.1093/mam/ozaf070 ↗
43. Stallman, R. M. & Abrahams, P. EMACS the extensible, customizable self-documenting display editor. In Proc. ACM SIGPLAN SIGOA symposium on Text manipulation, 147–156. https://doi.org/10.1145/800209.806466 (Association for Computing Machinery, 1981).10.1145/800209.806466 ↗
44. Froehlich, G., Hoover, H. J., Liu, L. & Sorenson, P. Hooking into object-oriented application frameworks. In Proc. 19th International Conference on Software Engineering, ICSE ’97, 491–501. https://doi.org/10.1145/253228.253432 (Association for Computing Machinery, 1997).10.1145/253228.253432 ↗
45. Meng, Q., Chen, W., Wang, Y., Ma, Z.-M. & Liu, T.-Y. Convergence analysis of distributed stochastic gradient descent with shuffling. Neurocomputing 337, 46–57 (2019).10.1016/j.neucom.2019.01.037 ↗
46. Bradbury, J. et al. JAX: composable transformations of Python+ NumPy programs. http://github.com/jax-ml/jax (2018).
47. Harris, C. R. et al. Array programming with NumPy. Nature 585, 357–362 (2020).10.1038/s41586-020-2649-2 ↗
48. Okuta, R., Unno, Y., Nishino, D., Hido, S. & Loomis, C.CuPy: A NumPy-Compatible Library for NVIDIA GPU Calculations. In Proc. Workshop on Machine Learning Systems (LearningSys) in The Thirty-first Annual Conference on Neural Information Processing Systems (NIPS). http://learningsys.org/nips17/assets/papers/paper_16.pdf (2017).
49. Park, H., Lee, J. H., Oh, Y., Ha, S. & Lee, S. Training deep neural network in limited precision. Preprint at http://arxiv.org/abs/1810.05486 (2018).
50. Kuzmin, A. et al. FP8 quantization: The power of the exponent. Adv. Neural Inf. Process. Syst. 35, 14651–14662 (2022).
51. Venkataramani, S. et al. RaPiD: AI accelerator for ultra-low precision training and inference. In Proc. 2021 ACM/IEEE 48th Annual International Symposium on Computer Architecture (ISCA), 153–166, https://ieeexplore.ieee.org/abstract/document/9499865 (2021).
52. LeBeau, J. M., Findlay, S. D., Allen, L. J. & Stemmer, S. Position averaged convergent beam electron diffraction: theory and applications. Ultramicroscopy 110, 118–125 (2010).10.1016/j.ultramic.2009.10.001 ↗
53. Edo, T. B. et al. Sampling in X-ray ptychography. Phys. Rev. A 87, 053850 (2013).10.1103/PhysRevA.87.053850 ↗
54. Skoupy, R. et al. Newcomer’s guide into optimal data acquisition for electron ptychography. Microsc. Microanal. 30, ozae044.913 (2024).10.1093/mam/ozae044.913 ↗
55. Gilgenbach, C., Chen, X. & LeBeau, J. M. A methodology for robust multislice ptychography. Microsc. Microanal. ozae055, https://doi.org/10.1093/mam/ozae055 (2024).10.1093/mam/ozae055 ↗
56. Zhang, X. et al. Super-resolution ptychography with small segmented detectors. Microsc. Microanal. 31, ozae134 (2025).10.1093/mam/ozae134 ↗
57. Kirkland, E. J. Advanced Computing in Electron Microscopy, https://link.springer.com/10.1007/978-1-4419-6533-2 (Springer US, 2010).10.1007/978-1-4419-6533-2 ↗
58. Fannjiang, A. Raster grid pathology and the cure. Multiscale Model. Simul. 17, 973–995 (2019).10.1137/18M1227354 ↗
59. Leidl, M. L., Diederichs, B., Sachse, C. & Müller-Caspary, K. Influence of loss function and electron dose on ptychography of 2D materials using the Wirtinger flow. Micron 185, 103688 (2024).10.1016/j.micron.2024.103688 ↗
60. Qian, X. & Klabjan, D. The impact of the mini-batch size on the variance of gradients in stochastic gradient descent. Preprint at http://arxiv.org/abs/2004.13146 (2020).
61. Mignacco, F., Urbani, P. & Zdeborová, L. Stochasticity helps to navigate rough landscapes: comparing gradient-descent-based algorithms in the phase retrieval problem. Mach. Learn. Sci. Technol. 2, 035029 (2021).10.1088/2632-2153/ac0615 ↗
62. DeepMind. et al. The DeepMind JAX ecosystem, http://github.com/google-deepmind (2020).
63. Kingma, D. P. & Ba, J. Adam: a method for stochastic optimization. Preprint at http://arxiv.org/abs/1412.6980 (2017).
64. Dozat, T. Incorporating Nesterov Momentum into Adam. In ICLR 2016. https://openreview.net/pdf?id=OM0jvwB8jIp57ZJjtNEZ (2016).
65. Loizou, N., Vaswani, S., Laradji, I. H. & Lacoste-Julien, S. Stochastic Polyak step-size for SGD: an adaptive learning rate for fast convergence. In Proc. 24th International Conference on Artificial Intelligence and Statistics, 1306–1314. https://proceedings.mlr.press/v130/loizou21a.html (PMLR, 2021).
66. Cherukara, M. J. et al. AI-enabled high-resolution scanning coherent diffraction imaging. Appl. Phys. Lett. 117, 044103 (2020).10.1063/5.0013065 ↗
67. Babu, A. V. et al. Deep learning at the edge enables real-time streaming ptychographic imaging. Nat. Commun. 14, 7059 (2023).10.1038/s41467-023-41496-z ↗
68. Chang, D. J. et al. Deep-learning electron diffractive imaging. Phys. Rev. Lett. 130, 016101 (2023).10.1103/PhysRevLett.130.016101 ↗
69. Nakahata, R., Zaman, S., Zhang, M., Lu, F. & Chiu, K. PtychoFormer: a transformer-based model for ptychographic phase retrieval. Preprint at http://arxiv.org/abs/2410.17377 (2024).
70. McCray, A. R. C., Ribet, S., Varnavides, G. & Ophus, C. Improving iterative ptychographic reconstructions with generative neural networks. Microsc. Microanal. 31, ozaf048.1115 (2025).10.1093/mam/ozaf048.1115 ↗
71. Tanksalvala, M. et al. Nondestructive, high-resolution, chemically specific 3D nanostructure characterization using phase-sensitive EUV imaging reflectometry. Sci. Adv. 7, eabd9667 (2021).10.1126/sciadv.abd9667 ↗
72. Fienup, J. R. Phase retrieval algorithms: a comparison. Appl. Opt. 21, 2758–2769 (1982).10.1364/AO.21.002758 ↗
73. Elser, V. Phase retrieval by iterated projections. JOSA A 20, 40–55 (2003).10.1364/JOSAA.20.000040 ↗
74. Allars, F., Maiden, A., Batey, D. J. & Allen, C. S. Depth of field of multi-slice electron ptychography: Investigating energy and convergence angle. J. Micros. https://onlinelibrary.wiley.com/doi/abs/10.1111/jmi.70039 (2025).10.1111/jmi.70039 ↗
75. Cao, M. C., Chen, Z., Jiang, Y. & Han, Y. Automatic parameter selection for electron ptychography via Bayesian optimization. Sci. Rep. 12, 12284 (2022).10.1038/s41598-022-16041-5 ↗
76. Akiba, T., Sano, S., Yanase, T., Ohta, T. & Koyama, M. Optuna: A Next-generation Hyperparameter Optimization Framework. In Proc. 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining 2623–2631 (Association for Computing Machinery, New York, NY, USA, 2019). https://doi.org/10.1145/3292500.3330701.10.1145/3292500.3330701 ↗
77. Bergstra, J., Bardenet, R., Bengio, Y. & Kégl, B. Algorithms for hyper-parameter optimization. in Advances in Neural Information Processing Systems, Vol. 24, https://proceedings.neurips.cc/paper_files/paper/2011/hash/86e8f7ab32cfd12577bc2619bc635690-Abstract.html (Curran Associates, Inc., 2011).
78. Dosselmann, R. & Yang, X. D. A comprehensive assessment of the structural similarity index. Signal Image Video Process. 5, 81–91 (2011).10.1007/s11760-009-0144-1 ↗
79. Nilsson, J. & Akenine-Möller, T. Understanding SSIM. Preprint at http://arxiv.org/abs/2006.13846 (2020).
80. Verbeke, E. J., Gilles, M. A., Bendory, T. & Singer, A. Self Fourier shell correlation: properties and application to cryo-ET. Commun. Biol. 7, 101 (2024).10.1038/s42003-023-05724-y ↗
81. Gesing, T. M., Uecker, R. & Buhl, J.-C. Refinement of the crystal structure of praseodymium orthoscandate, PrScO3. Z. Krist. New Cryst. Struct. 224, 365–366 (2009).
82. Gilgenbach, C., Zhu, M. & LeBeau, J M. Data for "phaser: A unified and extensible framework for fast electron ptychography". Dryad, https://doi.org/10.5061/dryad.d51c5b0gf (2026).10.5061/dryad.d51c5b0gf ↗