cdi-stools 0.2.0__tar.gz → 0.2.2__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.
Files changed (26) hide show
  1. cdi_stools-0.2.2/CHANGELOG.md +122 -0
  2. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/PKG-INFO +7 -8
  3. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/README.md +279 -279
  4. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/pyproject.toml +10 -16
  5. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/__init__.py +1 -1
  6. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/__main__.py +5 -5
  7. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/bcdi_core.py +668 -668
  8. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/nn_autophase_model.py +405 -405
  9. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/nn_autophase_train.py +409 -409
  10. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/nn_data_generator.py +440 -440
  11. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/nn_demo.py +334 -334
  12. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/nn_experimental_loader.py +875 -47
  13. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/nn_gui_tabs.py +128 -0
  14. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/nn_phase_retrieval.py +720 -720
  15. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/nn_train.py +354 -354
  16. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/nn_visualize.py +378 -378
  17. cdi_stools-0.2.2/src/cdi_st/requirements.txt +41 -0
  18. cdi_stools-0.2.0/CHANGELOG.md +0 -80
  19. cdi_stools-0.2.0/src/cdi_st/requirements.txt +0 -31
  20. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/.gitignore +0 -0
  21. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/LICENSE +0 -0
  22. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/CDI_ST_logo.png +0 -0
  23. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/bcdi_gui.py +0 -0
  24. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/nn_autophase_infer.py +0 -0
  25. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/nn_dataset.py +0 -0
  26. {cdi_stools-0.2.0 → cdi_stools-0.2.2}/src/cdi_st/nn_phase_model.py +0 -0
@@ -0,0 +1,122 @@
1
+ # Changelog
2
+
3
+ All notable changes to CDI-ST are documented here.
4
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
5
+ and the project adheres to [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [0.2.2] — 2026-06-18
10
+
11
+ ### Fixed
12
+ - **ID01 SPEC+EDF conversion now tolerates missing edge frames.**
13
+ Acquisitions are sometimes started a frame late or stopped a frame
14
+ early, so a SPEC scan can list frames 262–662 (401 points) while the
15
+ EDF directory only has 263–661 (399 files). The converter now probes
16
+ the disk first, loads only the EDF files that actually exist, and
17
+ trims the per-frame motor arrays (`eta`, `phi`, `nu`, `delta`,
18
+ `mpx4inr`) to stay in lock-step with the loaded data. A clear note
19
+ identifies which leading / trailing / interior frames were skipped.
20
+ New helper `_filter_existing_edf_frames()` exposes this filtering for
21
+ programmatic use.
22
+
23
+ ## [0.2.1] — 2026-06-15
24
+
25
+ ### Added
26
+ - **PETRA III P10 / DESY Eiger compressed-data support.** Auto-imports
27
+ `hdf5plugin` at module load so bitshuffle + LZ4 compressed datasets
28
+ (the Eiger default at DESY P10 and many other beamlines) read
29
+ transparently. `hdf5plugin>=4.0` is now a runtime dependency.
30
+ - **HDF5 external-link resolution.** The P10 loader now enumerates and
31
+ resolves external links in master files instead of relying on h5py's
32
+ default link-following, which was unreliable on Windows. Each chunk is
33
+ opened directly to bypass any path-mangling. Master files with hundreds
34
+ of external links to chunk files (the standard Eiger layout) work out
35
+ of the box.
36
+ - **Scan range selection for P10** (new in the P10 converter dialog) —
37
+ similar to the ID01 SPEC+EDF scan browser. Avoids loading 49 GB of
38
+ detector frames into RAM when you only need the rocking-curve maximum:
39
+ - **Probe scan** button reads chunk metadata only (no decompression),
40
+ instantly reporting total frame count, detector shape, and estimated
41
+ full-load memory footprint.
42
+ - **Frame range** (`from`, `to`) reads only the requested global frame
43
+ range across all chunks. Loaded chunk-by-chunk so memory scales with
44
+ the chosen range, not the total dataset size.
45
+ - **Detector ROI** reads a centered square ROI from each frame instead
46
+ of the full detector. For BCDI you typically only need ~256×256
47
+ around the Bragg peak — cuts memory by `(2167*2070)/(roi²)` for
48
+ Eiger 4M data.
49
+ - **Memory budget** (default 8 GB) — the loader refuses reads that
50
+ would exceed this and tells you which `frame_range` would fit,
51
+ instead of crashing the Python process with an OOM error.
52
+ - **Programmatic API additions** to `nn_experimental_loader`:
53
+ `p10_scan_info()` for cheap metadata previews, plus new
54
+ `frame_range`, `detector_roi`, `memory_budget_gb` parameters on
55
+ `load_p10_from_external_links()` and `p10_h5_to_npz()`.
56
+
57
+ ### Fixed
58
+ - Cryptic "Can't synchronously read data (can't open directory)" error
59
+ on P10 / Eiger files. The message was HDF5 looking for the compression
60
+ plugin DLL in a non-existent directory — now caught and converted to
61
+ a clear "install hdf5plugin" instruction.
62
+ - AutoPhase_NN tab missing `_on_epoch` slot (introduced in 0.2.0 during
63
+ the live-curve refactor; AutoPhase_NN's `epoch_done` signal had no
64
+ receiver and emitted unhandled errors). Restored.
65
+ - CDI_NN `KeyError: 'phase_true'` — `BCDIDataset.__getitem__` now exposes
66
+ the GUI's expected keys (`phase_true`, `amplitude`) alongside the legacy
67
+ ones (`target_phase`, `input`).
68
+ - `BCDIPhaseLoss` accepts both the GUI's descriptive kwargs (`alpha_amp`,
69
+ `beta_phase`, `gamma_diff`, `diff_amp`) and the original short ones
70
+ (`alpha`, `beta`, `gamma`, `amplitude`). Either spelling now works.
71
+ - Training Stop button no longer crashes the program. `QThread.terminate()`
72
+ was killing PyTorch mid-`backward()` and corrupting CUDA / autograd
73
+ state — replaced with a cooperative `request_stop()` flag that the
74
+ training loop checks at batch / epoch boundaries, then exits cleanly
75
+ with a saved checkpoint.
76
+
77
+ ### Changed
78
+ - Live training curve in AutoPhase_NN and CDI_NN — the dashed "running"
79
+ line updates every ~2 s during training so users can see progress
80
+ immediately on slow CPU runs (rather than staring at a blank plot
81
+ for an entire epoch).
82
+ - `inspect_h5()` now properly shows external links with their target
83
+ files and `[OK]` / `[MISSING]` markers. The empty-looking `/entry/data/`
84
+ group on Eiger masters is no longer misleading.
85
+
86
+ ## [0.1.0] — Alpha — 2026-05-08
87
+
88
+ ### Added
89
+ - **Initial public release** of CDI-ST as a packaged Python application.
90
+ - BCDI Simulation module (Material → Beam → Results)
91
+ - Material presets: Si, Ge, Pt, Au, SiC, GaAs, and more
92
+ - CIF import for arbitrary crystals
93
+ - Particle shapes: cube, sphere, cylinder, hexagonal prism, octahedron, dodecahedron
94
+ - Strain fields: radial gradient, edge dislocation, random
95
+ - Configurable line dislocations: edge / screw / mixed with arbitrary Burgers vector
96
+ - 3D atomic lattice viewer (Plotly)
97
+ - Detector presets: Maxipix 2×2, Eiger 2M, custom rectangular
98
+ - Analytical and FFT simulation paths
99
+ - BCDI Data Analysis module (Generate Data → AutoPhase_NN → CDI_NN → Reconstruction → 3D Viewer)
100
+ - Training-data generator with random material/shape/size/strain/dislocation
101
+ - Toggles for randomized strain and dislocations
102
+ - AutoPhaseNet3D (unsupervised, dual-decoder, physics-driven loss)
103
+ - PhaseUNet3D (supervised, BCDI loss with α/β/γ weights)
104
+ - Inference: NN-only, refined (HIO+RAAR+ER), ensemble, compare
105
+ - Iterative phase retrieval: HIO (β=0.9), RAAR (β=0.9), ER, with shrink-wrap
106
+ - Experimental data loader: HDF5, ID01 SPEC+EDF, q-space orthogonalization
107
+ - Detector chip-gap masking, hot pixel removal, beamstop streak removal
108
+ - 3D viewer with point cloud / isosurface / surface-only modes
109
+ - Per-voxel opacity weighted by intensity
110
+ - VTI export for ParaView
111
+ - Splash screen and theme-matched launcher
112
+ - In-app Reports & Suggestions feature
113
+ - Cross-platform support (Linux, macOS, Windows) via PyQt6
114
+ - MIT license, full source on GitHub
115
+
116
+ ### Known limitations (alpha)
117
+ - Q-space orthogonalization is ID01-specific (can be extended)
118
+ - Some checkpoints from earlier prototypes lack `grid_size` metadata
119
+ - Mask-aware modulus constraint not yet implemented (gaps are filled instead)
120
+
121
+ [Unreleased]: https://github.com/SAIDIsoufiane/CDI-St/compare/v0.1.0...HEAD
122
+ [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.0
3
+ Version: 0.2.2
4
4
  Summary: Coherent Diffraction Imaging Simulation Tools — BCDI simulation and NN-based phase retrieval
5
- Project-URL: Homepage, https://github.com/Refze/CDI-St
6
- Project-URL: Documentation, https://github.com/Refze/CDI-St#readme
7
- Project-URL: Repository, https://github.com/Refze/CDI-St
8
- Project-URL: Issues, https://github.com/Refze/CDI-St/issues
9
- Project-URL: Changelog, https://github.com/Refze/CDI-St/blob/main/CHANGELOG.md
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