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

@@ -513,6 +513,19 @@ class RotationScanParser(ScanParser):
513
513
  class FMBRotationScanParser(RotationScanParser, FMBScanParser):
514
514
  def __init__(self, spec_file_name, scan_number):
515
515
  super().__init__(spec_file_name, scan_number)
516
+ def get_spec_scan_npts(self):
517
+ if self.spec_macro == 'flyscan':
518
+ if len(self.spec_args) == 2:
519
+ # Flat field (dark or bright)
520
+ return(int(self.spec_args[0])+1)
521
+ elif len(self.spec_args) == 5:
522
+ return(int(self.spec_args[3])+1)
523
+ else:
524
+ raise(RuntimeError(f'{self.scan_title}: cannot obtain number of points from '+
525
+ f'{self.spec_macro} with arguments {self.spec_args}'))
526
+ else:
527
+ raise(RuntimeError(f'{self.scan_title}: cannot determine number of points for scans '+
528
+ f'of type {self.spec_macro}'))
516
529
  def get_theta_vals(self):
517
530
  if self.spec_macro == 'flyscan':
518
531
  if len(self.spec_args) == 2:
@@ -525,7 +538,7 @@ class FMBRotationScanParser(RotationScanParser, FMBScanParser):
525
538
  raise(RuntimeError(f'{self.scan_title}: cannot obtain theta values from '+
526
539
  f'{self.spec_macro} with arguments {self.spec_args}'))
527
540
  else:
528
- raise(RuntimeError(f'{self.scan_title}: cannot determine scan motors for scans '+
541
+ raise(RuntimeError(f'{self.scan_title}: cannot determine theta values for scans '+
529
542
  f'of type {self.spec_macro}'))
530
543
  def get_horizontal_shift(self):
531
544
  return(0.0)
@@ -578,6 +591,11 @@ class SMBRotationScanParser(RotationScanParser, SMBScanParser):
578
591
  def __init__(self, spec_file_name, scan_number):
579
592
  super().__init__(spec_file_name, scan_number)
580
593
  self.par_file_pattern = f'id*-*tomo*-{self.scan_name}'
594
+ def get_spec_scan_npts(self):
595
+ if self.spec_macro == 'slew_ome' or self.spec_macro == 'rams4_slew_ome':
596
+ return(int(self.pars['nframes_real']))
597
+ else:
598
+ raise(RuntimeError(f'{self.scan_title}: cannot determine number of points for scans of type {self.spec_macro}'))
581
599
  def get_scan_type(self):
582
600
  try:
583
601
  return(self.pars['tomo_type'])
CHAP/edd/processor.py CHANGED
@@ -8,10 +8,7 @@ Description: Module for Processors used only by EDD experiments
8
8
  '''
9
9
 
10
10
  # system modules
11
- import argparse
12
11
  import json
13
- import logging
14
- import sys
15
12
 
16
13
  # local modules
17
14
  from CHAP.processor import Processor
CHAP/pipeline.py CHANGED
@@ -50,7 +50,7 @@ class Pipeline():
50
50
  self.logger.info(f'Calling "write" on {item}')
51
51
  data = item.write(data, **kwargs)
52
52
 
53
- self.logger.info(f'Exectuted "exectute" in {time()-t0:.3f} seconds')
53
+ self.logger.info(f'Executed "execute" in {time()-t0:.3f} seconds')
54
54
 
55
55
  class PipelineObject():
56
56
  """
CHAP/tomo/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ # from CHAP.tomo.reader import
2
+ from CHAP.tomo.processor import TomoDataProcessor
3
+ # from CHAP.tomo.writer import
4
+
5
+ from CHAP.common import MapProcessor
CHAP/tomo/models.py ADDED
@@ -0,0 +1,125 @@
1
+ # system modules
2
+
3
+ # third party imports
4
+ from pydantic import (
5
+ BaseModel,
6
+ StrictBool,
7
+ conint,
8
+ conlist,
9
+ confloat,
10
+ constr,
11
+ )
12
+ from typing import Literal, Optional
13
+
14
+
15
+ class Detector(BaseModel):
16
+ """
17
+ Detector class to represent the detector used in the experiment.
18
+
19
+ :ivar prefix: Prefix of the detector in the SPEC file.
20
+ :type prefix: str
21
+ :ivar rows: Number of pixel rows on the detector
22
+ :type rows: int
23
+ :ivar columns: Number of pixel columns on the detector
24
+ :type columns: int
25
+ :ivar pixel_size: Pixel size of the detector in mm
26
+ :type pixel_size: int or list[int]
27
+ :ivar lens_magnification: Lens magnification for the detector
28
+ :type lens_magnification: float, optional
29
+ """
30
+ prefix: constr(strip_whitespace=True, min_length=1)
31
+ rows: conint(gt=0)
32
+ columns: conint(gt=0)
33
+ pixel_size: conlist(item_type=confloat(gt=0, allow_inf_nan=False), min_items=1, max_items=2)
34
+ lens_magnification: confloat(gt=0, allow_inf_nan=False) = 1.0
35
+
36
+
37
+ class TomoSetupConfig(BaseModel):
38
+ """
39
+ Class representing the configuration for the tomography reconstruction setup.
40
+
41
+ :ivar detectors: Detector used in the tomography experiment
42
+ :type detectors: Detector
43
+ """
44
+ detector: Detector.construct()
45
+ include_raw_data: Optional[StrictBool] = False
46
+
47
+
48
+ class TomoReduceConfig(BaseModel):
49
+ """
50
+ Class representing the configuration for tomography image reductions.
51
+
52
+ :ivar tool_type: Type of tomography reconstruction tool; always set to "reduce_data"
53
+ :type tool_type: str, optional
54
+ :ivar detectors: Detector used in the tomography experiment
55
+ :type detectors: Detector
56
+ :ivar img_x_bounds: Detector image bounds in the x-direction
57
+ :type img_x_bounds: list[int], optional
58
+ """
59
+ tool_type: Literal['reduce_data'] = 'reduce_data'
60
+ detector: Detector = Detector.construct()
61
+ img_x_bounds: Optional[conlist(item_type=conint(ge=0), min_items=2, max_items=2)]
62
+
63
+
64
+ class TomoFindCenterConfig(BaseModel):
65
+ """
66
+ Class representing the configuration for tomography find center axis.
67
+
68
+ :ivar tool_type: Type of tomography reconstruction tool; always set to "find_center"
69
+ :type tool_type: str, optional
70
+ :ivar center_stack_index: Stack index of tomography set to find center axis (offset 1)
71
+ :type center_stack_index: int, optional
72
+ :ivar lower_row: Lower row index for center finding
73
+ :type lower_row: int, optional
74
+ :ivar lower_center_offset: Center at lower row index
75
+ :type lower_center_offset: float, optional
76
+ :ivar upper_row: Upper row index for center finding
77
+ :type upper_row: int, optional
78
+ :ivar upper_center_offset: Center at upper row index
79
+ :type upper_center_offset: float, optional
80
+ """
81
+ tool_type: Literal['find_center'] = 'find_center'
82
+ center_stack_index: Optional[conint(ge=1)]
83
+ lower_row: Optional[conint(ge=-1)]
84
+ lower_center_offset: Optional[confloat(allow_inf_nan=False)]
85
+ upper_row: Optional[conint(ge=-1)]
86
+ upper_center_offset: Optional[confloat(allow_inf_nan=False)]
87
+
88
+
89
+ class TomoReconstructConfig(BaseModel):
90
+ """
91
+ Class representing the configuration for tomography image reconstruction.
92
+
93
+ :ivar tool_type: Type of tomography reconstruction tool; always set to "reconstruct_data"
94
+ :type tool_type: str, optional
95
+ :ivar x_bounds: Reconstructed image bounds in the x-direction
96
+ :type x_bounds: list[int], optional
97
+ :ivar y_bounds: Reconstructed image bounds in the y-direction
98
+ :type y_bounds: list[int], optional
99
+ :ivar z_bounds: Reconstructed image bounds in the z-direction
100
+ :type z_bounds: list[int], optional
101
+ """
102
+ tool_type: Literal['reconstruct_data'] = 'reconstruct_data'
103
+ x_bounds: Optional[conlist(item_type=conint(ge=-1), min_items=2, max_items=2)]
104
+ y_bounds: Optional[conlist(item_type=conint(ge=-1), min_items=2, max_items=2)]
105
+ z_bounds: Optional[conlist(item_type=conint(ge=-1), min_items=2, max_items=2)]
106
+
107
+
108
+ class TomoCombineConfig(BaseModel):
109
+ """
110
+ Class representing the configuration for combined tomography stacks.
111
+
112
+ :ivar tool_type: Type of tomography reconstruction tool; always set to "combine_data"
113
+ :type tool_type: str, optional
114
+ :ivar x_bounds: Reconstructed image bounds in the x-direction
115
+ :type x_bounds: list[int], optional
116
+ :ivar y_bounds: Reconstructed image bounds in the y-direction
117
+ :type y_bounds: list[int], optional
118
+ :ivar z_bounds: Reconstructed image bounds in the z-direction
119
+ :type z_bounds: list[int], optional
120
+ """
121
+ tool_type: Literal['combine_data'] = 'combine_data'
122
+ x_bounds: Optional[conlist(item_type=conint(ge=-1), min_items=2, max_items=2)]
123
+ y_bounds: Optional[conlist(item_type=conint(ge=-1), min_items=2, max_items=2)]
124
+ z_bounds: Optional[conlist(item_type=conint(ge=-1), min_items=2, max_items=2)]
125
+