Skip to content

Commit 3880050

Browse files
authored
pty-chi (#103)
- [ ] Add integrations for pty-chi and ptychopinn - [ ] Updated template globus configuration file for ALCF Polaris - [ ] New file readers: cSAXS, NSLS-II, SLAC, CSSI, ISN - [ ] Improve diffraction pattern loading: enable binning, padding, and update wizard - [ ] Add diffraction pattern counts meter to GUI - [ ] Implement minimal support for spatially varying probes - [ ] Added ability to rescale model probe power when specified photon count > 0 - [ ] Add ability to estimate probe photon count from diffraction data - [ ] Packaging: Update packaging to support wheels and create Dockerfile - [ ] Add position/probe/object file reader adapters for product file readers - [ ] Update analysis dialogs - [ ] Add macro to attempt reconstructions using all standard scan transforms - [ ] Support auto-loading data products from file - [ ] Reconstructions: execute in different thread, add status widget so GUI doesn’t lock up during reconstructions - [ ] Update memory usage display to use LCD widget
1 parent 56155e7 commit 3880050

File tree

373 files changed

+24590
-17395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

373 files changed

+24590
-17395
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,4 @@ cython_debug/
150150
# and can be added to the global gitignore or merged into this file. For a more nuclear
151151
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
152152
#.idea/
153+
.aider*

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#FROM python:3.12-slim-bullseye
2+
FROM pytorch/pytorch:2.7.0-cuda12.6-cudnn9-runtime
3+
4+
# Set the working directory in the container
5+
WORKDIR /app
6+
7+
# Copy the sources
8+
COPY . /src
9+
10+
# Install & upgrade software
11+
RUN apt-get update && \
12+
apt-get install -y git libqt5gui5 && \
13+
rm -rf /var/lib/apt/lists/* && \
14+
python3 -m pip install --root-user-action=ignore --no-cache-dir --upgrade pip && \
15+
python3 -m pip install --root-user-action=ignore --no-cache-dir /src[globus,gui,ptychi] && \
16+
rm -rf /src
17+
18+
# Run ptychodus when the container launches
19+
#ENV QT_DEBUG_PLUGINS=1
20+
CMD ["python3", "-m", "ptychodus"]

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ Developer Installation
6767
$ conda activate ptychodus
6868
$ pip install -e ./ptychodus
6969
70-
* To install the `tike`_ backend:
70+
* To install the `pty-chi`_ backend:
7171
7272
.. code-block:: shell
7373
74-
$ conda install -n ptychodus -c conda-forge tike
74+
$ pip install ptychi
7575
7676
* To install the `PtychoNN`_ backend:
7777
@@ -93,6 +93,6 @@ Reporting Bugs
9393
Open a bug at https://github.com/AdvancedPhotonSource/ptychodus/issues.
9494
9595
.. _`ptychodus`: https://github.com/AdvancedPhotonSource/ptychodus
96-
.. _`tike`: https://github.com/tomography/tike
96+
.. _`pty-chi`: https://github.com/AdvancedPhotonSource/pty-chi
9797
.. _`PtychoNN`: https://github.com/mcherukara/PtychoNN
9898
.. _`PvaPy`: https://github.com/epics-base/pvaPy

apptainer/ptychodus.def

Lines changed: 0 additions & 26 deletions
This file was deleted.

doc/api.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env python
2+
3+
from pathlib import Path
4+
from ptychodus.model import ModelCore
5+
6+
def main() -> int:
7+
settings_file = Path("path/to/settings.ini")
8+
9+
with ModelCore(settings_file) as model:
10+
input_product_api = model.workflow_api.create_product("new_product_name")
11+
output_product_api = input_product_api.reconstruct_local()
12+
output_product_api.save_product("/path/to/file.h5", file_type="HDF5")

doc/dist.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Distribution Instructions
2+
=========================
3+
4+
Python Package Index (PyPI)
5+
---------------------------
6+
7+
From the ptychodus directory, create wheel in ./dist/
8+
9+
.. code-block:: shell
10+
11+
$ python -m build .
12+
13+
Upload to PyPI
14+
15+
.. code-block:: shell
16+
17+
$ twine upload dist/*
18+
19+
Docker
20+
------
21+
22+
Build Docker image
23+
24+
.. code-block:: shell
25+
26+
$ podman build -t ptychodus:latest .
27+
28+
29+
Run container
30+
31+
.. code-block:: shell
32+
33+
$ xhost +local:podman
34+
$ podman run -it --rm -e "DISPLAY=$DISPLAY" -v "$HOME/.Xauthority:/root/.Xauthority:ro" --network host \
35+
--gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 python-ptychodus
36+
$ xhost -local:podman

polaris.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
engine:
2+
type: HighThroughputEngine
3+
max_workers_per_node: 1
4+
5+
# Un-comment to give each worker exclusive access to a single GPU
6+
# available_accelerators: 4
7+
8+
strategy:
9+
type: SimpleStrategy
10+
max_idletime: 3600
11+
12+
address:
13+
type: address_by_interface
14+
ifname: bond0
15+
16+
provider:
17+
type: PBSProProvider
18+
19+
launcher:
20+
type: MpiExecLauncher
21+
# Ensures 1 manger per node, work on all 64 cores
22+
bind_cmd: --cpu-bind
23+
overrides: --depth=64 --ppn 1
24+
25+
account: APSDataAnalysis
26+
queue: preemptable
27+
cpus_per_node: 32
28+
select_options: ngpus=4
29+
30+
# e.g., "#PBS -l filesystems=home:grand:eagle\n#PBS -k doe"
31+
scheduler_options: "#PBS -l filesystems=home:grand:eagle"
32+
33+
# Node setup: activate necessary conda environment and such
34+
worker_init: "source ~/miniconda3/etc/profile.d/conda.sh; conda activate ptychodus",
35+
36+
walltime: 01:00:00
37+
nodes_per_block: 1
38+
init_blocks: 0
39+
min_blocks: 0
40+
max_blocks: 2

pyproject.toml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
[build-system]
2-
requires = ["setuptools>=64", "setuptools_scm>=8"]
2+
requires = ["setuptools>=64", "setuptools_scm[toml]>=8"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "ptychodus"
77
description = "Ptychodus is a ptychography data analysis application."
88
readme = "README.rst"
99
requires-python = ">=3.10"
10-
license = {file = "LICENSE.txt"}
10+
license = {file = "LICENSE"}
1111
dependencies = [
12-
"h5py",
12+
"h5py>=3",
13+
"hdf5plugin",
1314
"matplotlib",
1415
"numpy",
1516
"psutil",
17+
"requests",
1618
"scikit-image",
1719
"scipy",
20+
"tables",
1821
"tifffile",
1922
"watchdog",
2023
]
@@ -24,10 +27,17 @@ dynamic = ["version"]
2427
ptychodus = "ptychodus.__main__:main"
2528

2629
[project.optional-dependencies]
27-
globus = ["gladier", "gladier-tools"]
30+
globus = ["gladier", "gladier-tools>=0.5.4"]
2831
gui = ["PyQt5"]
2932
ptychonn = ["ptychonn==0.3.*,>=0.3.7"]
3033
tike = ["tike==0.25.*,>=0.25.3"]
34+
ptychi = ["ptychi==1.*"]
35+
36+
[tool.setuptools.package-data]
37+
"ptychodus" = ["py.typed"]
38+
39+
[tool.setuptools.packages.find]
40+
where = ["src"]
3141

3242
[tool.setuptools_scm]
3343

@@ -44,6 +54,8 @@ module = [
4454
"hdf5plugin",
4555
"lightning.*",
4656
"parsl.*",
57+
"ptychi.*",
58+
"ptycho.*",
4759
"ptychonn.*",
4860
"pvaccess",
4961
"pvapy.*",
@@ -61,9 +73,11 @@ target-version = "py310"
6173
[tool.ruff.format]
6274
quote-style = "single"
6375

64-
[tool.setuptools.package-data]
65-
"ptychodus" = ["py.typed"]
66-
67-
[tool.setuptools.packages.find]
68-
where = ["src"]
76+
[tool.ruff.lint]
77+
select = [
78+
"N",
79+
"NPY",
80+
]
6981

82+
[tool.pyright]
83+
pythonVersion = "3.10"

requirements-dev.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
h5py
1+
build
2+
h5py>=3
23
hdf5plugin
34
matplotlib
45
mypy
56
numpy
67
psutil
78
pyqt
89
pyqt-stubs
10+
pytables
911
pytest
1012
python>=3.10
1113
ruff
@@ -16,4 +18,3 @@ setuptools_scm>=8
1618
tifffile
1719
toml
1820
watchdog
19-
wheel

src/ptychodus/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
pass
77

88
try:
9-
from .ptychodusAdImageProcessor import PtychodusAdImageProcessor
9+
from .ptychodus_stream_processor import PtychodusAdImageProcessor
1010
except ModuleNotFoundError:
1111
pass
1212

0 commit comments

Comments
 (0)