nabu 2024.1.3__py3-none-any.whl → 2024.1.5__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.
nabu/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "2024.1.3"
1
+ __version__ = "2024.1.5"
2
2
  __nabu_modules__ = [
3
3
  "app",
4
4
  "cuda",
@@ -157,8 +157,9 @@ class DatasetValidatorBase:
157
157
  """
158
158
  dataset_cfg = self.nabu_config["dataset"]
159
159
  self.binning = (dataset_cfg["binning"], dataset_cfg["binning_z"])
160
- subsampling_factor, subsampling_begin = dataset_cfg["projections_subsampling"]
160
+ subsampling_factor, subsampling_start = dataset_cfg["projections_subsampling"]
161
161
  self.subsampling_factor = subsampling_factor or 1
162
+ self.subsampling_start = subsampling_start or 0
162
163
 
163
164
  if self.binning != (1, 1):
164
165
  bin_x, bin_z = self.binning
@@ -83,6 +83,10 @@ class ProcessConfig(ProcessConfigBase):
83
83
  )
84
84
  self.rec_params = self.nabu_config["reconstruction"]
85
85
 
86
+ subsampling_factor, subsampling_start = self.nabu_config["dataset"]["projections_subsampling"]
87
+ self.subsampling_factor = subsampling_factor or 1
88
+ self.subsampling_start = subsampling_start or 0
89
+
86
90
  self._update_dataset_with_user_overwrites()
87
91
  self._get_rotation_axis_position()
88
92
  self._update_rotation_angles()
@@ -118,8 +122,9 @@ class ProcessConfig(ProcessConfigBase):
118
122
  if transl_file is not None and "://" not in transl_file:
119
123
  try:
120
124
  translations = get_values_from_file(
121
- transl_file, shape=(self.dataset_info.n_angles, last_dim), any_size=True
125
+ transl_file, shape=(self.n_angles(subsampling=False), last_dim), any_size=True
122
126
  ).astype(np.float32)
127
+ translations = translations[self.subsampling_start :: self.subsampling_factor]
123
128
  except ValueError:
124
129
  print("Something wrong with translation_movements_file %s" % transl_file)
125
130
  raise
@@ -145,9 +150,10 @@ class ProcessConfig(ProcessConfigBase):
145
150
  try:
146
151
  axis_correction = get_values_from_file(
147
152
  axis_correction_file,
148
- n_values=self.dataset_info.n_angles,
153
+ n_values=self.n_angles(subsampling=False),
149
154
  any_size=True,
150
155
  ).astype(np.float32)
156
+ axis_correction = axis_correction[self.subsampling_start :: self.subsampling_factor]
151
157
  except ValueError:
152
158
  print("Something wrong with axis correction file %s" % axis_correction_file)
153
159
  raise
@@ -225,7 +231,7 @@ class ProcessConfig(ProcessConfigBase):
225
231
  self.logger.debug("Doing coupled validation")
226
232
  self._dataset_validator = FullFieldDatasetValidator(self.nabu_config, self.dataset_info)
227
233
  # Not so ideal to propagate fields like this
228
- for what in ["rec_params", "rec_region", "binning", "subsampling_factor"]:
234
+ for what in ["rec_params", "rec_region", "binning"]:
229
235
  setattr(self, what, getattr(self._dataset_validator, what))
230
236
 
231
237
  #
@@ -255,7 +261,7 @@ class ProcessConfig(ProcessConfigBase):
255
261
  def n_angles(self, subsampling=False):
256
262
  rot_angles = self.dataset_info.rotation_angles
257
263
  if subsampling:
258
- rot_angles = rot_angles[:: (self.subsampling or 1)]
264
+ rot_angles = rot_angles[self.subsampling_start :: self.subsampling_factor]
259
265
  return len(rot_angles)
260
266
 
261
267
  def radios_shape(self, binning=False, subsampling=False):
@@ -300,10 +306,12 @@ class ProcessConfig(ProcessConfigBase):
300
306
  return sorted(self.dataset_info.projections.keys())[::step]
301
307
 
302
308
  def rotation_angles(self, subsampling=False):
309
+ start = 0
303
310
  step = 1
304
311
  if subsampling:
305
- step = self.subsampling or 1
306
- return self.dataset_info.rotation_angles[::step]
312
+ start = self.subsampling_start
313
+ step = self.subsampling_factor
314
+ return self.dataset_info.rotation_angles[start::step]
307
315
 
308
316
  @property
309
317
  def rec_roi(self):
@@ -512,7 +520,7 @@ class ProcessConfig(ProcessConfigBase):
512
520
  translations = dataset_info.translations
513
521
  if translations is not None:
514
522
  tasks.append("radios_movements")
515
- options["radios_movements"] = {"translation_movements": dataset_info.translations[:: self.binning_z]}
523
+ options["radios_movements"] = {"translation_movements": dataset_info.translations}
516
524
  #
517
525
  # Sinogram normalization (before half-tomo)
518
526
  #
@@ -562,7 +570,8 @@ class ProcessConfig(ProcessConfigBase):
562
570
  rec_options["enable_halftomo"] = self.do_halftomo
563
571
  rec_options["axis_correction"] = dataset_info.axis_correction
564
572
  if dataset_info.axis_correction is not None:
565
- rec_options["axis_correction"] = rec_options["axis_correction"][:: self.subsampling_factor]
573
+ rec_options["axis_correction"] = rec_options["axis_correction"]
574
+
566
575
  rec_options["angles"] = np.array(self.rotation_angles(subsampling=True))
567
576
  rec_options["angles"] += np.deg2rad(nabu_config["reconstruction"]["angle_offset"])
568
577
  voxel_size = dataset_info.pixel_size * 1e-4
@@ -55,10 +55,6 @@ class TestChunkReader:
55
55
  first_sino_odd = reader.data[:, 0, :].copy()
56
56
  compacted_dataslices_odd = get_compacted_dataslices_as_sorted_tuples(reader)
57
57
 
58
- # from spire.utils import ims
59
- # ims([first_sino_all[::2], first_sino_even, first_sino_all[::2]*1. - first_sino_even])
60
- # ims([first_sino_all[::2], first_sino_even, first_sino_all[1::2]*1. - first_sino_odd])
61
-
62
58
  # Check that the compacted data slices are correct
63
59
  assert len(compacted_dataslices_all) == len(compacted_dataslices_even) == len(compacted_dataslices_odd)
64
60
  for data_slice_all, data_slice_even, data_slice_odd in zip(
nabu/pipeline/writer.py CHANGED
@@ -136,8 +136,9 @@ class WriterManager:
136
136
  ),
137
137
  "overwrite": self.overwrite,
138
138
  "append": self.extra_options.get("single_output_file_initialized", False),
139
- "hst_metadata": self.extra_options.get("raw_vol_metadata", {}),
140
139
  }
140
+ if self.file_format == "vol":
141
+ writer_kwargs["hst_metadata"] = self.extra_options.get("raw_vol_metadata", {})
141
142
  else:
142
143
  raise ValueError("Unsupported file format: %s" % self.file_format)
143
144
  self._h5_entry = self.metadata.get("entry", "entry")
nabu/utils.py CHANGED
@@ -422,19 +422,6 @@ def copy_dict_items(dict_, keys):
422
422
  return res
423
423
 
424
424
 
425
- def remove_first_dict_items(dict_, n_items, sort_func=None, inplace=True):
426
- """
427
- Remove the first items of a dictionary. The keys have to be sortable
428
- """
429
- sorted_keys = sorted(dict_.keys(), key=sort_func)
430
- if inplace:
431
- for key in sorted_keys[:n_items]:
432
- dict_.pop(key)
433
- return dict_
434
- else:
435
- return copy_dict_items(dict_, sorted_keys[n_items:])
436
-
437
-
438
425
  def recursive_copy_dict(dict_):
439
426
  """
440
427
  Perform a shallow copy of a dictionary of dictionaries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nabu
3
- Version: 2024.1.3
3
+ Version: 2024.1.5
4
4
  Summary: Nabu - Tomography software
5
5
  Author-email: Pierre Paleo <pierre.paleo@esrf.fr>, Henri Payno <henri.payno@esrf.fr>, Alessandro Mirone <mirone@esrf.fr>, Jérôme Lesaint <jerome.lesaint@esrf.fr>
6
6
  Maintainer-email: Pierre Paleo <pierre.paleo@esrf.fr>
@@ -2,10 +2,10 @@ doc/conf.py,sha256=3xtCarCHrXPr50GbeRDuH-o3Jzojw7mpr7vpGfZPLAE,3787
2
2
  doc/create_conf_doc.py,sha256=IVOdP70KvbW9WS_UQu3Iyd0YfS60E2fJ5IDtQ_s4cDw,1143
3
3
  doc/doc_config.py,sha256=anqeOVjqE2e7eVzg7yuh9dvIneTkrA5doGl1cVBqT7Q,730
4
4
  doc/get_mathjax.py,sha256=VIvKRCdDuF2VoY8JD3mSey9XX13AZMmwTJBHdt1tUs4,1012
5
- nabu/__init__.py,sha256=0gCFkw19XEtpFmj4__mgFLwZHUBVLIJtgG-XzgYhmMQ,270
5
+ nabu/__init__.py,sha256=ErLZd1sdO03iHW__3mBKndACl9sfSWOQdVChBK2wp70,270
6
6
  nabu/tests.py,sha256=cew9OY2uTyncHI_HM32W8CP6B1GTGKaOW65XtMEqs7o,1417
7
7
  nabu/testutils.py,sha256=qqtGgkIhpOpXhgeoXlqCb91Rx-JlI4ALaDF6nt8YRRk,13298
8
- nabu/utils.py,sha256=1OKKhQ6-t7OOwTLQkTJuK5Hk9lb7hkEZrDtTdcmvD4c,24164
8
+ nabu/utils.py,sha256=w-xfRb6TFQpS-tao6nlvfmr962pmeec-WH1GltSUCrk,23767
9
9
  nabu/app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  nabu/app/bootstrap.py,sha256=UQZzCBKtSXtQp5U0aXtlUhbjbwzgILTI4zD4zVffhBI,3246
11
11
  nabu/app/bootstrap_stitching.py,sha256=Inr0_zRAtyeMTK1BKxGqoDf-Na0O33CICmQJYja06ug,2148
@@ -127,21 +127,21 @@ nabu/pipeline/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
127
127
  nabu/pipeline/config.py,sha256=amc05PX0kZA5wHjD1oFP59MfW4pBA-gjBypy4tKLnv0,9221
128
128
  nabu/pipeline/config_validators.py,sha256=rvK1Q_KmA1LUeNTefNxXCpYfDQ1zAdk1kFePrLintwc,16300
129
129
  nabu/pipeline/datadump.py,sha256=Ua4tbzxfGMOiT2-7WZn3IDiJqzzK-TyFuku_XUkH8_Q,6520
130
- nabu/pipeline/dataset_validator.py,sha256=b6RYIoaElX8QkqYPFl7KsMU7wai7jJjG6QtTQBvPd_o,9207
130
+ nabu/pipeline/dataset_validator.py,sha256=etQw9NC_YGsdWCgjsn8aJ3WfvcRuJlLVZlWoqhvvo-8,9263
131
131
  nabu/pipeline/detector_distortion_provider.py,sha256=ru1AxbcuO-FA8FYooPBWgp1lzdSDUtzFUC1A_sS8jME,920
132
132
  nabu/pipeline/estimators.py,sha256=4V5pwl5vUFMJDanWnmw7POnSsa9lKyKtUzvq9GLcJwc,41374
133
133
  nabu/pipeline/fallback_utils.py,sha256=7ccrKYE-rp3fydb72VA6W0_eKcEoqYBEAPlmij_lyEc,6086
134
134
  nabu/pipeline/params.py,sha256=VdrekcxOnbrMzvvLcwEWINiMM0uVKmPxJJBwp3lhHBg,3479
135
135
  nabu/pipeline/processconfig.py,sha256=3wCobeC_gI9OTO7v0Hk-IeEJUdKoavK-OzKLd1da5Dg,8216
136
136
  nabu/pipeline/utils.py,sha256=NONAgBfTfUYvBNfoTqD33MAYaPZyCJL10SnR6B0lLec,3462
137
- nabu/pipeline/writer.py,sha256=mUpD0kNHrPQhnHwybMMxA7pjaKi53aP8QLBJsqEcQ-4,7501
137
+ nabu/pipeline/writer.py,sha256=0ts40VNN3RiRURvZ2gNqsigsAJuwcjnYF4RJ15qaMpI,7558
138
138
  nabu/pipeline/fullfield/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
139
139
  nabu/pipeline/fullfield/chunked.py,sha256=qGE9gpww2zPbtPeM1Fe0RPRhl3onqxs8fr3HRug-x6I,36919
140
140
  nabu/pipeline/fullfield/chunked_cuda.py,sha256=aGzjY8MX6OL8auEj6Y0RfOGCmFnczsdfj6-8Net5AbQ,5645
141
141
  nabu/pipeline/fullfield/computations.py,sha256=VpIURVXh8EpNSfait_AIFM4Ci-GK_546Wkb-Wn9r31Y,9935
142
142
  nabu/pipeline/fullfield/dataset_validator.py,sha256=sRgUECUc8aOjFbwrW-dHjvIf7K3T40YPSIgt3cInKAc,3055
143
143
  nabu/pipeline/fullfield/nabu_config.py,sha256=a0mMoLkvlvHgX6RmUS1m1UhJS-XB3O6wBCnkNoI90Cs,30358
144
- nabu/pipeline/fullfield/processconfig.py,sha256=SzA9FA7aK5V13q8f8fFmKvumvK0ATkl5Bi_lAs2r8m8,35658
144
+ nabu/pipeline/fullfield/processconfig.py,sha256=ad2lmo-cCkzfDJqMd__FhbfIInndTxQsLdgH9Ec9Tzc,36107
145
145
  nabu/pipeline/fullfield/reconstruction.py,sha256=Km_ZDtoiDQdX3TdTh6E9bzS5hoMC0jYU5eZWodaLbIg,36627
146
146
  nabu/pipeline/helical/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
147
147
  nabu/pipeline/helical/dataset_validator.py,sha256=0YQc0hdYdpaXznFaKmlj9SIu7mNs0xXMejcRkhOZHaI,640
@@ -161,7 +161,7 @@ nabu/pipeline/helical/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
161
161
  nabu/pipeline/helical/tests/test_accumulator.py,sha256=nNHwqUgSyUpdZVYNVyxqekj0SoThCF8s-8o3NfSw6vI,6416
162
162
  nabu/pipeline/helical/tests/test_pipeline_elements_full.py,sha256=zeR9SaeD0mnhtKU7qo4Qrn_lg1I1Vhg4dqzj6jy8tpg,14569
163
163
  nabu/pipeline/helical/tests/test_strategy.py,sha256=rt8SsUHBMMcVFl48kRGcOyf1y4bYqaA2xDznQxE7wFs,2721
164
- nabu/pipeline/tests/test_chunk_reader.py,sha256=Z5N620l4jZmG_15v5GPbqf4LgZeO2hJvcsptq_YpltU,3641
164
+ nabu/pipeline/tests/test_chunk_reader.py,sha256=OB279hSvgmVhWv_OauZNWTJeaaiheETayGYK79Op10Q,3410
165
165
  nabu/pipeline/tests/test_estimators.py,sha256=6VK7fxxfrRTWSSi2bhHqbLy8pZJ2DALO1gJkuxpLDSQ,8392
166
166
  nabu/pipeline/xrdct/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
167
167
  nabu/preproc/__init__.py,sha256=dKxvZvWZXjKS3iPRaSXiUeM2dNGIOyTlirq5pdAWY0Y,284
@@ -288,9 +288,9 @@ nabu/thirdparty/pore3d_deringer_munch.py,sha256=o4bisnFc-wMjuohWBT8wgWmfNehPQGtC
288
288
  nabu/thirdparty/tomocupy_remove_stripe.py,sha256=VgXHr2tzTAAGZix5pwhFfbPxj4tt3yXBcjCPNQSLPAg,22810
289
289
  nabu/thirdparty/tomopy_phase.py,sha256=hK4oPpkogLOhv23XzzEXQY2u3r8fJvASY_bINVs6ERE,8634
290
290
  nabu/thirdparty/tomwer_load_flats_darks.py,sha256=ZNoVAinUb_wGYbfvs_4BVnWsjsQmNxSvCh1bWhR2WWg,5611
291
- nabu-2024.1.3.dist-info/LICENSE,sha256=1eAIPSnEsnSFNUODnLtNtQTs76exG3ZxJ1DJR6zoUBA,1066
292
- nabu-2024.1.3.dist-info/METADATA,sha256=9F-UcdLnNHr8HNiwZOdq_TeA2eowj38U4hVcKCWpcEM,5224
293
- nabu-2024.1.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
294
- nabu-2024.1.3.dist-info/entry_points.txt,sha256=cJKGkBeykVL7uK3E4R0RLRqMXifTL2qdO573syPAvJc,1288
295
- nabu-2024.1.3.dist-info/top_level.txt,sha256=fsm_N3eXLRZk2QXF9OSKPNDPFXOz8FAQjHh5avT3dok,9
296
- nabu-2024.1.3.dist-info/RECORD,,
291
+ nabu-2024.1.5.dist-info/LICENSE,sha256=1eAIPSnEsnSFNUODnLtNtQTs76exG3ZxJ1DJR6zoUBA,1066
292
+ nabu-2024.1.5.dist-info/METADATA,sha256=HAJhXAjP2N1CTDrVr05k1DoPF75hrfRtbTG2c5qccdw,5224
293
+ nabu-2024.1.5.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
294
+ nabu-2024.1.5.dist-info/entry_points.txt,sha256=cJKGkBeykVL7uK3E4R0RLRqMXifTL2qdO573syPAvJc,1288
295
+ nabu-2024.1.5.dist-info/top_level.txt,sha256=fsm_N3eXLRZk2QXF9OSKPNDPFXOz8FAQjHh5avT3dok,9
296
+ nabu-2024.1.5.dist-info/RECORD,,