ChessAnalysisPipeline 0.0.14__py3-none-any.whl → 0.0.16__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.

Potentially problematic release.


This version of ChessAnalysisPipeline might be problematic. Click here for more details.

Files changed (38) hide show
  1. CHAP/__init__.py +1 -1
  2. CHAP/common/__init__.py +13 -0
  3. CHAP/common/models/integration.py +29 -26
  4. CHAP/common/models/map.py +395 -224
  5. CHAP/common/processor.py +1725 -93
  6. CHAP/common/reader.py +265 -28
  7. CHAP/common/writer.py +191 -18
  8. CHAP/edd/__init__.py +9 -2
  9. CHAP/edd/models.py +886 -665
  10. CHAP/edd/processor.py +2592 -936
  11. CHAP/edd/reader.py +889 -0
  12. CHAP/edd/utils.py +846 -292
  13. CHAP/foxden/__init__.py +6 -0
  14. CHAP/foxden/processor.py +42 -0
  15. CHAP/foxden/writer.py +65 -0
  16. CHAP/giwaxs/__init__.py +8 -0
  17. CHAP/giwaxs/models.py +100 -0
  18. CHAP/giwaxs/processor.py +520 -0
  19. CHAP/giwaxs/reader.py +5 -0
  20. CHAP/giwaxs/writer.py +5 -0
  21. CHAP/pipeline.py +48 -10
  22. CHAP/runner.py +161 -72
  23. CHAP/tomo/models.py +31 -29
  24. CHAP/tomo/processor.py +169 -118
  25. CHAP/utils/__init__.py +1 -0
  26. CHAP/utils/fit.py +1292 -1315
  27. CHAP/utils/general.py +411 -53
  28. CHAP/utils/models.py +594 -0
  29. CHAP/utils/parfile.py +10 -2
  30. ChessAnalysisPipeline-0.0.16.dist-info/LICENSE +60 -0
  31. {ChessAnalysisPipeline-0.0.14.dist-info → ChessAnalysisPipeline-0.0.16.dist-info}/METADATA +1 -1
  32. ChessAnalysisPipeline-0.0.16.dist-info/RECORD +62 -0
  33. {ChessAnalysisPipeline-0.0.14.dist-info → ChessAnalysisPipeline-0.0.16.dist-info}/WHEEL +1 -1
  34. CHAP/utils/scanparsers.py +0 -1431
  35. ChessAnalysisPipeline-0.0.14.dist-info/LICENSE +0 -21
  36. ChessAnalysisPipeline-0.0.14.dist-info/RECORD +0 -54
  37. {ChessAnalysisPipeline-0.0.14.dist-info → ChessAnalysisPipeline-0.0.16.dist-info}/entry_points.txt +0 -0
  38. {ChessAnalysisPipeline-0.0.14.dist-info → ChessAnalysisPipeline-0.0.16.dist-info}/top_level.txt +0 -0
CHAP/__init__.py CHANGED
@@ -22,4 +22,4 @@ from CHAP.reader import Reader
22
22
  from CHAP.processor import Processor
23
23
  from CHAP.writer import Writer
24
24
 
25
- version = 'v0.0.14'
25
+ version = 'v0.0.16'
CHAP/common/__init__.py CHANGED
@@ -9,9 +9,12 @@ validating input data in some `Processor`s.
9
9
 
10
10
  from CHAP.common.reader import (
11
11
  BinaryFileReader,
12
+ FabioImageReader,
12
13
  H5Reader,
13
14
  MapReader,
14
15
  NexusReader,
16
+ NXdataReader,
17
+ NXfieldReader,
15
18
  SpecReader,
16
19
  URLReader,
17
20
  YAMLReader,
@@ -24,20 +27,30 @@ from CHAP.common.processor import (
24
27
  IntegrationProcessor,
25
28
  IntegrateMapProcessor,
26
29
  MapProcessor,
30
+ MPICollectProcessor,
31
+ MPIMapProcessor,
32
+ MPISpawnMapProcessor,
27
33
  NexusToNumpyProcessor,
28
34
  NexusToXarrayProcessor,
29
35
  PrintProcessor,
36
+ PyfaiAzimuthalIntegrationProcessor,
30
37
  RawDetectorDataMapProcessor,
31
38
  StrainAnalysisProcessor,
39
+ SetupNXdataProcessor,
40
+ UpdateNXdataProcessor,
41
+ NXdataToDataPointsProcessor,
32
42
  XarrayToNexusProcessor,
33
43
  XarrayToNumpyProcessor,
44
+ SumProcessor,
34
45
  )
35
46
  from CHAP.common.writer import (
36
47
  ExtractArchiveWriter,
37
48
  FileTreeWriter,
49
+ H5Writer,
38
50
  MatplotlibAnimationWriter,
39
51
  MatplotlibFigureWriter,
40
52
  NexusWriter,
53
+ PyfaiResultsWriter,
41
54
  YAMLWriter,
42
55
  TXTWriter,
43
56
  )
@@ -6,13 +6,15 @@ from typing import Literal, Optional
6
6
 
7
7
  # Third party modules
8
8
  import numpy as np
9
- from pydantic import (BaseModel,
10
- validator,
11
- constr,
12
- conlist,
13
- conint,
14
- confloat,
15
- FilePath)
9
+ from pydantic import (
10
+ BaseModel,
11
+ FilePath,
12
+ confloat,
13
+ conint,
14
+ conlist,
15
+ constr,
16
+ field_validator,
17
+ )
16
18
  from pyFAI import load as pyfai_load
17
19
  from pyFAI.multi_geometry import MultiGeometry
18
20
  from pyFAI.units import AZIMUTHAL_UNITS, RADIAL_UNITS
@@ -31,9 +33,10 @@ class Detector(BaseModel):
31
33
  """
32
34
  prefix: constr(strip_whitespace=True, min_length=1)
33
35
  poni_file: FilePath
34
- mask_file: Optional[FilePath]
36
+ mask_file: Optional[FilePath] = None
35
37
 
36
- @validator('poni_file', allow_reuse=True)
38
+ @field_validator('poni_file')
39
+ @classmethod
37
40
  def validate_poni_file(cls, poni_file):
38
41
  """Validate the poni file by checking if it's a valid PONI
39
42
  file.
@@ -51,7 +54,8 @@ class Detector(BaseModel):
51
54
  raise ValueError(f'{poni_file} is not a valid PONI file') from exc
52
55
  return poni_file
53
56
 
54
- @validator('mask_file', allow_reuse=True)
57
+ @field_validator('mask_file')
58
+ @classmethod
55
59
  def validate_mask_file(cls, mask_file, values):
56
60
  """Validate the mask file. If a mask file is provided, it
57
61
  checks if it's a valid TIFF file.
@@ -176,7 +180,7 @@ class IntegrationConfig(BaseModel):
176
180
  tool_type: Literal['integration'] = 'integration'
177
181
  title: constr(strip_whitespace=True, min_length=1)
178
182
  integration_type: Literal['azimuthal', 'radial', 'cake']
179
- detectors: conlist(item_type=Detector, min_items=1)
183
+ detectors: conlist(item_type=Detector, min_length=1)
180
184
  radial_units: str = 'q_A^-1'
181
185
  radial_min: confloat(ge=0)
182
186
  radial_max: confloat(gt=0)
@@ -185,10 +189,11 @@ class IntegrationConfig(BaseModel):
185
189
  azimuthal_min: confloat(ge=-180) = -180
186
190
  azimuthal_max: confloat(le=360) = 180
187
191
  azimuthal_npt: conint(gt=0) = 3600
188
- error_model: Optional[Literal['poisson', 'azimuthal']]
189
- sequence_index: Optional[conint(gt=0)]
192
+ error_model: Optional[Literal['poisson', 'azimuthal']] = None
193
+ sequence_index: Optional[conint(gt=0)] = None
190
194
 
191
- @validator('radial_units', allow_reuse=True)
195
+ @field_validator('radial_units')
196
+ @classmethod
192
197
  def validate_radial_units(cls, radial_units):
193
198
  """Validate the radial units for the integration.
194
199
 
@@ -206,7 +211,8 @@ class IntegrationConfig(BaseModel):
206
211
  f'Invalid radial units: {radial_units}. '
207
212
  f'Must be one of {", ".join(RADIAL_UNITS.keys())}')
208
213
 
209
- @validator('azimuthal_units', allow_reuse=True)
214
+ @field_validator('azimuthal_units')
215
+ @classmethod
210
216
  def validate_azimuthal_units(cls, azimuthal_units):
211
217
  """Validate that `azimuthal_units` is one of the keys in the
212
218
  `pyFAI.units.AZIMUTHAL_UNITS` dictionary.
@@ -235,23 +241,22 @@ class IntegrationConfig(BaseModel):
235
241
  :return: The callable that performs the validation.
236
242
  :rtype: callable
237
243
  """
238
- def _validate_range_max(cls, range_max, values):
244
+ def _validate_range_max(cls, range_max, info):
239
245
  """Check if the maximum value of the integration range is
240
246
  greater than its minimum value.
241
247
 
242
248
  :param range_max: The maximum value of the integration
243
249
  range.
244
250
  :type range_max: float
245
- :param values: The values of the other fields being
246
- validated.
247
- :type values: dict
251
+ :param info: Pydantic validator info object.
252
+ :type info: pydantic_core._pydantic_core.ValidationInfo
248
253
  :raises ValueError: If the maximum value of the
249
254
  integration range is not greater than its minimum
250
255
  value.
251
256
  :return: The validated maximum range value
252
257
  :rtype: float
253
258
  """
254
- range_min = values.get(f'{range_name}_min')
259
+ range_min = info.data.get(f'{range_name}_min')
255
260
  if range_min < range_max:
256
261
  return range_max
257
262
  raise ValueError(
@@ -260,12 +265,10 @@ class IntegrationConfig(BaseModel):
260
265
  f'({range_name}_min={range_min}).')
261
266
  return _validate_range_max
262
267
 
263
- _validate_radial_max = validator(
264
- 'radial_max',
265
- allow_reuse=True)(validate_range_max('radial'))
266
- _validate_azimuthal_max = validator(
267
- 'azimuthal_max',
268
- allow_reuse=True)(validate_range_max('azimuthal'))
268
+ _validate_radial_max = field_validator(
269
+ 'radial_max')(validate_range_max('radial'))
270
+ _validate_azimuthal_max = field_validator(
271
+ 'azimuthal_max')(validate_range_max('azimuthal'))
269
272
 
270
273
  def validate_for_map_config(self, map_config:BaseModel):
271
274
  """Validate the existence of the detector data file for all