midas-dt 0.1.0__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.
- midas_dt-0.1.0/LICENSE +53 -0
- midas_dt-0.1.0/PKG-INFO +169 -0
- midas_dt-0.1.0/README.md +142 -0
- midas_dt-0.1.0/midas_dt/__init__.py +124 -0
- midas_dt-0.1.0/midas_dt/branches.py +284 -0
- midas_dt-0.1.0/midas_dt/center.py +203 -0
- midas_dt-0.1.0/midas_dt/channels.py +176 -0
- midas_dt-0.1.0/midas_dt/cli.py +175 -0
- midas_dt-0.1.0/midas_dt/conventions.py +201 -0
- midas_dt-0.1.0/midas_dt/geometry.py +271 -0
- midas_dt-0.1.0/midas_dt/index_rings.py +167 -0
- midas_dt-0.1.0/midas_dt/io.py +127 -0
- midas_dt-0.1.0/midas_dt/maps.py +188 -0
- midas_dt-0.1.0/midas_dt/peakfit.py +187 -0
- midas_dt-0.1.0/midas_dt/recon.py +196 -0
- midas_dt-0.1.0/midas_dt/reduce.py +179 -0
- midas_dt-0.1.0/midas_dt/rings.py +148 -0
- midas_dt-0.1.0/midas_dt/scan.py +286 -0
- midas_dt-0.1.0/midas_dt/sinogram.py +166 -0
- midas_dt-0.1.0/midas_dt.egg-info/PKG-INFO +169 -0
- midas_dt-0.1.0/midas_dt.egg-info/SOURCES.txt +37 -0
- midas_dt-0.1.0/midas_dt.egg-info/dependency_links.txt +1 -0
- midas_dt-0.1.0/midas_dt.egg-info/entry_points.txt +2 -0
- midas_dt-0.1.0/midas_dt.egg-info/requires.txt +11 -0
- midas_dt-0.1.0/midas_dt.egg-info/top_level.txt +1 -0
- midas_dt-0.1.0/pyproject.toml +49 -0
- midas_dt-0.1.0/setup.cfg +4 -0
- midas_dt-0.1.0/tests/test_branches.py +132 -0
- midas_dt-0.1.0/tests/test_branches_e2e.py +102 -0
- midas_dt-0.1.0/tests/test_center.py +77 -0
- midas_dt-0.1.0/tests/test_conventions.py +153 -0
- midas_dt-0.1.0/tests/test_index_rings.py +77 -0
- midas_dt-0.1.0/tests/test_io_cli.py +103 -0
- midas_dt-0.1.0/tests/test_maps.py +153 -0
- midas_dt-0.1.0/tests/test_no_skimage.py +66 -0
- midas_dt-0.1.0/tests/test_recon.py +113 -0
- midas_dt-0.1.0/tests/test_reduce_sinogram.py +111 -0
- midas_dt-0.1.0/tests/test_ring_finding.py +109 -0
- midas_dt-0.1.0/tests/test_scan_channels.py +371 -0
midas_dt-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Copyright (c) 2012, UChicago Argonne, LLC
|
|
2
|
+
|
|
3
|
+
All Rights Reserved
|
|
4
|
+
|
|
5
|
+
MIDAS Microstructural Imaging using Diffraction Analysis Software
|
|
6
|
+
|
|
7
|
+
Materials Physics and Engineering
|
|
8
|
+
Computational X-ray Science
|
|
9
|
+
Advanced Photon Source
|
|
10
|
+
Argonne National Laboratory
|
|
11
|
+
|
|
12
|
+
Contributing Authors:
|
|
13
|
+
Hemant Sharma (hsharma@anl.gov)
|
|
14
|
+
|
|
15
|
+
OPEN SOURCE LICENSE
|
|
16
|
+
|
|
17
|
+
Redistribution and use in source and binary forms, with or without
|
|
18
|
+
modification, are permitted provided that the following conditions are met:
|
|
19
|
+
|
|
20
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
21
|
+
this list of conditions and the following disclaimer. Software changes,
|
|
22
|
+
modifications, or derivative works, should be noted with comments and
|
|
23
|
+
the author and organization's name.
|
|
24
|
+
|
|
25
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
26
|
+
this list of conditions and the following disclaimer in the documentation
|
|
27
|
+
and/or other materials provided with the distribution.
|
|
28
|
+
|
|
29
|
+
3. Neither the names of UChicago Argonne, LLC or the Department of Energy
|
|
30
|
+
nor the names of its contributors may be used to endorse or promote
|
|
31
|
+
products derived from this software without specific prior written
|
|
32
|
+
permission.
|
|
33
|
+
|
|
34
|
+
4. The software and the end-user documentation included with the
|
|
35
|
+
redistribution, if any, must include the following acknowledgment:
|
|
36
|
+
|
|
37
|
+
"This product includes software produced by UChicago Argonne, LLC
|
|
38
|
+
under Contract No. DE-AC02-06CH11357 with the Department of Energy."
|
|
39
|
+
|
|
40
|
+
****************************************************************************
|
|
41
|
+
|
|
42
|
+
DISCLAIMER
|
|
43
|
+
|
|
44
|
+
THE SOFTWARE IS SUPPLIED "AS IS" WITHOUT WARRANTY OF ANY KIND.
|
|
45
|
+
|
|
46
|
+
Neither the United States GOVERNMENT, nor the United States Department
|
|
47
|
+
of Energy, NOR UChicago Argonne, LLC, nor any of their employees, makes
|
|
48
|
+
any warranty, express or implied, or assumes any legal liability or
|
|
49
|
+
responsibility for the accuracy, completeness, or usefulness of any
|
|
50
|
+
information, data, apparatus, product, or process disclosed, or
|
|
51
|
+
represents that its use would not infringe privately owned rights.
|
|
52
|
+
|
|
53
|
+
****************************************************************************
|
midas_dt-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: midas-dt
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Diffraction / X-ray computed tomography (XRD-CT): scan model, sinogram assembly with error propagation, reconstruction and per-voxel peak fitting.
|
|
5
|
+
Author-email: Hemant Sharma <hsharma@anl.gov>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Homepage, https://github.com/marinerhemant/MIDAS
|
|
8
|
+
Project-URL: Issues, https://github.com/marinerhemant/MIDAS/issues
|
|
9
|
+
Keywords: MIDAS,XRD-CT,diffraction tomography,DT,synchrotron,chemical tomography
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: numpy>=1.22
|
|
18
|
+
Requires-Dist: midas-tomo>=0.1.0
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
21
|
+
Provides-Extra: full
|
|
22
|
+
Requires-Dist: midas-integrate-v2>=0.3.1; extra == "full"
|
|
23
|
+
Requires-Dist: midas-peakfit>=0.5.0; extra == "full"
|
|
24
|
+
Requires-Dist: midas-hkls>=0.6.0; extra == "full"
|
|
25
|
+
Requires-Dist: midas-stress>=0.8.1; extra == "full"
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# midas-dt
|
|
29
|
+
|
|
30
|
+
Diffraction / X-ray computed tomography (XRD-CT): raw detector frames to
|
|
31
|
+
per-voxel diffraction patterns and the maps derived from them.
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from midas_dt import (
|
|
35
|
+
Channel, DTScan, assemble, detect_snake, find_centre,
|
|
36
|
+
geometry_from_legacy_params, run_recon_then_fit,
|
|
37
|
+
)
|
|
38
|
+
from midas_dt.reduce import FrameReducer
|
|
39
|
+
|
|
40
|
+
geo = geometry_from_legacy_params("ps_dt.txt")
|
|
41
|
+
scan = DTScan.from_stem("/data", "sample", 161, 215, dark_file="dark.raw")
|
|
42
|
+
chan = Channel(105, 125, r_bin=0.5)
|
|
43
|
+
|
|
44
|
+
inten, var = zip(*(FrameReducer(geo, chan, dark=scan.dark())
|
|
45
|
+
.reduce_translation(scan, t)
|
|
46
|
+
for t in range(scan.n_translations)))
|
|
47
|
+
stack = assemble(np.stack(inten), np.stack(var), scan.omega_deg, chan,
|
|
48
|
+
snake=detect_snake(profiles)[0])
|
|
49
|
+
result = run_recon_then_fit(stack, shift=find_centre(stack).shift)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
or from the shell:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
midas-dt --params ps_dt.txt --raw-dir /data --stem sample \
|
|
56
|
+
--start 161 --end 215 --dark dark.raw \
|
|
57
|
+
--r-min 105 --r-max 125 --out ./maps
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Scope
|
|
61
|
+
|
|
62
|
+
**In:** powder-like XRD-CT. A pencil or line beam, the sample translated
|
|
63
|
+
across it and rotated, one area-detector frame per (translation, rotation).
|
|
64
|
+
Rings are integrated azimuthally, reconstructed per (Q, η) bin, and fitted.
|
|
65
|
+
|
|
66
|
+
**Out:** scanning-3DXRD. If the rings break into discrete spots the sample is
|
|
67
|
+
coarse-grained and this is the wrong tool — use `midas_index`'s PF mode with
|
|
68
|
+
`midas_pf_odf`. The dividing line is operational: continuous at your working
|
|
69
|
+
bin size, or not. Check it on a frame before committing to a reduction —
|
|
70
|
+
`packages/midas_dt/dev/look_at_frame.py` in the MIDAS repo does this, and
|
|
71
|
+
`midas_dt.rings.find_rings` gives the quantitative version.
|
|
72
|
+
|
|
73
|
+
One trap worth repeating from that script: on a Pilatus, the module gaps read
|
|
74
|
+
as azimuthal structure and make **every** ring look spotty. Mask them first.
|
|
75
|
+
|
|
76
|
+
## The two branches
|
|
77
|
+
|
|
78
|
+
Both ship, they share one `Channel` list, and `compare()` measures the gap
|
|
79
|
+
between them on your data.
|
|
80
|
+
|
|
81
|
+
**`run_fit_then_recon`** fits each projection, then reconstructs the parameter
|
|
82
|
+
sinograms. 12 reconstructions per channel, independent of binning — cheap.
|
|
83
|
+
|
|
84
|
+
**`run_recon_then_fit`** reconstructs every bin, then fits per voxel. Exact,
|
|
85
|
+
at `n_r × n_eta` reconstructions.
|
|
86
|
+
|
|
87
|
+
### When branch A is valid
|
|
88
|
+
|
|
89
|
+
Radon inversion is linear; peak fitting is not. Only quantities that **add
|
|
90
|
+
along a ray** may be back-projected directly:
|
|
91
|
+
|
|
92
|
+
- `TotalIntensity`, `TotalIntensityBackgroundCorr`, `FitIntegratedIntensity` — yes.
|
|
93
|
+
- `RMEAN`, `SigmaG`, `SigmaL`, `MixFactor` — **no**. A projection's fitted
|
|
94
|
+
`RMEAN` is the intensity-weighted mean along the ray, not the sum, so
|
|
95
|
+
back-projecting it gives a number with no physical meaning that looks
|
|
96
|
+
entirely reasonable.
|
|
97
|
+
|
|
98
|
+
So `weighting="intensity"` (the default) reconstructs the moments instead:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
RMEAN_voxel = recon(RMEAN_proj × I_proj) / recon(I_proj)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Both terms add, so this is correct wherever the single-peak / small-shift
|
|
105
|
+
linearisation holds. `weighting="none"` reproduces the legacy behaviour and
|
|
106
|
+
marks its outputs `approximate` in the result and its provenance.
|
|
107
|
+
|
|
108
|
+
Measured on a phantom whose peak position varies across the sample:
|
|
109
|
+
`TotalIntensity` (additive) agrees between branches to **0.0**; `RMEAN` (not
|
|
110
|
+
additive) to **0.0085**. That difference is the reason the distinction exists.
|
|
111
|
+
|
|
112
|
+
## Conventions it pins
|
|
113
|
+
|
|
114
|
+
`midas_dt.conventions` is the single place for the things that silently
|
|
115
|
+
produce wrong answers. All are tested.
|
|
116
|
+
|
|
117
|
+
| | |
|
|
118
|
+
|---|---|
|
|
119
|
+
| fit-output order | 12 canonical channels; `MaxIntensityObs` is slot **5** |
|
|
120
|
+
| additive outputs | only 3 of the 12 may be back-projected |
|
|
121
|
+
| `RECON_SIGN` | −1: `doLog=0` back-projects intensity, so the result is negative-going |
|
|
122
|
+
| omega | negated once (1-ID aerotech), in `DTScan.from_stem` |
|
|
123
|
+
| first frame | dropped (1-ID writes a throwaway) |
|
|
124
|
+
| snake | **detected** from the data, not read from a flag |
|
|
125
|
+
|
|
126
|
+
**Reading pre-2026 MIDAS DT output:** every legacy Python driver omits
|
|
127
|
+
`MaxIntensityObs` from slot 5, shifting each label from index 5 on — a file
|
|
128
|
+
named `*_BGFit_*` actually holds `MaxIntensityObs`. Index by position and take
|
|
129
|
+
the name from `FIT_OUTPUT_NAMES`. Indices 0–4 are unaffected.
|
|
130
|
+
|
|
131
|
+
## Error bars
|
|
132
|
+
|
|
133
|
+
`midas_integrate_v2` propagates Poisson σ through integration; `sinogram`
|
|
134
|
+
carries it; `reconstruct(variance_samples=K)` gives per-voxel σ by Monte
|
|
135
|
+
Carlo. It is opt-in because each sample costs a full extra reconstruction.
|
|
136
|
+
|
|
137
|
+
There is deliberately no cheap "push the variance sinogram through FBP"
|
|
138
|
+
option: for a linear operator `A` that computes `A @ var`, not `A² @ var`, and
|
|
139
|
+
it can go negative through the ramp filter's lobes. Manufacturing an error bar
|
|
140
|
+
is worse than not having one.
|
|
141
|
+
|
|
142
|
+
## What it does not correct
|
|
143
|
+
|
|
144
|
+
Attached to every result via `ScanKnownLimits` and written into
|
|
145
|
+
`provenance.json`, so a map cannot be separated from its caveats:
|
|
146
|
+
|
|
147
|
+
- **self-absorption** — phase fractions are biased toward the sample surface
|
|
148
|
+
and are qualitative
|
|
149
|
+
- **texture** — the η-integrated pattern is a powder pattern only if the voxel
|
|
150
|
+
is randomly oriented
|
|
151
|
+
- **phase fractions** are relative: uncorrected for structure factor,
|
|
152
|
+
Lorentz-polarisation and absorption
|
|
153
|
+
- **a single-channel strain map** is one projection of the tensor along the
|
|
154
|
+
scattering vector, not the tensor
|
|
155
|
+
|
|
156
|
+
## Installing
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
pip install midas-dt # scan, channels, sinograms, reconstruction
|
|
160
|
+
pip install midas-dt[full] # + integration, peak fitting, ring indexing
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
`midas-tomo` supplies the reconstruction engine. The `[full]` extra adds
|
|
164
|
+
`midas-integrate-v2` (integration with variance), `midas-peakfit`,
|
|
165
|
+
`midas-hkls` (ring indexing) and `midas-stress`.
|
|
166
|
+
|
|
167
|
+
## License
|
|
168
|
+
|
|
169
|
+
BSD-3-Clause.
|
midas_dt-0.1.0/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# midas-dt
|
|
2
|
+
|
|
3
|
+
Diffraction / X-ray computed tomography (XRD-CT): raw detector frames to
|
|
4
|
+
per-voxel diffraction patterns and the maps derived from them.
|
|
5
|
+
|
|
6
|
+
```python
|
|
7
|
+
from midas_dt import (
|
|
8
|
+
Channel, DTScan, assemble, detect_snake, find_centre,
|
|
9
|
+
geometry_from_legacy_params, run_recon_then_fit,
|
|
10
|
+
)
|
|
11
|
+
from midas_dt.reduce import FrameReducer
|
|
12
|
+
|
|
13
|
+
geo = geometry_from_legacy_params("ps_dt.txt")
|
|
14
|
+
scan = DTScan.from_stem("/data", "sample", 161, 215, dark_file="dark.raw")
|
|
15
|
+
chan = Channel(105, 125, r_bin=0.5)
|
|
16
|
+
|
|
17
|
+
inten, var = zip(*(FrameReducer(geo, chan, dark=scan.dark())
|
|
18
|
+
.reduce_translation(scan, t)
|
|
19
|
+
for t in range(scan.n_translations)))
|
|
20
|
+
stack = assemble(np.stack(inten), np.stack(var), scan.omega_deg, chan,
|
|
21
|
+
snake=detect_snake(profiles)[0])
|
|
22
|
+
result = run_recon_then_fit(stack, shift=find_centre(stack).shift)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
or from the shell:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
midas-dt --params ps_dt.txt --raw-dir /data --stem sample \
|
|
29
|
+
--start 161 --end 215 --dark dark.raw \
|
|
30
|
+
--r-min 105 --r-max 125 --out ./maps
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Scope
|
|
34
|
+
|
|
35
|
+
**In:** powder-like XRD-CT. A pencil or line beam, the sample translated
|
|
36
|
+
across it and rotated, one area-detector frame per (translation, rotation).
|
|
37
|
+
Rings are integrated azimuthally, reconstructed per (Q, η) bin, and fitted.
|
|
38
|
+
|
|
39
|
+
**Out:** scanning-3DXRD. If the rings break into discrete spots the sample is
|
|
40
|
+
coarse-grained and this is the wrong tool — use `midas_index`'s PF mode with
|
|
41
|
+
`midas_pf_odf`. The dividing line is operational: continuous at your working
|
|
42
|
+
bin size, or not. Check it on a frame before committing to a reduction —
|
|
43
|
+
`packages/midas_dt/dev/look_at_frame.py` in the MIDAS repo does this, and
|
|
44
|
+
`midas_dt.rings.find_rings` gives the quantitative version.
|
|
45
|
+
|
|
46
|
+
One trap worth repeating from that script: on a Pilatus, the module gaps read
|
|
47
|
+
as azimuthal structure and make **every** ring look spotty. Mask them first.
|
|
48
|
+
|
|
49
|
+
## The two branches
|
|
50
|
+
|
|
51
|
+
Both ship, they share one `Channel` list, and `compare()` measures the gap
|
|
52
|
+
between them on your data.
|
|
53
|
+
|
|
54
|
+
**`run_fit_then_recon`** fits each projection, then reconstructs the parameter
|
|
55
|
+
sinograms. 12 reconstructions per channel, independent of binning — cheap.
|
|
56
|
+
|
|
57
|
+
**`run_recon_then_fit`** reconstructs every bin, then fits per voxel. Exact,
|
|
58
|
+
at `n_r × n_eta` reconstructions.
|
|
59
|
+
|
|
60
|
+
### When branch A is valid
|
|
61
|
+
|
|
62
|
+
Radon inversion is linear; peak fitting is not. Only quantities that **add
|
|
63
|
+
along a ray** may be back-projected directly:
|
|
64
|
+
|
|
65
|
+
- `TotalIntensity`, `TotalIntensityBackgroundCorr`, `FitIntegratedIntensity` — yes.
|
|
66
|
+
- `RMEAN`, `SigmaG`, `SigmaL`, `MixFactor` — **no**. A projection's fitted
|
|
67
|
+
`RMEAN` is the intensity-weighted mean along the ray, not the sum, so
|
|
68
|
+
back-projecting it gives a number with no physical meaning that looks
|
|
69
|
+
entirely reasonable.
|
|
70
|
+
|
|
71
|
+
So `weighting="intensity"` (the default) reconstructs the moments instead:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
RMEAN_voxel = recon(RMEAN_proj × I_proj) / recon(I_proj)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Both terms add, so this is correct wherever the single-peak / small-shift
|
|
78
|
+
linearisation holds. `weighting="none"` reproduces the legacy behaviour and
|
|
79
|
+
marks its outputs `approximate` in the result and its provenance.
|
|
80
|
+
|
|
81
|
+
Measured on a phantom whose peak position varies across the sample:
|
|
82
|
+
`TotalIntensity` (additive) agrees between branches to **0.0**; `RMEAN` (not
|
|
83
|
+
additive) to **0.0085**. That difference is the reason the distinction exists.
|
|
84
|
+
|
|
85
|
+
## Conventions it pins
|
|
86
|
+
|
|
87
|
+
`midas_dt.conventions` is the single place for the things that silently
|
|
88
|
+
produce wrong answers. All are tested.
|
|
89
|
+
|
|
90
|
+
| | |
|
|
91
|
+
|---|---|
|
|
92
|
+
| fit-output order | 12 canonical channels; `MaxIntensityObs` is slot **5** |
|
|
93
|
+
| additive outputs | only 3 of the 12 may be back-projected |
|
|
94
|
+
| `RECON_SIGN` | −1: `doLog=0` back-projects intensity, so the result is negative-going |
|
|
95
|
+
| omega | negated once (1-ID aerotech), in `DTScan.from_stem` |
|
|
96
|
+
| first frame | dropped (1-ID writes a throwaway) |
|
|
97
|
+
| snake | **detected** from the data, not read from a flag |
|
|
98
|
+
|
|
99
|
+
**Reading pre-2026 MIDAS DT output:** every legacy Python driver omits
|
|
100
|
+
`MaxIntensityObs` from slot 5, shifting each label from index 5 on — a file
|
|
101
|
+
named `*_BGFit_*` actually holds `MaxIntensityObs`. Index by position and take
|
|
102
|
+
the name from `FIT_OUTPUT_NAMES`. Indices 0–4 are unaffected.
|
|
103
|
+
|
|
104
|
+
## Error bars
|
|
105
|
+
|
|
106
|
+
`midas_integrate_v2` propagates Poisson σ through integration; `sinogram`
|
|
107
|
+
carries it; `reconstruct(variance_samples=K)` gives per-voxel σ by Monte
|
|
108
|
+
Carlo. It is opt-in because each sample costs a full extra reconstruction.
|
|
109
|
+
|
|
110
|
+
There is deliberately no cheap "push the variance sinogram through FBP"
|
|
111
|
+
option: for a linear operator `A` that computes `A @ var`, not `A² @ var`, and
|
|
112
|
+
it can go negative through the ramp filter's lobes. Manufacturing an error bar
|
|
113
|
+
is worse than not having one.
|
|
114
|
+
|
|
115
|
+
## What it does not correct
|
|
116
|
+
|
|
117
|
+
Attached to every result via `ScanKnownLimits` and written into
|
|
118
|
+
`provenance.json`, so a map cannot be separated from its caveats:
|
|
119
|
+
|
|
120
|
+
- **self-absorption** — phase fractions are biased toward the sample surface
|
|
121
|
+
and are qualitative
|
|
122
|
+
- **texture** — the η-integrated pattern is a powder pattern only if the voxel
|
|
123
|
+
is randomly oriented
|
|
124
|
+
- **phase fractions** are relative: uncorrected for structure factor,
|
|
125
|
+
Lorentz-polarisation and absorption
|
|
126
|
+
- **a single-channel strain map** is one projection of the tensor along the
|
|
127
|
+
scattering vector, not the tensor
|
|
128
|
+
|
|
129
|
+
## Installing
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pip install midas-dt # scan, channels, sinograms, reconstruction
|
|
133
|
+
pip install midas-dt[full] # + integration, peak fitting, ring indexing
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`midas-tomo` supplies the reconstruction engine. The `[full]` extra adds
|
|
137
|
+
`midas-integrate-v2` (integration with variance), `midas-peakfit`,
|
|
138
|
+
`midas-hkls` (ring indexing) and `midas-stress`.
|
|
139
|
+
|
|
140
|
+
## License
|
|
141
|
+
|
|
142
|
+
BSD-3-Clause.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""midas-dt: diffraction / X-ray computed tomography (XRD-CT).
|
|
2
|
+
|
|
3
|
+
Takes a scan of detector frames over (translation, rotation) to per-voxel
|
|
4
|
+
diffraction patterns and the maps derived from them.
|
|
5
|
+
|
|
6
|
+
**Scope.** Powder-like XRD-CT: continuous rings, integrated azimuthally. If
|
|
7
|
+
the rings break into discrete spots the sample is coarse-grained and this is
|
|
8
|
+
the wrong tool -- that is scanning-3DXRD, handled by ``midas_index``'s PF mode
|
|
9
|
+
and ``midas_pf_odf``. The dividing line is operational: continuous at the
|
|
10
|
+
working (R, eta) bin size, or not.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
__version__ = "0.1.0"
|
|
16
|
+
|
|
17
|
+
from .channels import Channel, channels_from_legacy_params
|
|
18
|
+
from .conventions import (
|
|
19
|
+
ADDITIVE_FIT_OUTPUTS,
|
|
20
|
+
FIT_OUTPUT_NAMES,
|
|
21
|
+
RECON_SIGN,
|
|
22
|
+
aps_1id_omega,
|
|
23
|
+
fit_output_index,
|
|
24
|
+
is_additive,
|
|
25
|
+
recon_size,
|
|
26
|
+
unsnake,
|
|
27
|
+
)
|
|
28
|
+
from .reduce import FrameReducer, ReducedFrame, poisson_variance
|
|
29
|
+
from .branches import (
|
|
30
|
+
BranchResult,
|
|
31
|
+
compare,
|
|
32
|
+
format_comparison,
|
|
33
|
+
run_fit_then_recon,
|
|
34
|
+
run_recon_then_fit,
|
|
35
|
+
)
|
|
36
|
+
from .index_rings import (
|
|
37
|
+
ALPHA_U3O8,
|
|
38
|
+
CEO2,
|
|
39
|
+
IndexResult,
|
|
40
|
+
PhaseCandidate,
|
|
41
|
+
RingMatch,
|
|
42
|
+
index_rings,
|
|
43
|
+
)
|
|
44
|
+
from .io import read_legacy_reconstruction, write_maps_hdf5, write_result
|
|
45
|
+
from .maps import (
|
|
46
|
+
StrainMap,
|
|
47
|
+
d_spacing_map,
|
|
48
|
+
phase_fraction_map,
|
|
49
|
+
radius_to_d_spacing,
|
|
50
|
+
radius_to_two_theta,
|
|
51
|
+
strain_map,
|
|
52
|
+
)
|
|
53
|
+
from .peakfit import LineoutFit, fit_lineout
|
|
54
|
+
from .center import CentreResult, centre_of_mass_shift, find_centre
|
|
55
|
+
from .recon import Reconstruction, reconstruct
|
|
56
|
+
from .sinogram import SinogramStack, assemble
|
|
57
|
+
from .geometry import (
|
|
58
|
+
DTGeometry,
|
|
59
|
+
from_calibration,
|
|
60
|
+
geometry_from_legacy_params,
|
|
61
|
+
parse_legacy_params,
|
|
62
|
+
spec_from_calibration,
|
|
63
|
+
)
|
|
64
|
+
from .rings import Ring, find_rings, rolling_baseline
|
|
65
|
+
from .scan import PILATUS_1475x1679, DTScan, RawFormat, detect_snake, frames_in_file
|
|
66
|
+
|
|
67
|
+
__all__ = [
|
|
68
|
+
"__version__",
|
|
69
|
+
"ADDITIVE_FIT_OUTPUTS",
|
|
70
|
+
"ALPHA_U3O8",
|
|
71
|
+
"BranchResult",
|
|
72
|
+
"CEO2",
|
|
73
|
+
"IndexResult",
|
|
74
|
+
"PhaseCandidate",
|
|
75
|
+
"RingMatch",
|
|
76
|
+
"CentreResult",
|
|
77
|
+
"LineoutFit",
|
|
78
|
+
"StrainMap",
|
|
79
|
+
"Channel",
|
|
80
|
+
"DTGeometry",
|
|
81
|
+
"DTScan",
|
|
82
|
+
"FIT_OUTPUT_NAMES",
|
|
83
|
+
"PILATUS_1475x1679",
|
|
84
|
+
"RECON_SIGN",
|
|
85
|
+
"RawFormat",
|
|
86
|
+
"Ring",
|
|
87
|
+
"FrameReducer",
|
|
88
|
+
"ReducedFrame",
|
|
89
|
+
"Reconstruction",
|
|
90
|
+
"SinogramStack",
|
|
91
|
+
"aps_1id_omega",
|
|
92
|
+
"assemble",
|
|
93
|
+
"centre_of_mass_shift",
|
|
94
|
+
"channels_from_legacy_params",
|
|
95
|
+
"compare",
|
|
96
|
+
"find_centre",
|
|
97
|
+
"find_rings",
|
|
98
|
+
"d_spacing_map",
|
|
99
|
+
"read_legacy_reconstruction",
|
|
100
|
+
"write_maps_hdf5",
|
|
101
|
+
"write_result",
|
|
102
|
+
"fit_lineout",
|
|
103
|
+
"index_rings",
|
|
104
|
+
"phase_fraction_map",
|
|
105
|
+
"radius_to_d_spacing",
|
|
106
|
+
"radius_to_two_theta",
|
|
107
|
+
"strain_map",
|
|
108
|
+
"format_comparison",
|
|
109
|
+
"run_fit_then_recon",
|
|
110
|
+
"run_recon_then_fit",
|
|
111
|
+
"detect_snake",
|
|
112
|
+
"fit_output_index",
|
|
113
|
+
"frames_in_file",
|
|
114
|
+
"from_calibration",
|
|
115
|
+
"geometry_from_legacy_params",
|
|
116
|
+
"is_additive",
|
|
117
|
+
"parse_legacy_params",
|
|
118
|
+
"spec_from_calibration",
|
|
119
|
+
"poisson_variance",
|
|
120
|
+
"recon_size",
|
|
121
|
+
"rolling_baseline",
|
|
122
|
+
"reconstruct",
|
|
123
|
+
"unsnake",
|
|
124
|
+
]
|