nabu 2023.2.1__py3-none-any.whl → 2024.1.0rc3__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.
Files changed (183) hide show
  1. doc/conf.py +1 -1
  2. doc/doc_config.py +32 -0
  3. nabu/__init__.py +2 -1
  4. nabu/app/bootstrap_stitching.py +1 -1
  5. nabu/app/cli_configs.py +122 -2
  6. nabu/app/composite_cor.py +27 -2
  7. nabu/app/correct_rot.py +70 -0
  8. nabu/app/create_distortion_map_from_poly.py +42 -18
  9. nabu/app/diag_to_pix.py +358 -0
  10. nabu/app/diag_to_rot.py +449 -0
  11. nabu/app/generate_header.py +4 -3
  12. nabu/app/histogram.py +2 -2
  13. nabu/app/multicor.py +6 -1
  14. nabu/app/parse_reconstruction_log.py +151 -0
  15. nabu/app/prepare_weights_double.py +83 -22
  16. nabu/app/reconstruct.py +5 -1
  17. nabu/app/reconstruct_helical.py +7 -0
  18. nabu/app/reduce_dark_flat.py +6 -3
  19. nabu/app/rotate.py +4 -4
  20. nabu/app/stitching.py +16 -2
  21. nabu/app/tests/test_reduce_dark_flat.py +18 -2
  22. nabu/app/validator.py +4 -4
  23. nabu/cuda/convolution.py +8 -376
  24. nabu/cuda/fft.py +4 -0
  25. nabu/cuda/kernel.py +4 -4
  26. nabu/cuda/medfilt.py +5 -158
  27. nabu/cuda/padding.py +5 -71
  28. nabu/cuda/processing.py +23 -2
  29. nabu/cuda/src/ElementOp.cu +78 -0
  30. nabu/cuda/src/backproj.cu +28 -2
  31. nabu/cuda/src/fourier_wavelets.cu +2 -2
  32. nabu/cuda/src/normalization.cu +23 -0
  33. nabu/cuda/src/padding.cu +2 -2
  34. nabu/cuda/src/transpose.cu +16 -0
  35. nabu/cuda/utils.py +39 -0
  36. nabu/estimation/alignment.py +10 -1
  37. nabu/estimation/cor.py +808 -38
  38. nabu/estimation/cor_sino.py +7 -9
  39. nabu/estimation/tests/test_cor.py +85 -3
  40. nabu/io/reader.py +26 -18
  41. nabu/io/tests/test_cast_volume.py +3 -3
  42. nabu/io/tests/test_detector_distortion.py +3 -3
  43. nabu/io/tiffwriter_zmm.py +2 -2
  44. nabu/io/utils.py +14 -4
  45. nabu/io/writer.py +5 -3
  46. nabu/misc/fftshift.py +6 -0
  47. nabu/misc/histogram.py +5 -285
  48. nabu/misc/histogram_cuda.py +8 -104
  49. nabu/misc/kernel_base.py +3 -121
  50. nabu/misc/padding_base.py +5 -69
  51. nabu/misc/processing_base.py +3 -107
  52. nabu/misc/rotation.py +5 -62
  53. nabu/misc/rotation_cuda.py +5 -65
  54. nabu/misc/transpose.py +6 -0
  55. nabu/misc/unsharp.py +3 -78
  56. nabu/misc/unsharp_cuda.py +5 -52
  57. nabu/misc/unsharp_opencl.py +8 -85
  58. nabu/opencl/fft.py +6 -0
  59. nabu/opencl/kernel.py +21 -6
  60. nabu/opencl/padding.py +5 -72
  61. nabu/opencl/processing.py +27 -5
  62. nabu/opencl/src/backproj.cl +3 -3
  63. nabu/opencl/src/fftshift.cl +65 -12
  64. nabu/opencl/src/padding.cl +2 -2
  65. nabu/opencl/src/roll.cl +96 -0
  66. nabu/opencl/src/transpose.cl +16 -0
  67. nabu/pipeline/config_validators.py +63 -3
  68. nabu/pipeline/dataset_validator.py +2 -2
  69. nabu/pipeline/estimators.py +193 -35
  70. nabu/pipeline/fullfield/chunked.py +34 -17
  71. nabu/pipeline/fullfield/chunked_cuda.py +7 -5
  72. nabu/pipeline/fullfield/computations.py +48 -13
  73. nabu/pipeline/fullfield/nabu_config.py +13 -13
  74. nabu/pipeline/fullfield/processconfig.py +10 -5
  75. nabu/pipeline/fullfield/reconstruction.py +1 -2
  76. nabu/pipeline/helical/fbp.py +5 -0
  77. nabu/pipeline/helical/filtering.py +12 -9
  78. nabu/pipeline/helical/gridded_accumulator.py +179 -33
  79. nabu/pipeline/helical/helical_chunked_regridded.py +262 -151
  80. nabu/pipeline/helical/helical_chunked_regridded_cuda.py +4 -11
  81. nabu/pipeline/helical/helical_reconstruction.py +56 -18
  82. nabu/pipeline/helical/span_strategy.py +1 -1
  83. nabu/pipeline/helical/tests/test_accumulator.py +4 -0
  84. nabu/pipeline/params.py +23 -2
  85. nabu/pipeline/processconfig.py +3 -8
  86. nabu/pipeline/tests/test_chunk_reader.py +78 -0
  87. nabu/pipeline/tests/test_estimators.py +120 -2
  88. nabu/pipeline/utils.py +25 -0
  89. nabu/pipeline/writer.py +2 -0
  90. nabu/preproc/ccd_cuda.py +9 -7
  91. nabu/preproc/ctf.py +21 -26
  92. nabu/preproc/ctf_cuda.py +25 -25
  93. nabu/preproc/double_flatfield.py +14 -2
  94. nabu/preproc/double_flatfield_cuda.py +7 -11
  95. nabu/preproc/flatfield_cuda.py +23 -27
  96. nabu/preproc/phase.py +19 -24
  97. nabu/preproc/phase_cuda.py +21 -21
  98. nabu/preproc/shift_cuda.py +58 -28
  99. nabu/preproc/tests/test_ctf.py +5 -5
  100. nabu/preproc/tests/test_double_flatfield.py +2 -2
  101. nabu/preproc/tests/test_vshift.py +13 -2
  102. nabu/processing/__init__.py +0 -0
  103. nabu/processing/convolution_cuda.py +375 -0
  104. nabu/processing/fft_base.py +163 -0
  105. nabu/processing/fft_cuda.py +256 -0
  106. nabu/processing/fft_opencl.py +54 -0
  107. nabu/processing/fftshift.py +134 -0
  108. nabu/processing/histogram.py +286 -0
  109. nabu/processing/histogram_cuda.py +103 -0
  110. nabu/processing/kernel_base.py +126 -0
  111. nabu/processing/medfilt_cuda.py +159 -0
  112. nabu/processing/muladd.py +29 -0
  113. nabu/processing/muladd_cuda.py +68 -0
  114. nabu/processing/padding_base.py +71 -0
  115. nabu/processing/padding_cuda.py +75 -0
  116. nabu/processing/padding_opencl.py +77 -0
  117. nabu/processing/processing_base.py +123 -0
  118. nabu/processing/roll_opencl.py +64 -0
  119. nabu/processing/rotation.py +63 -0
  120. nabu/processing/rotation_cuda.py +66 -0
  121. nabu/processing/tests/__init__.py +0 -0
  122. nabu/processing/tests/test_fft.py +268 -0
  123. nabu/processing/tests/test_fftshift.py +71 -0
  124. nabu/{misc → processing}/tests/test_histogram.py +2 -4
  125. nabu/{cuda → processing}/tests/test_medfilt.py +1 -1
  126. nabu/processing/tests/test_muladd.py +54 -0
  127. nabu/{cuda → processing}/tests/test_padding.py +119 -75
  128. nabu/processing/tests/test_roll.py +63 -0
  129. nabu/{misc → processing}/tests/test_rotation.py +3 -2
  130. nabu/processing/tests/test_transpose.py +72 -0
  131. nabu/{misc → processing}/tests/test_unsharp.py +41 -8
  132. nabu/processing/transpose.py +126 -0
  133. nabu/processing/unsharp.py +79 -0
  134. nabu/processing/unsharp_cuda.py +53 -0
  135. nabu/processing/unsharp_opencl.py +75 -0
  136. nabu/reconstruction/fbp.py +34 -10
  137. nabu/reconstruction/fbp_base.py +35 -16
  138. nabu/reconstruction/fbp_opencl.py +7 -12
  139. nabu/reconstruction/filtering.py +2 -2
  140. nabu/reconstruction/filtering_cuda.py +13 -14
  141. nabu/reconstruction/filtering_opencl.py +3 -4
  142. nabu/reconstruction/projection.py +2 -0
  143. nabu/reconstruction/rings.py +158 -1
  144. nabu/reconstruction/rings_cuda.py +218 -58
  145. nabu/reconstruction/sinogram_cuda.py +16 -12
  146. nabu/reconstruction/tests/test_deringer.py +116 -14
  147. nabu/reconstruction/tests/test_fbp.py +22 -31
  148. nabu/reconstruction/tests/test_filtering.py +11 -2
  149. nabu/resources/dataset_analyzer.py +89 -26
  150. nabu/resources/nxflatfield.py +2 -2
  151. nabu/resources/tests/test_nxflatfield.py +1 -1
  152. nabu/resources/utils.py +9 -2
  153. nabu/stitching/alignment.py +184 -0
  154. nabu/stitching/config.py +241 -39
  155. nabu/stitching/definitions.py +6 -0
  156. nabu/stitching/frame_composition.py +4 -2
  157. nabu/stitching/overlap.py +99 -3
  158. nabu/stitching/sample_normalization.py +60 -0
  159. nabu/stitching/slurm_utils.py +10 -10
  160. nabu/stitching/tests/test_alignment.py +99 -0
  161. nabu/stitching/tests/test_config.py +16 -1
  162. nabu/stitching/tests/test_overlap.py +68 -2
  163. nabu/stitching/tests/test_sample_normalization.py +49 -0
  164. nabu/stitching/tests/test_slurm_utils.py +5 -5
  165. nabu/stitching/tests/test_utils.py +3 -33
  166. nabu/stitching/tests/test_z_stitching.py +391 -22
  167. nabu/stitching/utils.py +144 -202
  168. nabu/stitching/z_stitching.py +309 -126
  169. nabu/testutils.py +18 -0
  170. nabu/thirdparty/tomocupy_remove_stripe.py +586 -0
  171. nabu/utils.py +32 -6
  172. {nabu-2023.2.1.dist-info → nabu-2024.1.0rc3.dist-info}/LICENSE +1 -1
  173. {nabu-2023.2.1.dist-info → nabu-2024.1.0rc3.dist-info}/METADATA +5 -5
  174. nabu-2024.1.0rc3.dist-info/RECORD +296 -0
  175. {nabu-2023.2.1.dist-info → nabu-2024.1.0rc3.dist-info}/WHEEL +1 -1
  176. {nabu-2023.2.1.dist-info → nabu-2024.1.0rc3.dist-info}/entry_points.txt +5 -1
  177. nabu/conftest.py +0 -14
  178. nabu/opencl/fftshift.py +0 -92
  179. nabu/opencl/tests/test_fftshift.py +0 -55
  180. nabu/opencl/tests/test_padding.py +0 -84
  181. nabu-2023.2.1.dist-info/RECORD +0 -252
  182. /nabu/cuda/src/{fftshift.cu → dfi_fftshift.cu} +0 -0
  183. {nabu-2023.2.1.dist-info → nabu-2024.1.0rc3.dist-info}/top_level.txt +0 -0
@@ -1,17 +1,16 @@
1
1
  import h5py
2
2
  import numpy as np
3
3
  from scipy.special import erf # pylint: disable=all
4
- from scipy.special import erf
5
4
  import sys
6
5
  import os
7
6
  from scipy.ndimage import gaussian_filter
8
- from tomoscan.esrf.scan.hdf5scan import ImageKey, HDF5TomoScan
7
+ from nxtomo.nxobject.nxdetector import ImageKey
9
8
  from nabu.resources.nxflatfield import update_dataset_info_flats_darks
10
9
  from nabu.resources.dataset_analyzer import HDF5DatasetAnalyzer
11
10
  from ..io.reader import load_images_from_dataurl_dict
12
11
 
13
12
 
14
- def main():
13
+ def main(argv=None):
15
14
  """auxiliary program that can be called to create default input detector profiles, for nabu helical,
16
15
  concerning the weights of the pixels and the "double flat" renormalisation denominator.
17
16
  The result is an hdf5 file that can be used as a "processes_file" in the nabu configuration and is used by nabu-helical.
@@ -31,50 +30,81 @@ def main():
31
30
  Then the resulting file can be used as processes file in the configuration file of nabu-helical
32
31
 
33
32
  """
34
- if len(sys.argv) not in [3, 4, 5]:
33
+ if argv is None:
34
+ argv = sys.argv[1:]
35
+ if len(argv) not in [2, 3, 4, 5, 6]:
35
36
  message = f""" Usage:
36
- {os.path.basename(sys.argv[0])} nexus_file_name entry_name [target_file name [transition_width]]
37
+ nabu-helical-prepare-weights-double nexus_file_name entry_name [target_file name [transition_width_vertical [rotation_axis_position [transition_width_vertical]]]]
37
38
  """
38
39
  print(message)
39
40
  sys.exit(1)
40
41
 
41
- file_name = sys.argv[1]
42
+ file_name = argv[0]
42
43
  if len(os.path.dirname(file_name)) == 0:
43
44
  # To make sure that other utility routines can succesfully deal with path within the current directory
44
45
  file_name = os.path.join(".", file_name)
45
46
 
46
- entry_name = sys.argv[2]
47
- process_file_name = "double.h5"
48
- transition_width = 50.0
47
+ # still tere was some problem with relative path and how they are dealt with in nxtomomill
48
+ # Better to use absolute path
49
+ file_name = os.path.abspath(file_name)
49
50
 
50
- if len(sys.argv) in [4, 5]:
51
- process_file_name = sys.argv[3]
52
- if len(sys.argv) in [5]:
53
- transition_width = float(sys.argv[4])
51
+ entry_name = argv[1]
52
+ process_file_name = "double.h5"
54
53
 
55
54
  dataset_info = HDF5DatasetAnalyzer(file_name, extra_options={"h5_entry": entry_name})
56
55
  update_dataset_info_flats_darks(dataset_info, flatfield_mode=1)
57
56
 
58
- mappe = 0
57
+ beam_profile = 0
59
58
  my_flats = load_images_from_dataurl_dict(dataset_info.flats)
60
59
 
61
60
  for key, flat in my_flats.items():
62
- mappe += flat
63
- mappe = mappe / len(list(dataset_info.flats.keys()))
64
-
65
- create_heli_maps(mappe, process_file_name, entry_name, transition_width)
61
+ beam_profile += flat
62
+ beam_profile = beam_profile / len(list(dataset_info.flats.keys()))
63
+
64
+ transition_width_vertical = 50.0
65
+
66
+ # the following two line determines the horisontal transition
67
+ # by default a transition on the right ( corresponds to an axis close to the right border)
68
+
69
+ rotation_axis_position = beam_profile.shape[1] - 200
70
+ transition_width_horizontal = 100.0
71
+
72
+ if len(argv) in [3, 4, 5, 6]:
73
+ process_file_name = argv[2]
74
+ if len(argv) in [4, 5, 6]:
75
+ transition_width_vertical = float(argv[3])
76
+ if len(argv) in [5, 6]:
77
+ rotation_axis_position = (beam_profile.shape[1] - 1) / 2 + float(argv[4])
78
+ if len(argv) in [6]:
79
+ transition_width_horizontal = 2 * (float(argv[5]))
80
+
81
+ create_heli_maps(
82
+ beam_profile,
83
+ process_file_name,
84
+ entry_name,
85
+ transition_width_vertical,
86
+ rotation_axis_position,
87
+ transition_width_horizontal,
88
+ )
66
89
 
67
90
  # here we have been called by the cli. The return value 0 means OK
68
91
  return 0
69
92
 
70
93
 
71
- def create_heli_maps(profile, process_file_name, entry_name, transition_width):
94
+ def create_heli_maps(
95
+ profile,
96
+ process_file_name,
97
+ entry_name,
98
+ transition_width_vertical,
99
+ rotation_axis_position,
100
+ transition_width_horizontal,
101
+ ):
72
102
  profile = profile / profile.max()
73
103
  profile = profile.astype("f")
74
104
 
75
105
  profile = gaussian_filter(profile, 10)
76
106
 
77
- def compute_border(L, m, w):
107
+ def compute_border_v(L, m, w):
78
108
  x = np.arange(L)
79
109
 
80
110
  d = (x - L + m).astype("f")
@@ -85,6 +115,35 @@ def create_heli_maps(profile, process_file_name, entry_name, transition_width):
85
115
 
86
116
  return res_r * res_l
87
117
 
118
+ def compute_border_h(L, r, tw):
119
+ if r > (L - 1) / 2:
120
+ if tw > (L - r):
121
+ tw = max(1.0, L - r)
122
+
123
+ m = tw / 2
124
+ w = tw / 5
125
+
126
+ x = np.arange(L)
127
+
128
+ d = (x - L + m).astype("f")
129
+ res_r = (1 - erf(d / w)) / 2
130
+
131
+ return res_r
132
+
133
+ else:
134
+ if tw > r:
135
+ tw = max(1.0, r)
136
+
137
+ m = tw / 2
138
+ w = tw / 5
139
+
140
+ x = np.arange(L)
141
+
142
+ d = (x - m).astype("f")
143
+ res_l = (1 + erf(d / w)) / 2
144
+
145
+ return res_l
146
+
88
147
  with h5py.File(process_file_name, mode="a") as fd:
89
148
  path_weights = entry_name + "/weights_field/results/data"
90
149
  path_double = entry_name + "/double_flatfield/results/data"
@@ -94,9 +153,11 @@ def create_heli_maps(profile, process_file_name, entry_name, transition_width):
94
153
  if path_double in fd:
95
154
  del fd[path_double]
96
155
 
97
- border = compute_border(profile.shape[1], 20, 13.33)
156
+ border = compute_border_h(profile.shape[1], rotation_axis_position, transition_width_horizontal)
98
157
 
99
- border_v = compute_border(profile.shape[0], round(transition_width / 2), transition_width / 4)
158
+ border_v = compute_border_v(
159
+ profile.shape[0], round(transition_width_vertical / 2), transition_width_vertical / 5
160
+ )
100
161
 
101
162
  fd[path_weights] = (profile * border) * border_v[:, None]
102
163
  fd[path_double] = np.ones_like(profile)
nabu/app/reconstruct.py CHANGED
@@ -57,7 +57,7 @@ def get_log_file(arg_logfile, legacy_arg_logfile, forbidden=None):
57
57
  return logfile
58
58
 
59
59
 
60
- def get_reconstructor(args):
60
+ def get_reconstructor(args, overwrite_options=None):
61
61
  # Imports are done here, otherwise "nabu --version" takes forever
62
62
  from ..pipeline.fullfield.processconfig import ProcessConfig
63
63
  from ..pipeline.fullfield.reconstruction import FullFieldReconstructor
@@ -78,6 +78,10 @@ def get_reconstructor(args):
78
78
  logfile = get_log_file(args["logfile"], args["log_file"], forbidden=[args["input_file"]])
79
79
  conf_dict = parse_nabu_config_file(args["input_file"])
80
80
  update_reconstruction_start_end(conf_dict, args["slice"].strip())
81
+ if overwrite_options is not None:
82
+ for option_key, option_val in overwrite_options.items():
83
+ opt_section, opt_name = option_key.split("/")
84
+ conf_dict[opt_section][opt_name] = option_val
81
85
 
82
86
  proc = ProcessConfig(conf_dict=conf_dict, create_logger=logfile)
83
87
  logger = proc.logger
@@ -13,6 +13,12 @@ def main_helical():
13
13
  "default": 0,
14
14
  "type": int,
15
15
  }
16
+ ReconstructConfig["diag_zpro_run"] = {
17
+ "help": "run the pipeline without reconstructing but collecting the contributing radios slices for angles theta+n*360. The given argument is the number of thet in the interval [0 ,180[. The same number is taken if available in [180,360[. And the whole is repated is available in [0,360[ for a total of 4*diag_zpro_run possible exctracted contributions",
18
+ "default": 0,
19
+ "type": int,
20
+ }
21
+
16
22
  args = parse_params_values(
17
23
  ReconstructConfig,
18
24
  parser_description=f"Perform a helical tomographic reconstruction",
@@ -89,6 +95,7 @@ def main_helical():
89
95
  "max_chunk_size": args["max_chunk_size"] if args["max_chunk_size"] > 0 else None,
90
96
  "phase_margin": args["phase_margin"],
91
97
  "dry_run": args["dry_run"],
98
+ "diag_zpro_run": args["diag_zpro_run"],
92
99
  }
93
100
  )
94
101
 
@@ -7,10 +7,10 @@ from nabu.app.cli_configs import ReduceDarkFlatConfig
7
7
  from .utils import parse_params_values
8
8
  from .. import version
9
9
 
10
- from tomoscan.framereducerbase import ReduceMethod
10
+ from tomoscan.framereducer.method import ReduceMethod
11
11
  from tomoscan.scanbase import TomoScanBase
12
12
  from tomoscan.esrf.scan.edfscan import EDFTomoScan
13
- from tomoscan.scanfactory import ScanFactory
13
+ from tomoscan.factory import Factory
14
14
  from silx.io.url import DataUrl
15
15
 
16
16
 
@@ -153,6 +153,9 @@ def reduce_dark_flat(
153
153
 
154
154
 
155
155
  def main(argv=None):
156
+ """
157
+ Compute reduce dark(s) and flat(s) of a dataset
158
+ """
156
159
  if argv is None:
157
160
  argv = sys.argv[1:]
158
161
 
@@ -163,7 +166,7 @@ def main(argv=None):
163
166
  user_args=argv,
164
167
  )
165
168
 
166
- scan = ScanFactory.create_scan_object(args["dataset"], entry=args["entry"])
169
+ scan = Factory.create_scan_object(args["dataset"], entry=args["entry"])
167
170
  exit(
168
171
  reduce_dark_flat(
169
172
  scan=scan,
nabu/app/rotate.py CHANGED
@@ -6,12 +6,12 @@ from multiprocessing import cpu_count
6
6
  from multiprocessing.pool import ThreadPool
7
7
  import numpy as np
8
8
  from tomoscan.io import HDF5File
9
- from tomoscan.esrf.scan.hdf5scan import HDF5TomoScan
9
+ from tomoscan.esrf.scan.nxtomoscan import NXtomoScan
10
10
  from ..io.utils import get_first_hdf5_entry
11
- from ..misc.rotation import Rotation
11
+ from ..processing.rotation import Rotation
12
12
  from ..resources.logger import Logger, LoggerOrPrint
13
13
  from ..pipeline.config_validators import optional_tuple_of_floats_validator, boolean_validator
14
- from ..misc.rotation_cuda import CudaRotation, __has_pycuda__
14
+ from ..processing.rotation_cuda import CudaRotation, __has_pycuda__
15
15
  from .utils import parse_params_values
16
16
  from .cli_configs import RotateRadiosConfig
17
17
 
@@ -42,7 +42,7 @@ class HDF5ImagesStackRotation:
42
42
  if entry is None or entry == "":
43
43
  entry = get_first_hdf5_entry(input_file)
44
44
  self.entry = entry
45
- self.dataset_info = HDF5TomoScan(input_file, entry=entry)
45
+ self.dataset_info = NXtomoScan(input_file, entry=entry)
46
46
 
47
47
  def _get_rotation(self, angle, center):
48
48
  if self.use_cuda:
nabu/app/stitching.py CHANGED
@@ -31,7 +31,21 @@ def main():
31
31
 
32
32
  stitching_config = dict_to_config_obj(conf_dict)
33
33
  stitching_config.settle_inputs()
34
- if stitching_config.slurm_config.partition in (None, ""):
34
+ if args["only_create_master_file"]:
35
+ # option to ease creation of the master in the following cases:
36
+ # * user has submitted all the job but has been quicked out of the cluster
37
+ # * only a few slurm job for some random version (cluster update...) and user want to retriger only those job and process the aggragation only. On those cases no need to redo it all.
38
+ tomo_objs = []
39
+ for _, sub_config in split_stitching_configuration_to_slurm_job(stitching_config, yield_configuration=True):
40
+ tomo_objs.append(sub_config.get_output_object().get_identifier().to_str())
41
+
42
+ post_processing = StitchingPostProcAggregation(
43
+ existing_objs_ids=tomo_objs,
44
+ stitching_config=stitching_config,
45
+ )
46
+ post_processing.process()
47
+
48
+ elif stitching_config.slurm_config.partition in (None, ""):
35
49
  # case 1: run locally
36
50
  _logger.info(f"run stitching locally with {stitching_config}")
37
51
 
@@ -60,7 +74,7 @@ def main():
60
74
  # 2.2 wait for future to be done and concatenate the result
61
75
  post_processing = StitchingPostProcAggregation(
62
76
  futures=futures,
63
- stitching_config=stitching_config.to_dict(),
77
+ stitching_config=stitching_config,
64
78
  )
65
79
  post_processing.process()
66
80
 
@@ -1,8 +1,24 @@
1
1
  import os
2
2
  import pytest
3
- from tomoscan.scanbase import ComputeMethod
4
3
  from nabu.app.reduce_dark_flat import reduce_dark_flat
5
- from nabu.conftest import hdf5_scan # noqa F401
4
+
5
+ #####
6
+ from tomoscan.test.utils import NXtomoMockContext
7
+
8
+
9
+ @pytest.fixture(scope="function")
10
+ def hdf5_scan(tmp_path):
11
+ """simple fixture to create a scan and provide it to another function"""
12
+ test_dir = tmp_path / "my_hdf5_scan"
13
+ with NXtomoMockContext(
14
+ scan_path=str(test_dir),
15
+ n_proj=10,
16
+ n_ini_proj=10,
17
+ ) as scan:
18
+ yield scan
19
+
20
+
21
+ ######
6
22
 
7
23
 
8
24
  @pytest.mark.parametrize("dark_method", (None, "first", "mean"))
nabu/app/validator.py CHANGED
@@ -6,7 +6,7 @@ import sys
6
6
  import os
7
7
  import h5py
8
8
  import tomoscan.validator
9
- from tomoscan.esrf.scan.hdf5scan import HDF5TomoScan
9
+ from tomoscan.esrf.scan.nxtomoscan import NXtomoScan
10
10
  from tomoscan.esrf.scan.edfscan import EDFTomoScan
11
11
 
12
12
 
@@ -15,11 +15,11 @@ def get_scans(path, entries: str):
15
15
  res = []
16
16
  if EDFTomoScan.is_tomoscan_dir(path):
17
17
  res.append(EDFTomoScan(scan=path))
18
- elif HDF5TomoScan.is_tomoscan_dir(path):
18
+ elif NXtomoScan.is_tomoscan_dir(path):
19
19
  if entries == "__all__":
20
- entries = HDF5TomoScan.get_valid_entries(path)
20
+ entries = NXtomoScan.get_valid_entries(path)
21
21
  for entry in entries:
22
- res.append(HDF5TomoScan(path, entry))
22
+ res.append(NXtomoScan(path, entry))
23
23
  else:
24
24
  raise TypeError(f"{path} does not looks like a folder containing .EDF or a valid nexus file ")
25
25
  return res