ChessAnalysisPipeline 0.0.17.dev3__py3-none-any.whl
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.
- CHAP/TaskManager.py +216 -0
- CHAP/__init__.py +27 -0
- CHAP/common/__init__.py +57 -0
- CHAP/common/models/__init__.py +8 -0
- CHAP/common/models/common.py +124 -0
- CHAP/common/models/integration.py +659 -0
- CHAP/common/models/map.py +1291 -0
- CHAP/common/processor.py +2869 -0
- CHAP/common/reader.py +658 -0
- CHAP/common/utils.py +110 -0
- CHAP/common/writer.py +730 -0
- CHAP/edd/__init__.py +23 -0
- CHAP/edd/models.py +876 -0
- CHAP/edd/processor.py +3069 -0
- CHAP/edd/reader.py +1023 -0
- CHAP/edd/select_material_params_gui.py +348 -0
- CHAP/edd/utils.py +1572 -0
- CHAP/edd/writer.py +26 -0
- CHAP/foxden/__init__.py +19 -0
- CHAP/foxden/models.py +71 -0
- CHAP/foxden/processor.py +124 -0
- CHAP/foxden/reader.py +224 -0
- CHAP/foxden/utils.py +80 -0
- CHAP/foxden/writer.py +168 -0
- CHAP/giwaxs/__init__.py +11 -0
- CHAP/giwaxs/models.py +491 -0
- CHAP/giwaxs/processor.py +776 -0
- CHAP/giwaxs/reader.py +8 -0
- CHAP/giwaxs/writer.py +8 -0
- CHAP/inference/__init__.py +7 -0
- CHAP/inference/processor.py +69 -0
- CHAP/inference/reader.py +8 -0
- CHAP/inference/writer.py +8 -0
- CHAP/models.py +227 -0
- CHAP/pipeline.py +479 -0
- CHAP/processor.py +125 -0
- CHAP/reader.py +124 -0
- CHAP/runner.py +277 -0
- CHAP/saxswaxs/__init__.py +7 -0
- CHAP/saxswaxs/processor.py +8 -0
- CHAP/saxswaxs/reader.py +8 -0
- CHAP/saxswaxs/writer.py +8 -0
- CHAP/server.py +125 -0
- CHAP/sin2psi/__init__.py +7 -0
- CHAP/sin2psi/processor.py +8 -0
- CHAP/sin2psi/reader.py +8 -0
- CHAP/sin2psi/writer.py +8 -0
- CHAP/tomo/__init__.py +15 -0
- CHAP/tomo/models.py +210 -0
- CHAP/tomo/processor.py +3862 -0
- CHAP/tomo/reader.py +9 -0
- CHAP/tomo/writer.py +59 -0
- CHAP/utils/__init__.py +6 -0
- CHAP/utils/converters.py +188 -0
- CHAP/utils/fit.py +2947 -0
- CHAP/utils/general.py +2655 -0
- CHAP/utils/material.py +274 -0
- CHAP/utils/models.py +595 -0
- CHAP/utils/parfile.py +224 -0
- CHAP/writer.py +122 -0
- MLaaS/__init__.py +0 -0
- MLaaS/ktrain.py +205 -0
- MLaaS/mnist_img.py +83 -0
- MLaaS/tfaas_client.py +371 -0
- chessanalysispipeline-0.0.17.dev3.dist-info/LICENSE +60 -0
- chessanalysispipeline-0.0.17.dev3.dist-info/METADATA +29 -0
- chessanalysispipeline-0.0.17.dev3.dist-info/RECORD +70 -0
- chessanalysispipeline-0.0.17.dev3.dist-info/WHEEL +5 -0
- chessanalysispipeline-0.0.17.dev3.dist-info/entry_points.txt +2 -0
- chessanalysispipeline-0.0.17.dev3.dist-info/top_level.txt +2 -0
CHAP/tomo/models.py
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"""Tomography Pydantic model classes."""
|
|
2
|
+
|
|
3
|
+
# Third party imports
|
|
4
|
+
from typing import (
|
|
5
|
+
Literal,
|
|
6
|
+
Optional,
|
|
7
|
+
)
|
|
8
|
+
from pydantic import (
|
|
9
|
+
conint,
|
|
10
|
+
conlist,
|
|
11
|
+
confloat,
|
|
12
|
+
constr,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
# Local modules
|
|
16
|
+
from CHAP.models import CHAPBaseModel
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class Detector(CHAPBaseModel):
|
|
20
|
+
"""
|
|
21
|
+
Detector class to represent the detector used in the experiment.
|
|
22
|
+
The image origin is assumed to be in the top-left corner, with
|
|
23
|
+
rows down (-z in lab frame) and columns sideways (+x in lab frame).
|
|
24
|
+
|
|
25
|
+
:ivar prefix: Prefix of the detector in the SPEC file.
|
|
26
|
+
:type prefix: str
|
|
27
|
+
:ivar rows: Number of pixel rows on the detector.
|
|
28
|
+
:type rows: int
|
|
29
|
+
:ivar columns: Number of pixel columns on the detector.
|
|
30
|
+
:type columns: int
|
|
31
|
+
:ivar pixel_size: Pixel size of the detector in mm.
|
|
32
|
+
:type pixel_size: int or list[int]
|
|
33
|
+
:ivar lens_magnification: Lens magnification for the detector,
|
|
34
|
+
defaults to `1.0`.
|
|
35
|
+
:type lens_magnification: float, optional
|
|
36
|
+
"""
|
|
37
|
+
prefix: constr(strip_whitespace=True, min_length=1)
|
|
38
|
+
rows: conint(gt=0)
|
|
39
|
+
columns: conint(gt=0)
|
|
40
|
+
pixel_size: conlist(
|
|
41
|
+
item_type=confloat(gt=0, allow_inf_nan=False),
|
|
42
|
+
min_length=1, max_length=2)
|
|
43
|
+
lens_magnification: confloat(gt=0, allow_inf_nan=False) = 1.0
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class TomoReduceConfig(CHAPBaseModel):
|
|
47
|
+
"""
|
|
48
|
+
Class representing the configuration for the tomography image
|
|
49
|
+
reduction processor.
|
|
50
|
+
|
|
51
|
+
:ivar img_row_bounds: Detector image bounds in the row-direction
|
|
52
|
+
(ignored for id1a3 and id3a).
|
|
53
|
+
:type img_row_bounds: list[int], optional
|
|
54
|
+
:ivar delta_theta: Rotation angle increment in image reduction
|
|
55
|
+
in degrees.
|
|
56
|
+
:type delta_theta: float, optional
|
|
57
|
+
"""
|
|
58
|
+
img_row_bounds: Optional[
|
|
59
|
+
conlist(item_type=conint(ge=-1), min_length=2, max_length=2)] = None
|
|
60
|
+
delta_theta: Optional[confloat(gt=0, allow_inf_nan=False)] = None
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class TomoFindCenterConfig(CHAPBaseModel):
|
|
64
|
+
"""
|
|
65
|
+
Class representing the configuration for the tomography center axis
|
|
66
|
+
finding processor.
|
|
67
|
+
|
|
68
|
+
:ivar center_stack_index: Stack index of the tomography set to find
|
|
69
|
+
the center axis.
|
|
70
|
+
:type center_stack_index: int, optional
|
|
71
|
+
:ivar center_rows: Row indices for the center finding processor.
|
|
72
|
+
:type center_rows: list[int, int], optional
|
|
73
|
+
:ivar center_offsets: Centers at the center finding row indices in
|
|
74
|
+
pixels.
|
|
75
|
+
:type center_offsets: list[float, float], optional
|
|
76
|
+
:ivar center_offset_min: Minimum value of center_offset in center
|
|
77
|
+
axis finding search in pixels.
|
|
78
|
+
:type center_offset_min: float, optional
|
|
79
|
+
:ivar center_offset_max: Maximum value of center_offset in center
|
|
80
|
+
axis finding search in pixels.
|
|
81
|
+
:type center_offset_max: float, optional
|
|
82
|
+
:ivar gaussian_sigma: Standard deviation for the Gaussian filter
|
|
83
|
+
applied to image reconstruction visualizations, defaults to no
|
|
84
|
+
filtering performed.
|
|
85
|
+
:type gaussian_sigma: float, optional
|
|
86
|
+
:ivar ring_width: Maximum width of rings to be filtered in the image
|
|
87
|
+
reconstruction in pixels, defaults to no filtering performed.
|
|
88
|
+
:type ring_width: float, optional
|
|
89
|
+
"""
|
|
90
|
+
center_stack_index: Optional[conint(ge=0)] = None
|
|
91
|
+
center_rows: Optional[conlist(
|
|
92
|
+
item_type=conint(ge=0), min_length=2, max_length=2)] = None
|
|
93
|
+
center_offsets: Optional[conlist(
|
|
94
|
+
item_type=confloat(allow_inf_nan=False),
|
|
95
|
+
min_length=2, max_length=2)] = None
|
|
96
|
+
center_offset_min: Optional[confloat(allow_inf_nan=False)] = None
|
|
97
|
+
center_offset_max: Optional[confloat(allow_inf_nan=False)] = None
|
|
98
|
+
center_search_range: Optional[conlist(
|
|
99
|
+
item_type=confloat(allow_inf_nan=False),
|
|
100
|
+
min_length=1, max_length=3)] = None
|
|
101
|
+
gaussian_sigma: Optional[confloat(ge=0, allow_inf_nan=False)] = None
|
|
102
|
+
ring_width: Optional[confloat(ge=0, allow_inf_nan=False)] = None
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class TomoReconstructConfig(CHAPBaseModel):
|
|
106
|
+
"""
|
|
107
|
+
Class representing the configuration for the tomography image
|
|
108
|
+
reconstruction processor.
|
|
109
|
+
|
|
110
|
+
:ivar x_bounds: Reconstructed image bounds in the x-direction.
|
|
111
|
+
:type x_bounds: list[int], optional
|
|
112
|
+
:ivar y_bounds: Reconstructed image bounds in the y-direction.
|
|
113
|
+
:type y_bounds: list[int], optional
|
|
114
|
+
:ivar z_bounds: Reconstructed image bounds in the z-direction.
|
|
115
|
+
:type z_bounds: list[int], optional
|
|
116
|
+
:ivar secondary_iters: Number of secondary iterations in the tomopy
|
|
117
|
+
image reconstruction algorithm, defaults to `0`.
|
|
118
|
+
:type secondary_iters: int, optional
|
|
119
|
+
:ivar gaussian_sigma: Standard deviation for the Gaussian filter
|
|
120
|
+
applied to image reconstruction visualizations, defaults to no
|
|
121
|
+
filtering performed.
|
|
122
|
+
:type gaussian_sigma: float, optional
|
|
123
|
+
:ivar remove_stripe_sigma: Damping parameter in Fourier space in
|
|
124
|
+
tomopy's horizontal stripe removal tool, defaults to no
|
|
125
|
+
correction performed.
|
|
126
|
+
:type remove_stripe_sigma: float, optional
|
|
127
|
+
:ivar ring_width: Maximum width of rings to be filtered in the image
|
|
128
|
+
reconstruction in pixels, defaults to no filtering performed.
|
|
129
|
+
:type ring_width: float, optional
|
|
130
|
+
"""
|
|
131
|
+
x_bounds: Optional[
|
|
132
|
+
conlist(item_type=conint(ge=-1), min_length=2, max_length=2)] = None
|
|
133
|
+
y_bounds: Optional[
|
|
134
|
+
conlist(item_type=conint(ge=-1), min_length=2, max_length=2)] = None
|
|
135
|
+
z_bounds: Optional[
|
|
136
|
+
conlist(item_type=conint(ge=-1), min_length=2, max_length=2)] = None
|
|
137
|
+
secondary_iters: conint(ge=0) = 0
|
|
138
|
+
gaussian_sigma: Optional[confloat(ge=0, allow_inf_nan=False)] = None
|
|
139
|
+
remove_stripe_sigma: Optional[confloat(ge=0, allow_inf_nan=False)] = None
|
|
140
|
+
ring_width: Optional[confloat(ge=0, allow_inf_nan=False)] = None
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class TomoCombineConfig(CHAPBaseModel):
|
|
144
|
+
"""
|
|
145
|
+
Class representing the configuration for the combined tomography
|
|
146
|
+
stacks processor.
|
|
147
|
+
|
|
148
|
+
:ivar x_bounds: Combined image bounds in the x-direction.
|
|
149
|
+
:type x_bounds: list[int], optional
|
|
150
|
+
:ivar y_bounds: Combined image bounds in the y-direction.
|
|
151
|
+
:type y_bounds: list[int], optional
|
|
152
|
+
:ivar z_bounds: Combined image bounds in the z-direction.
|
|
153
|
+
:type z_bounds: list[int], optional
|
|
154
|
+
"""
|
|
155
|
+
x_bounds: Optional[
|
|
156
|
+
conlist(item_type=conint(ge=-1), min_length=2, max_length=2)] = None
|
|
157
|
+
y_bounds: Optional[
|
|
158
|
+
conlist(item_type=conint(ge=-1), min_length=2, max_length=2)] = None
|
|
159
|
+
z_bounds: Optional[
|
|
160
|
+
conlist(item_type=conint(ge=-1), min_length=2, max_length=2)] = None
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
class TomoSimConfig(CHAPBaseModel):
|
|
164
|
+
"""
|
|
165
|
+
Class representing the configuration for the tomography simulator.
|
|
166
|
+
|
|
167
|
+
:ivar station: The station name (in 'idxx' format).
|
|
168
|
+
:type station: Literal['id1a3', 'id3a', 'id3b']
|
|
169
|
+
:ivar detector: Detector used in the tomography experiment.
|
|
170
|
+
:type detector: Detector
|
|
171
|
+
:ivar sample_type: Sample type for the tomography simulator.
|
|
172
|
+
:type sample_type: Literal['square_rod', 'square_pipe',
|
|
173
|
+
'hollow_cube', 'hollow_brick', 'hollow_pyramid']
|
|
174
|
+
:ivar sample_size: Size of each sample dimension in mm (internally
|
|
175
|
+
converted to an integer number of pixels). Enter three values
|
|
176
|
+
for sample_type == `'hollow_pyramid'`, the height and the side
|
|
177
|
+
at the respective bottom and the top of the pyramid.
|
|
178
|
+
:type sample_size: list[float]
|
|
179
|
+
:ivar wall_thickness: Wall thickness for pipe, cube, and brick in
|
|
180
|
+
mm (internally converted to an integer number of pixels).
|
|
181
|
+
:type wall_thickness: float
|
|
182
|
+
:ivar mu: Linear attenuation coefficient in mm^-1, defaults to
|
|
183
|
+
`0.05`.
|
|
184
|
+
:type mu: float, optional
|
|
185
|
+
:ivar theta_step: Rotation angle increment in the tomography
|
|
186
|
+
simulation in degrees.
|
|
187
|
+
:type theta_step: float
|
|
188
|
+
:ivar beam_intensity: Initial beam intensity in counts,
|
|
189
|
+
defaults to `1.e9`.
|
|
190
|
+
:type beam_intensity: float, optional
|
|
191
|
+
:ivar background_intensity: Background intensity in counts,
|
|
192
|
+
defaults to `20`.
|
|
193
|
+
:type background_intensity: float, optional
|
|
194
|
+
:ivar slit_size: Vertical beam height in mm, defaults to `1.0`.
|
|
195
|
+
:type slit_size: float, optional
|
|
196
|
+
"""
|
|
197
|
+
station: Literal['id1a3', 'id3a', 'id3b']
|
|
198
|
+
detector: Detector.model_construct()
|
|
199
|
+
sample_type: Literal[
|
|
200
|
+
'square_rod', 'square_pipe', 'hollow_cube', 'hollow_brick',
|
|
201
|
+
'hollow_pyramid']
|
|
202
|
+
sample_size: conlist(
|
|
203
|
+
item_type=confloat(gt=0, allow_inf_nan=False),
|
|
204
|
+
min_length=1, max_length=3)
|
|
205
|
+
wall_thickness: Optional[confloat(ge=0, allow_inf_nan=False)] = None
|
|
206
|
+
mu: Optional[confloat(gt=0, allow_inf_nan=False)] = 0.05
|
|
207
|
+
theta_step: confloat(gt=0, allow_inf_nan=False)
|
|
208
|
+
beam_intensity: Optional[confloat(gt=0, allow_inf_nan=False)] = 1.e9
|
|
209
|
+
background_intensity: Optional[confloat(gt=0, allow_inf_nan=False)] = 20
|
|
210
|
+
slit_size: Optional[confloat(gt=0, allow_inf_nan=False)] = 1.0
|