Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pty-chi #103

Draft
wants to merge 62 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
6f72492
merge previous work
stevehenke Oct 27, 2024
2d2aceb
begin updates
stevehenke Oct 27, 2024
ba93c9c
finish updates
stevehenke Oct 28, 2024
8d552c7
more renaming
stevehenke Oct 28, 2024
98ff764
add pty-chi reconstructor library and view controller factory
stevehenke Oct 28, 2024
f515f4e
prototype pty-chi view controllers
stevehenke Oct 30, 2024
a1e2d54
start implementing pty-chi view controllers
stevehenke Oct 31, 2024
81bfdd4
implement pty-chi reconstructor view-controller
stevehenke Oct 31, 2024
598a05b
implement most of pty-chi view-controllers
stevehenke Nov 1, 2024
a991d88
add new options to pty-chi interface
stevehenke Nov 1, 2024
d699b4a
reconstruct in separate thread
stevehenke Nov 2, 2024
0c2ceb8
rename scan to positions in toolbar
stevehenke Nov 4, 2024
2490798
reconstruct in thread; add progress dialog
stevehenke Nov 4, 2024
41bea52
more globus fixes
stevehenke Nov 5, 2024
f1ffd96
pty-chi enumerators
stevehenke Nov 5, 2024
0dab6cc
update pty-chi reconstructors
stevehenke Nov 5, 2024
84b77a3
testing fixes
stevehenke Nov 5, 2024
2824770
more testing fixes
stevehenke Nov 5, 2024
f49b266
remove ptychopack/pie
stevehenke Nov 5, 2024
5447ab2
update pty-chi reconstructor options
stevehenke Nov 6, 2024
510d74c
update pty-chi object options
stevehenke Nov 6, 2024
5cfccce
update pty-chi probe options
stevehenke Nov 6, 2024
75916d3
update pty-chi probe position options
stevehenke Nov 6, 2024
53f0546
expose ePIE and rPIE
stevehenke Nov 6, 2024
7ca6f56
hacks to make things work
stevehenke Nov 6, 2024
ddec3ae
add DM support and other minor fixes
stevehenke Nov 13, 2024
68eb970
remove ptychopack
stevehenke Nov 13, 2024
c9159de
start requested GUI changes
stevehenke Nov 13, 2024
2733a55
update pty-chi interface (almost everything)
stevehenke Nov 15, 2024
5923e2d
change product metadata dof from photon flux -> count
stevehenke Nov 18, 2024
a23f9be
refactor patterns controller
stevehenke Nov 19, 2024
b7cc14a
clean up patterns core
stevehenke Nov 19, 2024
3fe9de0
minimal OPR support
stevehenke Nov 25, 2024
b867cda
pty-chi position options
stevehenke Nov 26, 2024
9a9b121
draft Dockerfile; change multilayer object distance conventions; impr…
stevehenke Dec 2, 2024
2d0380d
fix empty sequence parameter init
stevehenke Dec 2, 2024
fb5ab94
update file readers: CXI, SLAC, ptychoshelves
stevehenke Dec 2, 2024
f88ec09
adapt to pty-chi coordinate conventions
stevehenke Dec 3, 2024
b1a292d
clear visualization when array is not finite
stevehenke Dec 3, 2024
1fb3722
improve ptychoshelves product reader; add cSAXS diffraction reader
stevehenke Dec 6, 2024
9652d16
fix extra probe modes
stevehenke Dec 8, 2024
506236b
nsls-ii data readers
stevehenke Dec 9, 2024
733f213
update packaging to support wheels
stevehenke Dec 10, 2024
d31b942
fix typo
stevehenke Dec 10, 2024
c643306
update pty-chi integration & add tool-tips
stevehenke Dec 11, 2024
36d66a9
add algorithm-specific options to model
stevehenke Dec 12, 2024
41ddb17
misc requested fixes
stevehenke Dec 12, 2024
0f60b9c
docker image works
stevehenke Dec 13, 2024
62ad6e6
updated docker image to include pty-chi and GPU support
stevehenke Dec 13, 2024
3ef9146
rescale model probe power when photon count > 0
stevehenke Dec 18, 2024
4451ee7
add OPR mode weights smoothing options
stevehenke Dec 18, 2024
67f6378
update pty-chi interface
stevehenke Jan 9, 2025
2e60d8a
FEAT: phase unwrapping and multislice object initializer (#105)
mdw771 Jan 17, 2025
9c0617f
merge misc improvements from another branch
stevehenke Jan 23, 2025
3aefd09
break stuff
stevehenke Jan 27, 2025
950e60e
fix stuff
stevehenke Jan 28, 2025
8664581
fix tests
stevehenke Jan 28, 2025
b898173
update algorithm-specific options in model
stevehenke Jan 28, 2025
4f47504
add autodiff settings
stevehenke Jan 28, 2025
b55492a
update base options in view
stevehenke Jan 29, 2025
286053b
custom reconstructor options to view (partial)
stevehenke Jan 29, 2025
e6c06a5
finish algorithm-specific options
stevehenke Jan 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#FROM python:3.12-slim-bullseye
FROM pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime

RUN apt-get update && \
apt-get install -y libqt5gui5 && \
rm -rf /var/lib/apt/lists/*
#ENV QT_DEBUG_PLUGINS=1

# Upgrade pip
RUN python3 -m pip install --upgrade pip

# Set the working directory in the container
WORKDIR /app

# Copy the wheel file into the container at /app
COPY dist/ptychodus-*.whl dist/ptychi-*.whl .

# Install the wheel
RUN python3 -m pip install --no-cache-dir --find-links=. ptychodus[globus,gui] ptychi && \
rm ptychodus-*.whl ptychi-*.whl

# Run ptychodus when the container launches
CMD ["python3", "-m", "ptychodus"]
26 changes: 0 additions & 26 deletions apptainer/ptychodus.def

This file was deleted.

47 changes: 47 additions & 0 deletions doc/dist.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Distribution Instructions
=========================

Python Package Index (PyPI)
---------------------------

From the ptychodus directory, create wheel in ./dist/

.. code-block:: shell

$ python -m build .

Upload to PyPI

.. code-block:: shell

$ twine upload dist/*

Docker
------

Build Docker image

.. code-block:: shell

$ time docker build -t python-ptychodus .

Run container

.. code-block:: shell

$ xhost +local:docker
$ docker run -it --rm -e "DISPLAY=$DISPLAY" -v "$HOME/.Xauthority:/root/.Xauthority:ro" --network host \
--gpus all --ipc=host --ulimit memlock=-1 --ulimit stack=67108864 python-ptychodus
$ xhost -local:docker

Check container status

.. code-block:: shell

$ docker ps -a

Clean up images

.. code-block:: shell

$ sudo docker system prune -a
40 changes: 40 additions & 0 deletions polaris.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
engine:
type: HighThroughputEngine
max_workers_per_node: 1

# Un-comment to give each worker exclusive access to a single GPU
# available_accelerators: 4

strategy:
type: SimpleStrategy
max_idletime: 3600

address:
type: address_by_interface
ifname: bond0

provider:
type: PBSProProvider

launcher:
type: MpiExecLauncher
# Ensures 1 manger per node, work on all 64 cores
bind_cmd: --cpu-bind
overrides: --depth=64 --ppn 1

account: APSDataAnalysis
queue: preemptable
cpus_per_node: 32
select_options: ngpus=4

# e.g., "#PBS -l filesystems=home:grand:eagle\n#PBS -k doe"
scheduler_options: "#PBS -l filesystems=home:grand:eagle"

# Node setup: activate necessary conda environment and such
worker_init: "source ~/miniconda3/etc/profile.d/conda.sh; conda activate ptychodus",

walltime: 01:00:00
nodes_per_block: 1
init_blocks: 0
min_blocks: 0
max_blocks: 2
24 changes: 13 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
[build-system]
requires = ["setuptools>=64", "setuptools_scm>=8"]
requires = ["setuptools>=64", "setuptools_scm[toml]>=8"]
build-backend = "setuptools.build_meta"

[project]
name = "ptychodus"
description = "Ptychodus is a ptychography data analysis application."
readme = "README.rst"
requires-python = ">=3.10"
license = {file = "LICENSE.txt"}
license = {file = "LICENSE"}
dependencies = [
"h5py",
"h5py>=3",
"hdf5plugin",
"matplotlib",
"numpy",
"psutil",
"scikit-image",
"scipy",
"tables",
"tifffile",
"watchdog",
]
Expand All @@ -24,11 +26,17 @@ dynamic = ["version"]
ptychodus = "ptychodus.__main__:main"

[project.optional-dependencies]
globus = ["gladier", "gladier-tools"]
globus = ["gladier", "gladier-tools>=0.5.4"]
gui = ["PyQt5"]
ptychonn = ["ptychonn==0.3.*,>=0.3.7"]
tike = ["tike==0.25.*,>=0.25.3"]

[tool.setuptools.package-data]
"ptychodus" = ["py.typed"]

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools_scm]

[tool.mypy]
Expand All @@ -44,6 +52,7 @@ module = [
"hdf5plugin",
"lightning.*",
"parsl.*",
"ptychi.*",
"ptychonn.*",
"pvaccess",
"pvapy.*",
Expand All @@ -60,10 +69,3 @@ target-version = "py310"

[tool.ruff.format]
quote-style = "single"

[tool.setuptools.package-data]
"ptychodus" = ["py.typed"]

[tool.setuptools.packages.find]
where = ["src"]

5 changes: 3 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
h5py
build
h5py>=3
hdf5plugin
matplotlib
mypy
numpy
psutil
pyqt
pyqt-stubs
pytables
pytest
python>=3.10
ruff
Expand All @@ -16,4 +18,3 @@ setuptools_scm>=8
tifffile
toml
watchdog
wheel
4 changes: 4 additions & 0 deletions src/ptychodus/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

from pathlib import Path
import argparse
import logging
import sys

from ptychodus.model import ModelCore
import ptychodus

logger = logging.getLogger(__name__)


def versionString() -> str:
return f'{ptychodus.__name__.title()} ({ptychodus.__version__})'
Expand Down Expand Up @@ -120,6 +123,7 @@ def main() -> int:
try:
from PyQt5.QtWidgets import QApplication
except ModuleNotFoundError:
logger.warning('PyQt5 not found.')
return 0

# QApplication expects the first argument to be the program name
Expand Down
6 changes: 0 additions & 6 deletions src/ptychodus/api/constants.py

This file was deleted.

6 changes: 6 additions & 0 deletions src/ptychodus/api/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ class PixelGeometry:
widthInMeters: float
heightInMeters: float

def copy(self) -> PixelGeometry:
return PixelGeometry(
widthInMeters=float(self.widthInMeters),
heightInMeters=float(self.heightInMeters),
)

def __repr__(self) -> str:
return f'{type(self).__name__}({self.widthInMeters}, {self.heightInMeters})'

Expand Down
Loading
Loading