| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Pty-Chi is actively maintained, and we welcome feature requests, bug reports, and contributions from the community.
If you need a new capability, or have implemented useful extensions in your own branch or derivative codebase, we strongly encourage you to consider contributing those changes back to Pty-Chi through an issue or pull request whenever practical, rather than maintaining a separate repository with overlapping functionality.
Keeping broadly useful improvements in the shared upstream project helps reduce fragmentation, preserves a clear development history, and makes new capabilities easier for the wider community to discover, maintain, and build upon.
Welcome to the repository of Pty-chi, a PyTorch-based ptychography reconstruction library!
We recommend using uv for environment and package management. uv is a modern lightweight package manager for Python featuring fast speed and deterministic builds. When creating a uv virtual environment, the environment directory and all the packages installed in it are kept in the current working directory.
If you are adding Pty-Chi to a uv-managed project, use:
uv add ptychi
If you are installing Pty-Chi into an existing uv virtual environment that is not managed as a uv project, use:
uv pip install ptychi
Pty-Chi provides uv extras to select a PyTorch build:
For example:
uv add "ptychi[cuda132]"
or:
uv pip install "ptychi[cpu]"
If you are not using uv, install the default build from PyPI with:
pip install ptychi
Use developer installation when you want to modify the code and test the changes, or when you run into build issues that drive you to install the package from source.
First cd into the root level of your local clone of Pty-Chi, and then create a new uv virtual environment with Python 3.11:
uv venv --python 3.11
Then install Pty-Chi and its dependencies using:
uv sync
You can select a PyTorch build with the same extras used for standard installation. For example:
uv sync --extra cpu uv sync --extra cuda126 uv sync --extra cuda132 uv sync --extra rocm72
You can now run scripts inside the project directory with:
uv run <script.py>
without activating the environment. Alternatively, you can activate the environment with:
source .venv/bin/activate
and then run scripts with:
python <script.py>
This allows you to run scripts located anywhere in your system.
Pty-Chi works on GPUs from different vendors than NVidia. For example, Intel. To run Pty-Chi with Intel GPUs, add these lines right after importing torch and ptychi:
torch.set_default_device("xpu")
ptychi.device.set_torch_accelerator_module(torch.xpu)
Pty-Chi's documentation is hosted on Read the Docs.
You can also build the docs and view them in your browser locally. To build the docs, install the dependencies as the first step:
pip install -r docs/requirements.txt
Then:
cd docs make html
You can then view the docs by opening docs/build/html/index.html in your browser.
Please refer to the developer's guide in the Wiki page for more information on how to contribute to the project.
🛑 For major changes such as adding a new reconstructor or those involving extensive structural changes to the codebase, please first discuss with the maintainers by creating an issue. Consider creating a new package inheriting Pty-Chi's reconstructors and data structures for experimental features and algorithms. See Developer’s guide: Extending Pty-Chi with external algorithm packages.
If Pty-Chi is useful for your research, please consider citing the following paper:
@misc{ptychi_2025_arxiv,
title = {Pty-Chi: A PyTorch-based modern ptychographic data analysis package},
author = {Ming Du and Hanna Ruth and Steven Henke and Yi Jiang and Viktor Nikitin and Ashish Tripathi and Junjing Deng and Jeffrey Klug and Peco Myint and Tao Zhou and Nicholas Schwarz and Mathew Cherukara and Alec Sandy and Stefan Vogt},
year = {2025},
eprint = {2510.20929},
archivePrefix = {arXiv},
primaryClass = {physics.optics},
url = {https://arxiv.org/abs/2510.20929},
}
| Back | FazBrowse Home | New Git URL |