trxrdpy 3.2.0__tar.gz → 3.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.
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/PKG-INFO +8 -1
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/README.md +7 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/pyproject.toml +1 -1
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/ESRF_ID09/azimint.py +195 -24
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/ESRF_ID09/datared.py +147 -31
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/MaxIV_FemtoMAX/datared.py +90 -2
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/MaxIV_FemtoMAX/datared_utils.py +80 -25
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/Spring8_SACLA/datared.py +283 -60
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/_shared_2d/azimint.py +133 -4
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/calibration.py +344 -8
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/common/azimint_utils.py +379 -28
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/common/calibration_utils.py +107 -26
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/common/differential_analysis_utils.py +298 -42
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/common/fitting_utils.py +140 -48
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/common/general_utils.py +150 -17
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/common/paths.py +43 -3
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/common/plot_utils.py +483 -86
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/differential_analysis.py +206 -14
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/fitting.py +293 -31
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/__init__.py +1 -1
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/main_window.py +330 -39
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/runtime_guard.py +20 -6
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/services/calibration_service.py +15 -6
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/services/differential_service.py +12 -8
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/services/facility_service.py +22 -7
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/services/fitting_service.py +14 -10
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/services/integration_service.py +19 -15
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/services/path_service.py +12 -4
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/services/preparation_service.py +16 -12
- trxrdpy-3.2.2/src/trxrdpy/analysis/gui/state.py +98 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/style.py +15 -1
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/tabs/calibration_tab.py +178 -41
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/tabs/differential_tab.py +113 -26
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/tabs/fitting_tab.py +127 -33
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/tabs/pattern_creation_tab.py +48 -24
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/tabs/preparation_tab.py +38 -14
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/tabs/session_tab.py +31 -9
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/tabs/viewer_tab.py +68 -12
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/widgets/experiment_widgets.py +35 -7
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/widgets/facility_widgets.py +10 -3
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/widgets/log_widget.py +9 -3
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/widgets/multi_experiment_widgets.py +119 -12
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/widgets/parameter_widgets.py +10 -10
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/widgets/path_widgets.py +30 -9
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/widgets/polarization_widget.py +16 -6
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/widgets/task_output_dialog.py +65 -9
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/__init__.py +7 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/cif.py +100 -48
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/detector.py +65 -13
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/diffractometers.py +75 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/experiment.py +254 -31
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/geometry.py +63 -2
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/gui/__init__.py +1 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/gui/main_window.py +153 -33
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/gui/services/__init__.py +3 -0
- trxrdpy-3.2.2/src/trxrdpy/simulation/gui/services/path_service.py +71 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/gui/services/simulation_service.py +23 -1
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/gui/state.py +20 -1
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/gui/style.py +26 -1
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/gui/tabs/__init__.py +1 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/gui/tabs/polycrystalline_tab.py +42 -7
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/gui/tabs/single_crystal_tab.py +69 -3
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/gui/widgets/__init__.py +1 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/gui/widgets/geometry_panel.py +23 -1
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/gui/widgets/matrix_rotation_window.py +32 -3
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/plot.py +119 -1
- trxrdpy-3.2.2/src/trxrdpy/simulation/polycrystalline.py +286 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/poni.py +34 -4
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/sample.py +225 -17
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/single_crystal.py +550 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/simulation/utils.py +8 -11
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy.egg-info/PKG-INFO +8 -1
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy.egg-info/SOURCES.txt +4 -1
- trxrdpy-3.2.2/tests/test_calibration_2d_cake.py +296 -0
- trxrdpy-3.2.2/tests/test_id09_datared_io.py +130 -0
- trxrdpy-3.2.0/src/trxrdpy/analysis/gui/state.py +0 -53
- trxrdpy-3.2.0/src/trxrdpy/simulation/polycrystalline.py +0 -178
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/setup.cfg +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/__init__.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/ESRF_ID09/__init__.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/MaxIV_FemtoMAX/__init__.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/MaxIV_FemtoMAX/azimint.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/MaxIV_FemtoMAX/ping_references_default.csv +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/Spring8_SACLA/__init__.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/Spring8_SACLA/azimint.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/Spring8_SACLA/pbs/parallel_job_sender.sh +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/__init__.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/_shared_2d/__init__.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/common/__init__.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/defaults.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/services/__init__.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/tabs/__init__.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/utils.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy/analysis/gui/widgets/__init__.py +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy.egg-info/dependency_links.txt +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy.egg-info/entry_points.txt +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy.egg-info/requires.txt +0 -0
- {trxrdpy-3.2.0 → trxrdpy-3.2.2}/src/trxrdpy.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: trxrdpy
|
|
3
|
-
Version: 3.2.
|
|
3
|
+
Version: 3.2.2
|
|
4
4
|
Summary: Python toolkit for time-resolved X-ray diffraction simulation and beamline-dependent analysis workflows.
|
|
5
5
|
Author: Julio Guzman-Brambila
|
|
6
6
|
License-Expression: CC-BY-4.0
|
|
@@ -75,6 +75,7 @@ Source code: https://github.com/julioguzmanb/XRDpy
|
|
|
75
75
|
|
|
76
76
|
- Facility-specific analysis workflows
|
|
77
77
|
- 2D image creation / reduction
|
|
78
|
+
- Side-by-side detector-image and pyFAI 2D-cake diagnostics
|
|
78
79
|
- Azimuthal integration
|
|
79
80
|
- Standardized generation of 1D `xy` diffraction patterns
|
|
80
81
|
- 1D absolute-pattern and difference-pattern visualization
|
|
@@ -350,6 +351,11 @@ These modules provide the user-facing analysis layer after `xy` files are availa
|
|
|
350
351
|
- `analysis.fitting`
|
|
351
352
|
- `analysis.differential_analysis`
|
|
352
353
|
|
|
354
|
+
The calibration API also exposes `plot_detector_and_cake(...)`, which loads a
|
|
355
|
+
homogenized dark detector image, performs pyFAI `integrate2d` integration, and
|
|
356
|
+
plots the detector image and q/azimuth cake side by side. Detector axes can be
|
|
357
|
+
flipped independently, and applying the detector mask is optional.
|
|
358
|
+
|
|
353
359
|
Once `xy` files are created, the downstream calibration, fitting, and differential-analysis pipeline is shared across facilities.
|
|
354
360
|
|
|
355
361
|
---
|
|
@@ -405,6 +411,7 @@ The Analysis GUI supports:
|
|
|
405
411
|
- facility selection
|
|
406
412
|
- 2D image creation
|
|
407
413
|
- calibration utilities
|
|
414
|
+
- detector-image and 2D-cake visualization
|
|
408
415
|
- 1D pattern creation
|
|
409
416
|
- 1D visualization
|
|
410
417
|
- differential analysis
|
|
@@ -32,6 +32,7 @@ Source code: https://github.com/julioguzmanb/XRDpy
|
|
|
32
32
|
|
|
33
33
|
- Facility-specific analysis workflows
|
|
34
34
|
- 2D image creation / reduction
|
|
35
|
+
- Side-by-side detector-image and pyFAI 2D-cake diagnostics
|
|
35
36
|
- Azimuthal integration
|
|
36
37
|
- Standardized generation of 1D `xy` diffraction patterns
|
|
37
38
|
- 1D absolute-pattern and difference-pattern visualization
|
|
@@ -307,6 +308,11 @@ These modules provide the user-facing analysis layer after `xy` files are availa
|
|
|
307
308
|
- `analysis.fitting`
|
|
308
309
|
- `analysis.differential_analysis`
|
|
309
310
|
|
|
311
|
+
The calibration API also exposes `plot_detector_and_cake(...)`, which loads a
|
|
312
|
+
homogenized dark detector image, performs pyFAI `integrate2d` integration, and
|
|
313
|
+
plots the detector image and q/azimuth cake side by side. Detector axes can be
|
|
314
|
+
flipped independently, and applying the detector mask is optional.
|
|
315
|
+
|
|
310
316
|
Once `xy` files are created, the downstream calibration, fitting, and differential-analysis pipeline is shared across facilities.
|
|
311
317
|
|
|
312
318
|
---
|
|
@@ -362,6 +368,7 @@ The Analysis GUI supports:
|
|
|
362
368
|
- facility selection
|
|
363
369
|
- 2D image creation
|
|
364
370
|
- calibration utilities
|
|
371
|
+
- detector-image and 2D-cake visualization
|
|
365
372
|
- 1D pattern creation
|
|
366
373
|
- 1D visualization
|
|
367
374
|
- differential analysis
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "trxrdpy"
|
|
7
|
-
version = "3.2.
|
|
7
|
+
version = "3.2.2"
|
|
8
8
|
description = "Python toolkit for time-resolved X-ray diffraction simulation and beamline-dependent analysis workflows."
|
|
9
9
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -114,7 +114,7 @@ def _calibration_root(
|
|
|
114
114
|
paths: AnalysisPaths,
|
|
115
115
|
calibration_subdir: Union[str, Path] = "calibration",
|
|
116
116
|
) -> Path:
|
|
117
|
-
"""Return
|
|
117
|
+
"""Return the directory searched for ID09 PONI and detector-mask files."""
|
|
118
118
|
return Path(paths.path_root) / Path(calibration_subdir)
|
|
119
119
|
|
|
120
120
|
|
|
@@ -122,7 +122,7 @@ def _effective_raw_sample_name(
|
|
|
122
122
|
sample_name: str,
|
|
123
123
|
raw_sample_name: Optional[str] = None,
|
|
124
124
|
) -> str:
|
|
125
|
-
"""
|
|
125
|
+
"""Select and validate the sample name used in the ID09 raw-data tree."""
|
|
126
126
|
raw_name = sample_name if raw_sample_name is None else raw_sample_name
|
|
127
127
|
raw_name = str(raw_name)
|
|
128
128
|
|
|
@@ -133,7 +133,7 @@ def _effective_raw_sample_name(
|
|
|
133
133
|
|
|
134
134
|
|
|
135
135
|
def _load_ai_with_compat(poni_path: Union[str, Path]):
|
|
136
|
-
"""Load
|
|
136
|
+
"""Load a PONI file through the shared legacy-format compatibility layer."""
|
|
137
137
|
ai = txs.utils.load_ai(poni_path)
|
|
138
138
|
return ai
|
|
139
139
|
|
|
@@ -159,6 +159,20 @@ class ESRFScanSource:
|
|
|
159
159
|
HDF5 filename, and internal scan path. ``read_raw_images`` returns the full
|
|
160
160
|
detector stack and raises a filesystem or HDF5 error when the configured
|
|
161
161
|
scan cannot be found.
|
|
162
|
+
|
|
163
|
+
Attributes
|
|
164
|
+
----------
|
|
165
|
+
sample_name : str
|
|
166
|
+
Analysis-facing sample identifier.
|
|
167
|
+
dataset : int
|
|
168
|
+
ID09 dataset number used in proposal folder and HDF5 names.
|
|
169
|
+
scan_nb : int
|
|
170
|
+
BLISS scan number within the dataset.
|
|
171
|
+
paths : AnalysisPaths
|
|
172
|
+
Raw-data and processed-analysis root configuration.
|
|
173
|
+
raw_sample_name : str or None
|
|
174
|
+
Optional beamline-facing sample name when it differs from
|
|
175
|
+
``sample_name``.
|
|
162
176
|
"""
|
|
163
177
|
sample_name: str
|
|
164
178
|
dataset: int
|
|
@@ -168,7 +182,7 @@ class ESRFScanSource:
|
|
|
168
182
|
|
|
169
183
|
@property
|
|
170
184
|
def effective_raw_sample_name(self) -> str:
|
|
171
|
-
"""Return the
|
|
185
|
+
"""Return the raw-data sample name after applying any override."""
|
|
172
186
|
return _effective_raw_sample_name(
|
|
173
187
|
sample_name=self.sample_name,
|
|
174
188
|
raw_sample_name=self.raw_sample_name,
|
|
@@ -176,7 +190,7 @@ class ESRFScanSource:
|
|
|
176
190
|
|
|
177
191
|
@property
|
|
178
192
|
def dataset_dir(self) -> Path:
|
|
179
|
-
"""Return dataset
|
|
193
|
+
"""Return the ID09 raw directory for this numbered dataset."""
|
|
180
194
|
raw_name = self.effective_raw_sample_name
|
|
181
195
|
return (
|
|
182
196
|
Path(self.paths.raw_root)
|
|
@@ -186,17 +200,17 @@ class ESRFScanSource:
|
|
|
186
200
|
|
|
187
201
|
@property
|
|
188
202
|
def raw_h5_path(self) -> Path:
|
|
189
|
-
"""Return
|
|
203
|
+
"""Return the complete filesystem path of the BLISS dataset HDF5 file."""
|
|
190
204
|
raw_name = self.effective_raw_sample_name
|
|
191
205
|
return self.dataset_dir / f"{raw_name}_{int(self.dataset):04d}.h5"
|
|
192
206
|
|
|
193
207
|
@property
|
|
194
208
|
def scan_path(self) -> str:
|
|
195
|
-
"""Return scan path."""
|
|
209
|
+
"""Return the conventional raw scan-directory path for this scan number."""
|
|
196
210
|
return str(self.dataset_dir / f"scan{int(self.scan_nb):04d}")
|
|
197
211
|
|
|
198
212
|
def read_raw_images(self) -> np.ndarray:
|
|
199
|
-
"""
|
|
213
|
+
"""Load the complete Rayonix frame stack for the configured BLISS scan."""
|
|
200
214
|
path = self.raw_h5_path
|
|
201
215
|
if not path.exists():
|
|
202
216
|
raise FileNotFoundError(str(path))
|
|
@@ -221,6 +235,22 @@ def get_raw_images(
|
|
|
221
235
|
|
|
222
236
|
The scan source resolves facility paths and returns the detector stack with
|
|
223
237
|
its original frame and pixel dimensions.
|
|
238
|
+
|
|
239
|
+
Parameters
|
|
240
|
+
----------
|
|
241
|
+
sample_name : str
|
|
242
|
+
Analysis-facing sample identifier.
|
|
243
|
+
dataset, scan_nb : int
|
|
244
|
+
Numbered ID09 dataset and BLISS scan within that dataset.
|
|
245
|
+
raw_sample_name : str, optional
|
|
246
|
+
Beamline-facing sample name when the raw directory uses another name.
|
|
247
|
+
paths, path_root, raw_subdir, analysis_subdir
|
|
248
|
+
Modern or legacy experiment-path configuration.
|
|
249
|
+
|
|
250
|
+
Returns
|
|
251
|
+
-------
|
|
252
|
+
numpy.ndarray
|
|
253
|
+
Detector stack with shape ``(frames, detector_y, detector_x)``.
|
|
224
254
|
"""
|
|
225
255
|
src = ESRFScanSource(
|
|
226
256
|
sample_name=str(sample_name),
|
|
@@ -250,11 +280,29 @@ def default_calibration_paths(
|
|
|
250
280
|
) -> Tuple[str, str]:
|
|
251
281
|
"""Try to auto-resolve calibration files from ``<path_root>/calibration``.
|
|
252
282
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
- mask: newest file containing sample_name and 'mask' with extension .edf
|
|
283
|
+
The newest ``.poni`` containing ``sample_name`` and newest ``.edf`` also
|
|
284
|
+
containing ``mask`` are selected.
|
|
256
285
|
|
|
257
286
|
If your project needs stricter rules, pass ``calibration_resolver=...``.
|
|
287
|
+
|
|
288
|
+
Parameters
|
|
289
|
+
----------
|
|
290
|
+
sample_name : str
|
|
291
|
+
Text required in both calibration filenames.
|
|
292
|
+
paths, path_root
|
|
293
|
+
Modern or legacy experiment-root configuration.
|
|
294
|
+
calibration_subdir : path-like
|
|
295
|
+
Calibration directory relative to the experiment root.
|
|
296
|
+
|
|
297
|
+
Returns
|
|
298
|
+
-------
|
|
299
|
+
tuple of str
|
|
300
|
+
Resolved PONI path followed by the detector-mask EDF path.
|
|
301
|
+
|
|
302
|
+
Raises
|
|
303
|
+
------
|
|
304
|
+
FileNotFoundError
|
|
305
|
+
If no matching PONI file or mask file exists.
|
|
258
306
|
"""
|
|
259
307
|
pths = _resolve_paths(paths=paths, path_root=path_root)
|
|
260
308
|
cal_root = _calibration_root(paths=pths, calibration_subdir=calibration_subdir)
|
|
@@ -296,9 +344,26 @@ def resolve_calibration(
|
|
|
296
344
|
) -> Tuple[str, str]:
|
|
297
345
|
"""Resolve calibration file paths.
|
|
298
346
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
347
|
+
Explicit paths take priority. Any missing path is filled by
|
|
348
|
+
``calibration_resolver`` or :func:`default_calibration_paths`.
|
|
349
|
+
|
|
350
|
+
Parameters
|
|
351
|
+
----------
|
|
352
|
+
sample_name : str
|
|
353
|
+
Sample identifier used during automatic discovery.
|
|
354
|
+
paths, path_root
|
|
355
|
+
Modern or legacy experiment-root configuration.
|
|
356
|
+
poni_path, mask_edf_path : path-like, optional
|
|
357
|
+
Explicit geometry and detector-mask files.
|
|
358
|
+
calibration_subdir : path-like
|
|
359
|
+
Calibration directory relative to the experiment root.
|
|
360
|
+
calibration_resolver : callable, optional
|
|
361
|
+
Custom resolver returning ``(poni_path, mask_path)``.
|
|
362
|
+
|
|
363
|
+
Returns
|
|
364
|
+
-------
|
|
365
|
+
tuple of str
|
|
366
|
+
Fully resolved PONI and mask paths.
|
|
302
367
|
"""
|
|
303
368
|
if poni_path is not None and mask_edf_path is not None:
|
|
304
369
|
return str(poni_path), str(mask_edf_path)
|
|
@@ -425,7 +490,7 @@ def _normalize_delay_selection(
|
|
|
425
490
|
|
|
426
491
|
|
|
427
492
|
def _delay_index_map(delay_tokens: Sequence[Union[str, bytes]]) -> Dict[int, int]:
|
|
428
|
-
"""
|
|
493
|
+
"""Map each canonical delay token to its detector-frame indices."""
|
|
429
494
|
out: Dict[int, int] = {}
|
|
430
495
|
for i, tok in enumerate(delay_tokens):
|
|
431
496
|
fs = delay_token_to_fs(tok)
|
|
@@ -445,7 +510,7 @@ def _standard_windows_from_edges(
|
|
|
445
510
|
include_full: bool = True,
|
|
446
511
|
full_range: Tuple[float, float] = (-90.0, 90.0),
|
|
447
512
|
) -> List[Tuple[float, float]]:
|
|
448
|
-
"""
|
|
513
|
+
"""Build adjacent package-coordinate azimuth windows from ordered edges."""
|
|
449
514
|
wins = general_utils.windows_from_edges(
|
|
450
515
|
azimuthal_edges,
|
|
451
516
|
include_full=include_full,
|
|
@@ -461,7 +526,7 @@ def _esrf_integration_window(
|
|
|
461
526
|
*,
|
|
462
527
|
azim_offset_deg: float = -90.0,
|
|
463
528
|
) -> Tuple[float, float]:
|
|
464
|
-
"""
|
|
529
|
+
"""Translate a package-coordinate azimuth window to ID09 integration angles."""
|
|
465
530
|
return (
|
|
466
531
|
float(standard_window[0]) + float(azim_offset_deg),
|
|
467
532
|
float(standard_window[1]) + float(azim_offset_deg),
|
|
@@ -635,7 +700,7 @@ def _load_cached_xy(
|
|
|
635
700
|
normalize: bool = False,
|
|
636
701
|
q_norm_range: Tuple[float, float] = (2.65, 2.75),
|
|
637
702
|
) -> Tuple[str, np.ndarray, np.ndarray]:
|
|
638
|
-
"""Load cached
|
|
703
|
+
"""Load one cached ID09 pattern and convert its radial axis to q."""
|
|
639
704
|
azim_str = general_utils.azim_range_str(azim_window)
|
|
640
705
|
xy_path = dataset_obj.xy_path(azim_str)
|
|
641
706
|
if not xy_path.exists():
|
|
@@ -818,8 +883,7 @@ def integrate_delay_1d(
|
|
|
818
883
|
azim_offset_deg: float = -90.0,
|
|
819
884
|
polarization_factor: Optional[float] = None,
|
|
820
885
|
):
|
|
821
|
-
"""
|
|
822
|
-
sample_name + dataset + scan_nb -> txs reduction -> standardized XY files
|
|
886
|
+
"""Reduce one ID09 delay scan and write standardized azimuthal XY files.
|
|
823
887
|
|
|
824
888
|
``sample_name`` is used for output/cache naming.
|
|
825
889
|
``raw_sample_name`` is used only to locate the raw HDF5 dataset. If omitted,
|
|
@@ -828,12 +892,44 @@ def integrate_delay_1d(
|
|
|
828
892
|
Output XY files follow the SAME folder structure and filename conventions
|
|
829
893
|
as the shared trxrdpy analysis pipeline.
|
|
830
894
|
|
|
895
|
+
Parameters
|
|
896
|
+
----------
|
|
897
|
+
sample_name, dataset, scan_nb
|
|
898
|
+
Analysis identifier and raw ID09 dataset/scan coordinates.
|
|
899
|
+
temperature_K, excitation_wl_nm, fluence_mJ_cm2, time_window_fs
|
|
900
|
+
Experimental metadata encoded in standardized output paths.
|
|
901
|
+
delays_fs : int, sequence of int, or "all"
|
|
902
|
+
Delay points to export, expressed in femtoseconds.
|
|
903
|
+
raw_sample_name : str, optional
|
|
904
|
+
Raw directory sample name when it differs from ``sample_name``.
|
|
905
|
+
paths, path_root, raw_subdir, analysis_subdir
|
|
906
|
+
Modern or legacy experiment-path configuration.
|
|
907
|
+
poni_path, mask_edf_path, calibration_subdir, calibration_resolver
|
|
908
|
+
Explicit or automatically resolved pyFAI calibration settings.
|
|
909
|
+
azimuthal_edges, include_full, full_range
|
|
910
|
+
Package-coordinate sector boundaries and optional full sector.
|
|
911
|
+
npt : int
|
|
912
|
+
Number of radial integration bins.
|
|
913
|
+
force : bool
|
|
914
|
+
Force the underlying ``pytxs`` reduction to be recomputed.
|
|
915
|
+
ref_delay : str or number
|
|
916
|
+
Delay token used as the reduction reference.
|
|
917
|
+
q_norm_range : tuple of float
|
|
918
|
+
q interval used by the reduction normalization.
|
|
919
|
+
overwrite_xy : bool
|
|
920
|
+
Replace standardized XY files that already exist.
|
|
921
|
+
azim_offset_deg : float
|
|
922
|
+
Offset from package azimuth coordinates to ID09 coordinates.
|
|
923
|
+
polarization_factor : float, optional
|
|
924
|
+
pyFAI polarization correction; ``None`` disables it.
|
|
925
|
+
|
|
831
926
|
Returns
|
|
832
927
|
-------
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
928
|
+
tuple
|
|
929
|
+
``(source, datasets, saved_paths)`` where ``source`` describes the raw
|
|
930
|
+
scan, ``datasets`` contains one :class:`DelayDataset` per selected
|
|
931
|
+
delay, and ``saved_paths`` maps each delay and azimuth label to its XY
|
|
932
|
+
filename.
|
|
837
933
|
"""
|
|
838
934
|
pths = _resolve_paths(
|
|
839
935
|
paths=paths,
|
|
@@ -982,6 +1078,46 @@ def plot_1D_abs_and_diffs_delay(
|
|
|
982
1078
|
|
|
983
1079
|
``raw_sample_name`` is only used if missing XY files need to be generated
|
|
984
1080
|
from the raw HDF5 data.
|
|
1081
|
+
|
|
1082
|
+
Parameters
|
|
1083
|
+
----------
|
|
1084
|
+
sample_name, dataset, scan_nb
|
|
1085
|
+
Analysis identifier and raw ID09 dataset/scan coordinates.
|
|
1086
|
+
temperature_K, excitation_wl_nm, fluence_mJ_cm2, time_window_fs
|
|
1087
|
+
Experimental metadata identifying the cached patterns.
|
|
1088
|
+
delays_fs : int, sequence of int, or "all"
|
|
1089
|
+
Delay patterns to plot in femtoseconds.
|
|
1090
|
+
ref_type, ref_value, ref_delay
|
|
1091
|
+
Reference selection. ID09 currently accepts only a delay reference.
|
|
1092
|
+
raw_sample_name, paths, path_root, raw_subdir, analysis_subdir
|
|
1093
|
+
Raw naming and experiment-path configuration.
|
|
1094
|
+
poni_path, mask_edf_path, calibration_subdir, calibration_resolver
|
|
1095
|
+
Calibration settings used when files must be generated or q converted.
|
|
1096
|
+
azim_window, npt, force, q_norm_range, normalize
|
|
1097
|
+
Azimuthal integration, radial binning, reduction, and normalization
|
|
1098
|
+
settings.
|
|
1099
|
+
compute_if_missing, overwrite_xy
|
|
1100
|
+
Control on-demand integration and replacement of cached XY files.
|
|
1101
|
+
xlim, ylim_top, ylim_diff, vlines_peak, vlines_bckg
|
|
1102
|
+
Axis limits and optional highlighted q intervals.
|
|
1103
|
+
fs_or_ps, digits, title
|
|
1104
|
+
Delay-label unit, rounding precision, and optional title.
|
|
1105
|
+
azim_offset_deg, polarization_factor
|
|
1106
|
+
ID09 azimuth conversion and pyFAI polarization correction.
|
|
1107
|
+
save_plots, out_name, save_format, save_dpi, save_overwrite, save_base_dir
|
|
1108
|
+
Figure-output controls.
|
|
1109
|
+
|
|
1110
|
+
Returns
|
|
1111
|
+
-------
|
|
1112
|
+
tuple
|
|
1113
|
+
Matplotlib figure and the two axes for absolute and difference traces.
|
|
1114
|
+
|
|
1115
|
+
Raises
|
|
1116
|
+
------
|
|
1117
|
+
NotImplementedError
|
|
1118
|
+
If ``ref_type`` is not ``"delay"``.
|
|
1119
|
+
FileNotFoundError
|
|
1120
|
+
If required XY files are missing and generation is disabled or fails.
|
|
985
1121
|
"""
|
|
986
1122
|
pths = _resolve_paths(
|
|
987
1123
|
paths=paths,
|
|
@@ -1435,6 +1571,41 @@ def plot_1D_abs_and_diffs_fluence(
|
|
|
1435
1571
|
Supported references:
|
|
1436
1572
|
- ``ref_type='fluence'`` with ``ref_value=<fluence>``
|
|
1437
1573
|
- ``ref_type='dark'`` with optional ``ref_value=<dark spec>``
|
|
1574
|
+
|
|
1575
|
+
Parameters
|
|
1576
|
+
----------
|
|
1577
|
+
sample_name, temperature_K, excitation_wl_nm, delay_fs, time_window_fs
|
|
1578
|
+
Experimental identity and fixed-delay metadata locating the patterns.
|
|
1579
|
+
fluences_mJ_cm2 : float, sequence of float, or "all"
|
|
1580
|
+
Fluence points to compare in mJ/cm².
|
|
1581
|
+
ref_type, ref_value
|
|
1582
|
+
Fluence or dark reference selection.
|
|
1583
|
+
paths, path_root, raw_subdir, analysis_subdir
|
|
1584
|
+
Modern or legacy experiment-path configuration.
|
|
1585
|
+
poni_path, mask_edf_path, calibration_subdir, calibration_resolver
|
|
1586
|
+
Calibration settings used for radial-axis conversion and discovery.
|
|
1587
|
+
azim_window, polarization_factor
|
|
1588
|
+
Cached sector to load and correction provenance expected for its XY data.
|
|
1589
|
+
compute_if_missing, copy_2d_image_if_missing, overwrite_xy
|
|
1590
|
+
Synthetic fluence-cache creation and replacement controls.
|
|
1591
|
+
normalize, q_norm_range
|
|
1592
|
+
Optional in-memory intensity normalization.
|
|
1593
|
+
xlim, ylim_top, ylim_diff, vlines_peak, vlines_bckg, title
|
|
1594
|
+
Axis limits, highlighted q regions, and figure title.
|
|
1595
|
+
save_plots, out_name, save_format, save_dpi, save_overwrite, save_base_dir
|
|
1596
|
+
Figure-output controls.
|
|
1597
|
+
|
|
1598
|
+
Returns
|
|
1599
|
+
-------
|
|
1600
|
+
tuple
|
|
1601
|
+
Matplotlib figure and the two axes for absolute and difference traces.
|
|
1602
|
+
|
|
1603
|
+
Raises
|
|
1604
|
+
------
|
|
1605
|
+
ValueError
|
|
1606
|
+
If the reference type or required reference value is invalid.
|
|
1607
|
+
FileNotFoundError
|
|
1608
|
+
If source or synthetic fluence data cannot be located.
|
|
1438
1609
|
"""
|
|
1439
1610
|
pths = _resolve_paths(
|
|
1440
1611
|
paths=paths,
|