nabu 2024.2.5__py3-none-any.whl → 2024.2.7__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.2.5"
1
+ __version__ = "2024.2.7"
2
2
  __nabu_modules__ = [
3
3
  "app",
4
4
  "cuda",
@@ -131,8 +131,12 @@ class FullFieldReconstructor:
131
131
  self.resources["gpus"] = avail_gpus
132
132
  if len(avail_gpus) == 0:
133
133
  return
134
- # pick first GPU by default. TODO: handle user's nabu_config["resources"]["gpu_id"]
135
- self.resources["gpu_id"] = self._gpu_id = list(avail_gpus.keys())[0]
134
+ user_gpus = self.process_config.nabu_config.get("resources", {}).get("gpu_id", [])
135
+ if len(user_gpus) == 0:
136
+ user_gpus = [0]
137
+ # For now nabu does not support multi-GPU reconstruction. Take the first one.
138
+ user_gpu_idx = user_gpus[0]
139
+ self.resources["gpu_id"] = self._gpu_id = list(avail_gpus.keys())[user_gpu_idx]
136
140
 
137
141
  def _get_backend(self, backend, cuda_options):
138
142
  self._pipeline_cls = ChunkedPipeline
@@ -145,6 +149,7 @@ class FullFieldReconstructor:
145
149
  backend = "numpy"
146
150
  else:
147
151
  self.gpu_mem = self.resources["gpus"][self._gpu_id]["memory_GB"] * self.gpu_mem_fraction
152
+ self.cuda_options = {"device_id": self._gpu_id}
148
153
  if backend == "cuda":
149
154
  if not (__has_pycuda__):
150
155
  raise RuntimeError("pycuda not avilable")
@@ -2,8 +2,10 @@ import os
2
2
  import numpy as np
3
3
  from silx.io.url import DataUrl
4
4
  from silx.io import get_data
5
+ from tomoscan import __version__ as __tomoscan_version__
5
6
  from tomoscan.esrf.scan.edfscan import EDFTomoScan
6
7
  from tomoscan.esrf.scan.nxtomoscan import NXtomoScan
8
+ from packaging.version import parse as parse_version
7
9
 
8
10
  from ..utils import check_supported, indices_to_slices
9
11
  from ..io.reader import EDFStackReader, NXDarksFlats, NXTomoReader
@@ -143,7 +145,10 @@ class DatasetAnalyzer:
143
145
  Return the sample-detector distance in meters.
144
146
  """
145
147
  if self._distance is None:
146
- self._distance = abs(self.dataset_scanner.distance)
148
+ if parse_version(__tomoscan_version__) < parse_version("2.2"):
149
+ self._distance = abs(self.dataset_scanner.distance)
150
+ else:
151
+ self._distance = abs(self.dataset_scanner.sample_detector_distance)
147
152
  return self._distance
148
153
 
149
154
  @distance.setter
@@ -1,4 +1,4 @@
1
- from distutils.version import StrictVersion
1
+ from packaging.version import parse as parse_version
2
2
  from typing import Optional, Union
3
3
  import logging
4
4
  import functools
@@ -523,7 +523,7 @@ def find_shift_with_itk(img1: numpy.ndarray, img2: numpy.ndarray) -> tuple:
523
523
  _logger.warning("itk is not installed. Please install it to find shift with it")
524
524
  return (0, 0)
525
525
 
526
- if StrictVersion(itk.Version.GetITKVersion()) < StrictVersion("4.9.0"):
526
+ if parse_version(itk.Version.GetITKVersion()) < parse_version("4.9.0"):
527
527
  _logger.error("ITK 4.9.0 is required to find shift with it.")
528
528
  return (0, 0)
529
529
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nabu
3
- Version: 2024.2.5
3
+ Version: 2024.2.7
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>
@@ -1,7 +1,7 @@
1
1
  doc/conf.py,sha256=3xtCarCHrXPr50GbeRDuH-o3Jzojw7mpr7vpGfZPLAE,3787
2
2
  doc/create_conf_doc.py,sha256=IVOdP70KvbW9WS_UQu3Iyd0YfS60E2fJ5IDtQ_s4cDw,1143
3
3
  doc/get_mathjax.py,sha256=VIvKRCdDuF2VoY8JD3mSey9XX13AZMmwTJBHdt1tUs4,1012
4
- nabu/__init__.py,sha256=BhsllrJ2adOlOshSRwCN9w9DtOegccwzs8GPbrfvAUA,270
4
+ nabu/__init__.py,sha256=jfYqwDZB9SZV1cW-GiBKmgxrQpKNF9PxVpFn-1m65Yg,270
5
5
  nabu/tests.py,sha256=cew9OY2uTyncHI_HM32W8CP6B1GTGKaOW65XtMEqs7o,1417
6
6
  nabu/testutils.py,sha256=VkSL9tbY0XEH49Z5OjDFFhzkSxrCv4UIuvSVFgegSUY,7632
7
7
  nabu/utils.py,sha256=V1B_sD54XGNKn5pORa2yNCATyswOzybey3sv8BuIYWY,26355
@@ -143,7 +143,7 @@ nabu/pipeline/fullfield/computations.py,sha256=AEp3qvwyY-l8-GzjH1E6kmcmU6OgDp6sB
143
143
  nabu/pipeline/fullfield/dataset_validator.py,sha256=Iy6oOnXnBldDcg0ifm_zzrzMQ6YdkR_hkHFySZgxbno,2943
144
144
  nabu/pipeline/fullfield/nabu_config.py,sha256=rvHmCNHx2y-GKBidRWCAjJd0IynvolPTTmBqNoOSvEA,31877
145
145
  nabu/pipeline/fullfield/processconfig.py,sha256=2eE9W0KjsHq8aSCXlczsISpWM9SMjWL03fN1RqZWyxg,36815
146
- nabu/pipeline/fullfield/reconstruction.py,sha256=fMHKR8LnpQ2_asIO5bJB3pRixABrKLi53KzJuB83NZ4,37422
146
+ nabu/pipeline/fullfield/reconstruction.py,sha256=LpIMyl8LLJoJLhayHXT3VyOwRpEL9tdjPhIegFUS388,37678
147
147
  nabu/pipeline/helical/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
148
148
  nabu/pipeline/helical/dataset_validator.py,sha256=0YQc0hdYdpaXznFaKmlj9SIu7mNs0xXMejcRkhOZHaI,640
149
149
  nabu/pipeline/helical/fbp.py,sha256=0fAz-Fb0Rn_FzellvcS2cy-Wvm-5dxEf494YFt4pLws,5845
@@ -249,7 +249,7 @@ nabu/reconstruction/tests/test_reconstructor.py,sha256=3p2Wk_OqgZqkNOkhK_NJWlHkO
249
249
  nabu/reconstruction/tests/test_sino_normalization.py,sha256=fGv5Dlidxgm8ZC70Nk6oqVgpY2jzOW9NJaGlo44IJOo,3692
250
250
  nabu/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
251
251
  nabu/resources/cor.py,sha256=-mcrTbj3G7o4PP5E_gIRo2j6_-ADmMkkOc_0CyQv84c,170
252
- nabu/resources/dataset_analyzer.py,sha256=e3AqYR9ORW9Q03mGYCiC66nXld-X0LPnx9E8X3zFIGU,18568
252
+ nabu/resources/dataset_analyzer.py,sha256=ld5BHt023nM3o9QlyZS5v3UpKiKyRdnYic9QZgNGjuI,18859
253
253
  nabu/resources/gpu.py,sha256=GgpMb5umRQAUsEDEAefb4wSA5qm4JSMhkWmCEpW3X9g,5702
254
254
  nabu/resources/logger.py,sha256=-lOzhN_sU4R3BIfC69aMj2O8S_ocsvXsmwkhWlcxVEc,3758
255
255
  nabu/resources/nxflatfield.py,sha256=FhPqiXe6ZKu5eGI6aVfyTgcHhZF9kQUNX0cOxDPD73k,9324
@@ -262,7 +262,6 @@ nabu/resources/templates/id16_holo.conf,sha256=sDd_rEJGZjOGVAsGub5sT2arfXDnc_sxy
262
262
  nabu/resources/templates/id16a_fluo.conf,sha256=Nz1etzO2fSwksi7CThWJ5T1kZEdyBe8rMO7puNJ93Hc,542
263
263
  nabu/resources/templates/id19_pag.conf,sha256=u4fFPEBprzOW9_5_ChkIgowQcYpLhjmA8Gwm5XgC4Jc,384
264
264
  nabu/resources/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
265
- nabu/resources/tests/test_extract.py,sha256=msYWFP96LjpEntq1ucTWgKZMhUvZcLpJ-AQB3oGOh2E,206
266
265
  nabu/resources/tests/test_nxflatfield.py,sha256=XRGbYwqJv0NYAVQnAB224TwTZP_W2Bs3-yu0zQnDzEM,4179
267
266
  nabu/resources/tests/test_units.py,sha256=F2jFTck-1UwYET1MwTtX6ntzYUosfwOJkugSencGgz8,2155
268
267
  nabu/stitching/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -302,7 +301,7 @@ nabu/stitching/tests/test_z_postprocessing_stitching.py,sha256=kKRb3PvMOnCW84S58
302
301
  nabu/stitching/tests/test_z_preprocessing_stitching.py,sha256=3EhX161S2JVz6z3vXnYgBlUUQVb1weXBqIR0KAXLeUg,16157
303
302
  nabu/stitching/utils/__init__.py,sha256=alIDGBnxWH4JvP-UW-7N99seBBi0r1GV1h8f1ERFBec,21
304
303
  nabu/stitching/utils/post_processing.py,sha256=aow36shbYhFgAnbCoq6mtXVpjBNCKm7VSLIvv3EYVdA,11303
305
- nabu/stitching/utils/utils.py,sha256=EssaIs7eUL1vrImJIi_Y5OzHHdEaoVedHAGWcOT8M6k,24650
304
+ nabu/stitching/utils/utils.py,sha256=Z_JcVrUdykYFzeHJD8J-3y7kQb4Ef3_FM7M0zjQTPXg,24659
306
305
  nabu/stitching/utils/tests/test_post-processing.py,sha256=Xy0UW8sL7ERtrxN7lEZhm8gJukDeL8vxkliMT8Agvas,753
307
306
  nabu/thirdparty/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
308
307
  nabu/thirdparty/algotom_convert_sino.py,sha256=iZVRilvyqMyLTu8RKgbqDFUjObWW5X69rCARrnNizuI,13872
@@ -310,9 +309,9 @@ nabu/thirdparty/pore3d_deringer_munch.py,sha256=o4bisnFc-wMjuohWBT8wgWmfNehPQGtC
310
309
  nabu/thirdparty/tomocupy_remove_stripe.py,sha256=Khe4zFf0kRzu65Yxnvq58gt1ljOztqJGdMDhVAiM7lM,24363
311
310
  nabu/thirdparty/tomopy_phase.py,sha256=hK4oPpkogLOhv23XzzEXQY2u3r8fJvASY_bINVs6ERE,8634
312
311
  nabu/thirdparty/tomwer_load_flats_darks.py,sha256=ZNoVAinUb_wGYbfvs_4BVnWsjsQmNxSvCh1bWhR2WWg,5611
313
- nabu-2024.2.5.dist-info/LICENSE,sha256=1eAIPSnEsnSFNUODnLtNtQTs76exG3ZxJ1DJR6zoUBA,1066
314
- nabu-2024.2.5.dist-info/METADATA,sha256=dagapyWNaPkQX79F5M8U6pRfmPJqczjoupUC41I5yfw,5514
315
- nabu-2024.2.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
316
- nabu-2024.2.5.dist-info/entry_points.txt,sha256=cJKGkBeykVL7uK3E4R0RLRqMXifTL2qdO573syPAvJc,1288
317
- nabu-2024.2.5.dist-info/top_level.txt,sha256=fsm_N3eXLRZk2QXF9OSKPNDPFXOz8FAQjHh5avT3dok,9
318
- nabu-2024.2.5.dist-info/RECORD,,
312
+ nabu-2024.2.7.dist-info/LICENSE,sha256=1eAIPSnEsnSFNUODnLtNtQTs76exG3ZxJ1DJR6zoUBA,1066
313
+ nabu-2024.2.7.dist-info/METADATA,sha256=KhmcCqJFd0DXEKQ3YP42BSC5a7yedWK1Cx0VLsukF9s,5514
314
+ nabu-2024.2.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
315
+ nabu-2024.2.7.dist-info/entry_points.txt,sha256=cJKGkBeykVL7uK3E4R0RLRqMXifTL2qdO573syPAvJc,1288
316
+ nabu-2024.2.7.dist-info/top_level.txt,sha256=fsm_N3eXLRZk2QXF9OSKPNDPFXOz8FAQjHh5avT3dok,9
317
+ nabu-2024.2.7.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- from nabu.utils import list_match_queries
2
-
3
-
4
- def test_list_match_queries():
5
-
6
- # entry0000 .... entry0099
7
- avail = ["entry%04d" % i for i in range(100)]
8
- query = "entry0000"
9
- list_match_queries()