cdi-stools 0.2.0__tar.gz → 0.2.1__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.
- cdi_stools-0.2.1/CHANGELOG.md +142 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/PKG-INFO +7 -8
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/pyproject.toml +10 -16
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/__init__.py +1 -1
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/nn_experimental_loader.py +754 -47
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/nn_gui_tabs.py +128 -0
- cdi_stools-0.2.1/src/cdi_st/requirements.txt +41 -0
- cdi_stools-0.2.0/CHANGELOG.md +0 -80
- cdi_stools-0.2.0/src/cdi_st/requirements.txt +0 -31
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/.gitignore +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/LICENSE +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/README.md +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/CDI_ST_logo.png +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/__main__.py +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/bcdi_core.py +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/bcdi_gui.py +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/nn_autophase_infer.py +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/nn_autophase_model.py +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/nn_autophase_train.py +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/nn_data_generator.py +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/nn_dataset.py +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/nn_demo.py +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/nn_phase_model.py +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/nn_phase_retrieval.py +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/nn_train.py +0 -0
- {cdi_stools-0.2.0 → cdi_stools-0.2.1}/src/cdi_st/nn_visualize.py +0 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to CDI-ST are documented here.
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.2.1] — 2026-06-15
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- **PETRA III P10 / DESY Eiger compressed-data support.** Auto-imports
|
|
11
|
+
`hdf5plugin` at module load so bitshuffle + LZ4 compressed datasets
|
|
12
|
+
(the Eiger default at DESY P10 and many other beamlines) read
|
|
13
|
+
transparently. `hdf5plugin>=4.0` is now a runtime dependency.
|
|
14
|
+
- **HDF5 external-link resolution.** The P10 loader now enumerates and
|
|
15
|
+
resolves external links in master files instead of relying on h5py's
|
|
16
|
+
default link-following, which was unreliable on Windows. Each chunk is
|
|
17
|
+
opened directly to bypass any path-mangling. Master files with hundreds
|
|
18
|
+
of external links to chunk files (the standard Eiger layout) work out
|
|
19
|
+
of the box.
|
|
20
|
+
- **Scan range selection for P10** (new in the P10 converter dialog) —
|
|
21
|
+
similar to the ID01 SPEC+EDF scan browser. Avoids loading 49 GB of
|
|
22
|
+
detector frames into RAM when you only need the rocking-curve maximum:
|
|
23
|
+
- **Probe scan** button reads chunk metadata only (no decompression),
|
|
24
|
+
instantly reporting total frame count, detector shape, and estimated
|
|
25
|
+
full-load memory footprint.
|
|
26
|
+
- **Frame range** (`from`, `to`) reads only the requested global frame
|
|
27
|
+
range across all chunks. Loaded chunk-by-chunk so memory scales with
|
|
28
|
+
the chosen range, not the total dataset size.
|
|
29
|
+
- **Detector ROI** reads a centered square ROI from each frame instead
|
|
30
|
+
of the full detector. For BCDI you typically only need ~256×256
|
|
31
|
+
around the Bragg peak — cuts memory by `(2167*2070)/(roi²)` for
|
|
32
|
+
Eiger 4M data.
|
|
33
|
+
- **Memory budget** (default 8 GB) — the loader refuses reads that
|
|
34
|
+
would exceed this and tells you which `frame_range` would fit,
|
|
35
|
+
instead of crashing the Python process with an OOM error.
|
|
36
|
+
- **Programmatic API additions** to `nn_experimental_loader`:
|
|
37
|
+
`p10_scan_info()` for cheap metadata previews, plus new
|
|
38
|
+
`frame_range`, `detector_roi`, `memory_budget_gb` parameters on
|
|
39
|
+
`load_p10_from_external_links()` and `p10_h5_to_npz()`.
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
- Cryptic "Can't synchronously read data (can't open directory)" error
|
|
43
|
+
on P10 / Eiger files. The message was HDF5 looking for the compression
|
|
44
|
+
plugin DLL in a non-existent directory — now caught and converted to
|
|
45
|
+
a clear "install hdf5plugin" instruction.
|
|
46
|
+
- AutoPhase_NN tab missing `_on_epoch` slot (introduced in 0.2.0 during
|
|
47
|
+
the live-curve refactor; AutoPhase_NN's `epoch_done` signal had no
|
|
48
|
+
receiver and emitted unhandled errors). Restored.
|
|
49
|
+
- CDI_NN `KeyError: 'phase_true'` — `BCDIDataset.__getitem__` now exposes
|
|
50
|
+
the GUI's expected keys (`phase_true`, `amplitude`) alongside the legacy
|
|
51
|
+
ones (`target_phase`, `input`).
|
|
52
|
+
- `BCDIPhaseLoss` accepts both the GUI's descriptive kwargs (`alpha_amp`,
|
|
53
|
+
`beta_phase`, `gamma_diff`, `diff_amp`) and the original short ones
|
|
54
|
+
(`alpha`, `beta`, `gamma`, `amplitude`). Either spelling now works.
|
|
55
|
+
- Training Stop button no longer crashes the program. `QThread.terminate()`
|
|
56
|
+
was killing PyTorch mid-`backward()` and corrupting CUDA / autograd
|
|
57
|
+
state — replaced with a cooperative `request_stop()` flag that the
|
|
58
|
+
training loop checks at batch / epoch boundaries, then exits cleanly
|
|
59
|
+
with a saved checkpoint.
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
- Live training curve in AutoPhase_NN and CDI_NN — the dashed "running"
|
|
63
|
+
line updates every ~2 s during training so users can see progress
|
|
64
|
+
immediately on slow CPU runs (rather than staring at a blank plot
|
|
65
|
+
for an entire epoch).
|
|
66
|
+
- `inspect_h5()` now properly shows external links with their target
|
|
67
|
+
files and `[OK]` / `[MISSING]` markers. The empty-looking `/entry/data/`
|
|
68
|
+
group on Eiger masters is no longer misleading.
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## [0.1.3] — 2026-05-20
|
|
72
|
+
|
|
73
|
+
### Fixed
|
|
74
|
+
- Fixed exporting VTI to Paraview
|
|
75
|
+
|
|
76
|
+
### Added
|
|
77
|
+
- SPEC+EDF converter: Added option to convert multiple scans
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## [0.1.2] — 2026-05-20
|
|
81
|
+
|
|
82
|
+
### Fixed
|
|
83
|
+
- SPEC+EDF converter: scan listing, frame range display, clear errors when EDFs fail to load
|
|
84
|
+
- silx data column indexing
|
|
85
|
+
- `find_bragg_peak_box` slice/int crash on empty volumes
|
|
86
|
+
|
|
87
|
+
### Added
|
|
88
|
+
- "Browse scans…" button in SPEC+EDF dialog
|
|
89
|
+
|
|
90
|
+
## [0.1.1] — 2026-05-20
|
|
91
|
+
|
|
92
|
+
### Fixed
|
|
93
|
+
- SPEC+EDF converter crash with "slice - int" error when EDF files could not be loaded (`find_bragg_peak_box` now returns coordinates instead of slices in the zero-volume fallback)
|
|
94
|
+
- silx data column indexing was wrong — modern silx returns `data.shape == (nlines, ncolumns)`, so `data[i]` was the i-th measurement row, not the i-th column. Now uses `scan.data_column_by_name(label)` with shape-aware fallback
|
|
95
|
+
- Clear error message when no EDF frames can be loaded (lists likely causes instead of crashing later)
|
|
96
|
+
- SPEC+EDF converter now prints the frame range of the chosen scan before loading
|
|
97
|
+
|
|
98
|
+
### Added
|
|
99
|
+
- New "Browse scans…" button in SPEC+EDF dialog: lists every scan in the SPEC file with its CCD frame range, so users can pick the scan matching their downloaded EDF files
|
|
100
|
+
- New `list_spec_scans()` helper in `nn_experimental_loader.py`
|
|
101
|
+
|
|
102
|
+
### Changed
|
|
103
|
+
- Renamed output field "Output .npz:" to "Output file (.npz):" with clarifying placeholder and tooltip
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
## [0.1.0] — Alpha — 2026-05-08
|
|
107
|
+
|
|
108
|
+
### Added
|
|
109
|
+
- **Initial public release** of CDI-ST as a packaged Python application.
|
|
110
|
+
- BCDI Simulation module (Material → Beam → Results)
|
|
111
|
+
- Material presets: Si, Ge, Pt, Au, SiC, GaAs, and more
|
|
112
|
+
- CIF import for arbitrary crystals
|
|
113
|
+
- Particle shapes: cube, sphere, cylinder, hexagonal prism, octahedron, dodecahedron
|
|
114
|
+
- Strain fields: radial gradient, edge dislocation, random
|
|
115
|
+
- Configurable line dislocations: edge / screw / mixed with arbitrary Burgers vector
|
|
116
|
+
- 3D atomic lattice viewer (Plotly)
|
|
117
|
+
- Detector presets: Maxipix 2×2, Eiger 2M, custom rectangular
|
|
118
|
+
- Analytical and FFT simulation paths
|
|
119
|
+
- BCDI Data Analysis module (Generate Data → AutoPhase_NN → CDI_NN → Reconstruction → 3D Viewer)
|
|
120
|
+
- Training-data generator with random material/shape/size/strain/dislocation
|
|
121
|
+
- Toggles for randomized strain and dislocations
|
|
122
|
+
- AutoPhaseNet3D (unsupervised, dual-decoder, physics-driven loss)
|
|
123
|
+
- PhaseUNet3D (supervised, BCDI loss with α/β/γ weights)
|
|
124
|
+
- Inference: NN-only, refined (HIO+RAAR+ER), ensemble, compare
|
|
125
|
+
- Iterative phase retrieval: HIO (β=0.9), RAAR (β=0.9), ER, with shrink-wrap
|
|
126
|
+
- Experimental data loader: HDF5, ID01 SPEC+EDF, q-space orthogonalization
|
|
127
|
+
- Detector chip-gap masking, hot pixel removal, beamstop streak removal
|
|
128
|
+
- 3D viewer with point cloud / isosurface / surface-only modes
|
|
129
|
+
- Per-voxel opacity weighted by intensity
|
|
130
|
+
- VTI export for ParaView
|
|
131
|
+
- Splash screen and theme-matched launcher
|
|
132
|
+
- In-app Reports & Suggestions feature
|
|
133
|
+
- Cross-platform support (Linux, macOS, Windows) via PyQt6
|
|
134
|
+
- MIT license, full source on GitHub
|
|
135
|
+
|
|
136
|
+
### Known limitations (alpha)
|
|
137
|
+
- Q-space orthogonalization is ID01-specific (can be extended)
|
|
138
|
+
- Some checkpoints from earlier prototypes lack `grid_size` metadata
|
|
139
|
+
- Mask-aware modulus constraint not yet implemented (gaps are filled instead)
|
|
140
|
+
|
|
141
|
+
[Unreleased]: https://github.com/SAIDIsoufiane/CDI-St/compare/v0.1.0...HEAD
|
|
142
|
+
[0.1.0]: https://github.com/SAIDIsoufiane/CDI-St/releases/tag/v0.1.0
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cdi-stools
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Coherent Diffraction Imaging Simulation Tools — BCDI simulation and NN-based phase retrieval
|
|
5
|
-
Project-URL: Homepage, https://github.com/
|
|
6
|
-
Project-URL: Documentation, https://github.com/
|
|
7
|
-
Project-URL: Repository, https://github.com/
|
|
8
|
-
Project-URL: Issues, https://github.com/
|
|
9
|
-
Project-URL: Changelog, https://github.com/
|
|
5
|
+
Project-URL: Homepage, https://github.com/SAIDIsoufiane/CDI-St
|
|
6
|
+
Project-URL: Documentation, https://github.com/SAIDIsoufiane/CDI-St#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/SAIDIsoufiane/CDI-St
|
|
8
|
+
Project-URL: Issues, https://github.com/SAIDIsoufiane/CDI-St/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/SAIDIsoufiane/CDI-St/blob/main/CHANGELOG.md
|
|
10
10
|
Author-email: Soufiane SAIDI <saidisoufiane@hotmail.com>
|
|
11
11
|
License-Expression: MIT
|
|
12
12
|
License-File: LICENSE
|
|
@@ -21,13 +21,12 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.10
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.11
|
|
23
23
|
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
26
24
|
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
27
25
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
28
26
|
Requires-Python: >=3.9
|
|
29
27
|
Requires-Dist: diffpy-structure>=3.1
|
|
30
28
|
Requires-Dist: h5py>=3.7
|
|
29
|
+
Requires-Dist: hdf5plugin>=4.0
|
|
31
30
|
Requires-Dist: matplotlib>=3.6
|
|
32
31
|
Requires-Dist: numpy>=1.22
|
|
33
32
|
Requires-Dist: pandas>=1.5
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "cdi-stools"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.1"
|
|
8
8
|
description = "Coherent Diffraction Imaging Simulation Tools — BCDI simulation and NN-based phase retrieval"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -35,8 +35,6 @@ classifiers = [
|
|
|
35
35
|
"Programming Language :: Python :: 3.10",
|
|
36
36
|
"Programming Language :: Python :: 3.11",
|
|
37
37
|
"Programming Language :: Python :: 3.12",
|
|
38
|
-
"Programming Language :: Python :: 3.13",
|
|
39
|
-
"Programming Language :: Python :: 3.14",
|
|
40
38
|
"Environment :: X11 Applications :: Qt",
|
|
41
39
|
]
|
|
42
40
|
|
|
@@ -49,6 +47,7 @@ dependencies = [
|
|
|
49
47
|
"PyQt6-WebEngine>=6.4",
|
|
50
48
|
"torch>=2.0",
|
|
51
49
|
"h5py>=3.7",
|
|
50
|
+
"hdf5plugin>=4.0",
|
|
52
51
|
"scikit-image>=0.20",
|
|
53
52
|
"diffpy.structure>=3.1",
|
|
54
53
|
"plotly>=5.13",
|
|
@@ -76,16 +75,15 @@ dev = [
|
|
|
76
75
|
]
|
|
77
76
|
|
|
78
77
|
[project.urls]
|
|
79
|
-
Homepage = "https://github.com/
|
|
80
|
-
Documentation = "https://github.com/
|
|
81
|
-
Repository = "https://github.com/
|
|
82
|
-
Issues = "https://github.com/
|
|
83
|
-
Changelog = "https://github.com/
|
|
78
|
+
Homepage = "https://github.com/SAIDIsoufiane/CDI-St"
|
|
79
|
+
Documentation = "https://github.com/SAIDIsoufiane/CDI-St#readme"
|
|
80
|
+
Repository = "https://github.com/SAIDIsoufiane/CDI-St"
|
|
81
|
+
Issues = "https://github.com/SAIDIsoufiane/CDI-St/issues"
|
|
82
|
+
Changelog = "https://github.com/SAIDIsoufiane/CDI-St/blob/main/CHANGELOG.md"
|
|
84
83
|
|
|
85
84
|
# Console command: typing `cdi-st` in the terminal launches the GUI
|
|
86
85
|
[project.scripts]
|
|
87
86
|
cdi-st = "cdi_st.bcdi_gui:main"
|
|
88
|
-
cdi-stools = "cdi_st.bcdi_gui:main"
|
|
89
87
|
|
|
90
88
|
# ── Hatchling build configuration ───────────────────────────────────────────
|
|
91
89
|
# Tell Hatchling where the source lives and which non-Python files to include.
|
|
@@ -110,16 +108,12 @@ line-length = 100
|
|
|
110
108
|
target-version = "py39"
|
|
111
109
|
|
|
112
110
|
[tool.ruff.lint]
|
|
111
|
+
# Pragmatic linting — most existing code already breaks heavy strict mode
|
|
113
112
|
select = ["E", "F", "W", "I", "UP"]
|
|
114
113
|
ignore = [
|
|
115
|
-
"E501", # line too long
|
|
116
|
-
"E402", # module-level import not at top
|
|
114
|
+
"E501", # line too long — many scientific lines exceed 100
|
|
115
|
+
"E402", # module-level import not at top — common with conditional Qt imports
|
|
117
116
|
"E731", # don't assign a lambda
|
|
118
|
-
"E702", # multiple statements on one line (semicolon) — used heavily in this codebase
|
|
119
|
-
"F841", # local variable assigned but never used — common with placeholder im0/im1
|
|
120
|
-
"E741", # ambiguous variable name (l, I, O)
|
|
121
|
-
"W291", # trailing whitespace
|
|
122
|
-
"W293", # whitespace on blank line
|
|
123
117
|
]
|
|
124
118
|
|
|
125
119
|
[tool.pytest.ini_options]
|
|
@@ -5,7 +5,7 @@ A Python application for end-to-end Bragg Coherent Diffraction Imaging (BCDI):
|
|
|
5
5
|
crystal lattice construction, X-ray scattering simulation, neural-network
|
|
6
6
|
phase retrieval, and 3D visualization.
|
|
7
7
|
"""
|
|
8
|
-
__version__ = "0.2.
|
|
8
|
+
__version__ = "0.2.1"
|
|
9
9
|
__author__ = "Soufiane SAIDI"
|
|
10
10
|
__email__ = "saidisoufiane@hotmail.com"
|
|
11
11
|
__license__ = "MIT"
|