ptylab 0.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ptylab-0.2.5/PKG-INFO +150 -0
- ptylab-0.2.5/PtyLab/Engines/BaseEngine.py +1859 -0
- ptylab-0.2.5/PtyLab/Engines/OPR.py +279 -0
- ptylab-0.2.5/PtyLab/Engines/__init__.py +33 -0
- ptylab-0.2.5/PtyLab/Engines/aPIE.py +357 -0
- ptylab-0.2.5/PtyLab/Engines/e3PIE.py +235 -0
- ptylab-0.2.5/PtyLab/Engines/ePIE.py +157 -0
- ptylab-0.2.5/PtyLab/Engines/ePIE_TV.py +191 -0
- ptylab-0.2.5/PtyLab/Engines/mPIE.py +270 -0
- ptylab-0.2.5/PtyLab/Engines/mPIE_tv.py +246 -0
- ptylab-0.2.5/PtyLab/Engines/mqNewton.py +251 -0
- ptylab-0.2.5/PtyLab/Engines/multiPIE.py +205 -0
- ptylab-0.2.5/PtyLab/Engines/pcPIE.py +202 -0
- ptylab-0.2.5/PtyLab/Engines/qNewton.py +140 -0
- ptylab-0.2.5/PtyLab/Engines/zPIE.py +364 -0
- ptylab-0.2.5/PtyLab/ExperimentalData/ExperimentalData.py +288 -0
- ptylab-0.2.5/PtyLab/ExperimentalData/__init__.py +1 -0
- ptylab-0.2.5/PtyLab/GridGeneration/FermatGridGenerator.py +130 -0
- ptylab-0.2.5/PtyLab/GridGeneration/__init__.py +0 -0
- ptylab-0.2.5/PtyLab/Monitor/Monitor.py +361 -0
- ptylab-0.2.5/PtyLab/Monitor/Plots.py +334 -0
- ptylab-0.2.5/PtyLab/Monitor/README.md +13 -0
- ptylab-0.2.5/PtyLab/Monitor/TensorboardMonitor.py +558 -0
- ptylab-0.2.5/PtyLab/Monitor/__init__.py +0 -0
- ptylab-0.2.5/PtyLab/Operators/Operators.py +1099 -0
- ptylab-0.2.5/PtyLab/Operators/README.md +8 -0
- ptylab-0.2.5/PtyLab/Operators/__init__.py +1 -0
- ptylab-0.2.5/PtyLab/Operators/_propagation_kernels.py +36 -0
- ptylab-0.2.5/PtyLab/Params/Params.py +217 -0
- ptylab-0.2.5/PtyLab/Params/__init__.py +0 -0
- ptylab-0.2.5/PtyLab/ProbeEngines/OPRP.py +151 -0
- ptylab-0.2.5/PtyLab/ProbeEngines/StandardProbe.py +105 -0
- ptylab-0.2.5/PtyLab/ProbeEngines/__init__.py +1 -0
- ptylab-0.2.5/PtyLab/Reconstruction/CalibrationFPM.py +919 -0
- ptylab-0.2.5/PtyLab/Reconstruction/Reconstruction.py +875 -0
- ptylab-0.2.5/PtyLab/Reconstruction/__init__.py +0 -0
- ptylab-0.2.5/PtyLab/Regularizers/__init__.py +207 -0
- ptylab-0.2.5/PtyLab/__init__.py +56 -0
- ptylab-0.2.5/PtyLab/io/__init__.py +12 -0
- ptylab-0.2.5/PtyLab/io/generateSimulationData.py +135 -0
- ptylab-0.2.5/PtyLab/io/readExample.py +70 -0
- ptylab-0.2.5/PtyLab/io/readHdf5.py +125 -0
- ptylab-0.2.5/PtyLab/utils/__init__.py +0 -0
- ptylab-0.2.5/PtyLab/utils/alignment.py +52 -0
- ptylab-0.2.5/PtyLab/utils/cli.py +50 -0
- ptylab-0.2.5/PtyLab/utils/downloader.py +39 -0
- ptylab-0.2.5/PtyLab/utils/fsvd.py +105 -0
- ptylab-0.2.5/PtyLab/utils/gpuUtils.py +103 -0
- ptylab-0.2.5/PtyLab/utils/initializationFunctions.py +62 -0
- ptylab-0.2.5/PtyLab/utils/scanGrids.py +313 -0
- ptylab-0.2.5/PtyLab/utils/utils.py +312 -0
- ptylab-0.2.5/PtyLab/utils/visualisation.py +340 -0
- ptylab-0.2.5/README.md +115 -0
- ptylab-0.2.5/pyproject.toml +57 -0
- ptylab-0.2.5/pyproject.toml.orig +54 -0
ptylab-0.2.5/PKG-INFO
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: ptylab
|
|
3
|
+
Version: 0.2.5
|
|
4
|
+
Summary: A cross-platform, open-source inverse modeling toolbox for conventional and Fourier ptychography
|
|
5
|
+
Author: Lars Loetgering, PtyLab Team
|
|
6
|
+
Author-email: Lars Loetgering <lars.loetgering@fulbrightmail.org>
|
|
7
|
+
Requires-Dist: numpy~=2.0
|
|
8
|
+
Requires-Dist: matplotlib~=3.7
|
|
9
|
+
Requires-Dist: h5py~=3.9
|
|
10
|
+
Requires-Dist: scipy~=1.11
|
|
11
|
+
Requires-Dist: scikit-image>=0.21.0
|
|
12
|
+
Requires-Dist: scikit-learn~=1.3
|
|
13
|
+
Requires-Dist: tqdm~=4.65
|
|
14
|
+
Requires-Dist: pyqtgraph~=0.13
|
|
15
|
+
Requires-Dist: tables~=3.8
|
|
16
|
+
Requires-Dist: bokeh~=3.2
|
|
17
|
+
Requires-Dist: pyqt5~=5.15
|
|
18
|
+
Requires-Dist: ipython~=8.18
|
|
19
|
+
Requires-Dist: ipywidgets>=8.1.8
|
|
20
|
+
Requires-Dist: black~=23.7 ; extra == 'dev'
|
|
21
|
+
Requires-Dist: ipykernel~=6.25 ; extra == 'dev'
|
|
22
|
+
Requires-Dist: pytest~=9.0 ; extra == 'dev'
|
|
23
|
+
Requires-Dist: imageio~=2.0 ; extra == 'dev'
|
|
24
|
+
Requires-Dist: mkdocs>=1.6.1 ; extra == 'docs'
|
|
25
|
+
Requires-Dist: mkdocs-material>=9.7.6 ; extra == 'docs'
|
|
26
|
+
Requires-Dist: mkdocs-jupyter>=0.24 ; extra == 'docs'
|
|
27
|
+
Requires-Dist: cupy-cuda12x[ctk] ; extra == 'gpu'
|
|
28
|
+
Requires-Dist: tensorflow~=2.14 ; extra == 'tensorflow'
|
|
29
|
+
Requires-Python: >=3.10, <3.14
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Provides-Extra: docs
|
|
32
|
+
Provides-Extra: gpu
|
|
33
|
+
Provides-Extra: tensorflow
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# PtyLab.py: Unified Ptychography Toolbox
|
|
37
|
+

|
|
38
|
+
[](https://pypi.org/project/ptylab/)
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
[**Getting Started**](#getting-started) | [**Installation**](#installation) | [**Development**](#development) | [**Documentation**](https://ptylab.github.io/PtyLab.py/)
|
|
42
|
+
|
|
43
|
+
PtyLab is an inverse modeling toolbox for Conventional (CP) and Fourier (FP) ptychography in a unified framework. For more information please check the [paper](https://opg.optica.org/oe/fulltext.cfm?uri=oe-31-9-13763&id=529026).
|
|
44
|
+
|
|
45
|
+
## Key Features
|
|
46
|
+
|
|
47
|
+
- **Classic engines**: ePIE, mPIE, mqNewton, qNewton
|
|
48
|
+
- **Advanced corrections**: position correction (pcPIE), defocus correction (zPIE), angle correction (aPIE), orthogonal probe relaxation (OPR)
|
|
49
|
+
- **Multi-modal**: multi-slice, multi-wavelength, mixed-state object and probe
|
|
50
|
+
- **Multiple propagators**: Fraunhofer, Fresnel, Angular Spectrum (ASP), scaled ASP, polychromatic variants
|
|
51
|
+
- **GPU acceleration**: same code runs on CPU and GPU
|
|
52
|
+
|
|
53
|
+
The reconstructed output is a 6D array of shape `(nlambda, nosm, npsm, nslice, No, No)`:
|
|
54
|
+
|
|
55
|
+
| Dim | Meaning |
|
|
56
|
+
|-----|---------|
|
|
57
|
+
| `nlambda` | wavelengths |
|
|
58
|
+
| `nosm` | object state mixture |
|
|
59
|
+
| `npsm` | probe state mixture |
|
|
60
|
+
| `nslice` | depth slices |
|
|
61
|
+
| `No` | output frame size |
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
## Getting started
|
|
65
|
+
|
|
66
|
+
Try the demo in Google Colab:
|
|
67
|
+
|
|
68
|
+
[](https://colab.research.google.com/github/PtyLab/PtyLab.py/blob/main/demo.ipynb)
|
|
69
|
+

|
|
70
|
+
|
|
71
|
+
For more use cases, start with the [tutorials](https://ptylab.github.io/PtyLab.py/tutorials/) in our documentation, then see the [example_scripts](https://github.com/PtyLab/PtyLab.py/tree/main/example_scripts) directory.
|
|
72
|
+
|
|
73
|
+
## Installation
|
|
74
|
+
|
|
75
|
+
Install from PyPI within your virtual environment:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install ptylab
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
> [!NOTE]
|
|
82
|
+
> For much faster installs, we recommend [uv](https://docs.astral.sh/uv/getting-started/installation/): `uv pip install ptylab`
|
|
83
|
+
|
|
84
|
+
This package uses `cupy` to utilize GPU for faster reconstruction. To enable GPU support:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install "ptylab[gpu]"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
For the latest unreleased changes on `main`:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pip install git+https://github.com/PtyLab/PtyLab.py.git
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Check GPU detection:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
ptylab check gpu
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Development
|
|
103
|
+
|
|
104
|
+
Clone the repo and install dev dependencies with [uv](https://docs.astral.sh/uv/getting-started/installation/):
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
git clone git@github.com:PtyLab/PtyLab.py.git
|
|
108
|
+
cd PtyLab.py
|
|
109
|
+
uv sync --extra dev
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
This creates a `.venv` virtual environment in the project root. Select this environment from your IDE.
|
|
113
|
+
|
|
114
|
+
To use the GPU as well, install with the `gpu` flag:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
uv sync --extra dev,gpu
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
and check if GPU is detected with `uv run ptylab check gpu`.
|
|
121
|
+
|
|
122
|
+
Add tests for new behaviour and run the suite:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
uv run pytest tests
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
CI runs this on every PR. Please bump the package version when modifying dependencies.
|
|
129
|
+
|
|
130
|
+
Releases are published to PyPI automatically: bump `version` in `pyproject.toml`, then publish a GitHub Release tagged `v<version>`.
|
|
131
|
+
|
|
132
|
+
## Citation
|
|
133
|
+
|
|
134
|
+
If you use this package, please cite:
|
|
135
|
+
|
|
136
|
+
```tex
|
|
137
|
+
@article{Loetgering:23,
|
|
138
|
+
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},
|
|
139
|
+
journal = {Opt. Express},
|
|
140
|
+
number = {9},
|
|
141
|
+
pages = {13763--13797},
|
|
142
|
+
publisher = {Optica Publishing Group},
|
|
143
|
+
title = {PtyLab.m/py/jl: a cross-platform, open-source inverse modeling toolbox for conventional and Fourier ptychography},
|
|
144
|
+
volume = {31},
|
|
145
|
+
month = {Apr},
|
|
146
|
+
year = {2023},
|
|
147
|
+
doi = {10.1364/OE.485370},
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|