nabu 2024.1.4__py3-none-any.whl → 2024.1.6__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 +1 -1
- nabu/app/tests/__init__.py +0 -0
- nabu/io/cast_volume.py +34 -11
- nabu/io/tests/test_cast_volume.py +18 -10
- nabu/pipeline/writer.py +2 -1
- {nabu-2024.1.4.dist-info → nabu-2024.1.6.dist-info}/METADATA +1 -1
- {nabu-2024.1.4.dist-info → nabu-2024.1.6.dist-info}/RECORD +11 -11
- {nabu-2024.1.4.dist-info → nabu-2024.1.6.dist-info}/WHEEL +1 -1
- doc/doc_config.py +0 -32
- {nabu-2024.1.4.dist-info → nabu-2024.1.6.dist-info}/LICENSE +0 -0
- {nabu-2024.1.4.dist-info → nabu-2024.1.6.dist-info}/entry_points.txt +0 -0
- {nabu-2024.1.4.dist-info → nabu-2024.1.6.dist-info}/top_level.txt +0 -0
nabu/__init__.py
CHANGED
File without changes
|
nabu/io/cast_volume.py
CHANGED
@@ -293,25 +293,48 @@ def find_histogram(volume: VolumeBase, scan: Optional[TomoScanBase] = None) -> O
|
|
293
293
|
data_path = volume.data_url.data_path().replace(HDF5Volume.DATA_DATASET_NAME, "histogram/results/data")
|
294
294
|
elif isinstance(volume, (EDFVolume, JP2KVolume, TIFFVolume, MultiTIFFVolume)):
|
295
295
|
if isinstance(volume, (EDFVolume, JP2KVolume, TIFFVolume)):
|
296
|
-
# TODO: check with pierre what is the policy of histogram files names
|
297
296
|
histogram_file = os.path.join(
|
298
297
|
volume.data_url.file_path(),
|
299
|
-
volume.get_volume_basename() + "
|
298
|
+
volume.get_volume_basename() + "_histogram.hdf5",
|
300
299
|
)
|
300
|
+
if not os.path.exists(histogram_file):
|
301
|
+
# legacy location
|
302
|
+
legacy_histogram_file = os.path.join(
|
303
|
+
volume.data_url.file_path(),
|
304
|
+
volume.get_volume_basename() + "histogram.hdf5",
|
305
|
+
)
|
306
|
+
if os.path.exists(legacy_histogram_file):
|
307
|
+
# only overwrite if exists. Else keep the older one to get a clearer information
|
308
|
+
histogram_file = legacy_histogram_file
|
301
309
|
else:
|
302
|
-
# TODO: check with pierre what is the policy of histogram files names
|
303
310
|
file_path, _ = os.path.splitext(volume.data_url.file_path())
|
304
|
-
histogram_file =
|
311
|
+
histogram_file = file_path + "_histogram.hdf5"
|
305
312
|
|
306
313
|
if scan is not None:
|
307
|
-
data_path = getattr(scan, "entry", "entry")
|
314
|
+
data_path = getattr(scan, "entry/histogram/results/data", "entry/histogram/results/data")
|
308
315
|
else:
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
316
|
+
|
317
|
+
def get_file_entries(file_path: str) -> Optional[tuple]:
|
318
|
+
if os.path.exists(file_path):
|
319
|
+
with HDF5File(file_path, mode="r") as h5s:
|
320
|
+
return tuple(h5s.keys())
|
321
|
+
else:
|
322
|
+
return None
|
323
|
+
|
324
|
+
# in the case we only know about the volume to cast.
|
325
|
+
# in most of the cast the histogram.hdf5 file will only get a single entry. The exception could be
|
326
|
+
# for HDF5 if the user save volumes into the same file.
|
327
|
+
# we can find back the histogram
|
328
|
+
entries = get_file_entries(histogram_file)
|
329
|
+
if entries is not None and len(entries) == 1:
|
330
|
+
data_path = "/".join((entries[0], "histogram/results/data"))
|
331
|
+
else:
|
332
|
+
# TODO: FIXME: how to get the entry name in every case ?
|
333
|
+
# what to do if the histogram file has more than one entry.
|
334
|
+
# one option could be to request the entry from the user...
|
335
|
+
# or keep as today (in this case it will be recomputed)
|
336
|
+
_logger.info("histogram file found but unable to find relevant histogram")
|
337
|
+
return None
|
315
338
|
else:
|
316
339
|
raise NotImplementedError(f"volume {type(volume)} not handled")
|
317
340
|
|
@@ -70,9 +70,9 @@ def test_get_default_output_volume():
|
|
70
70
|
)
|
71
71
|
assert isinstance(output_volume, HDF5Volume)
|
72
72
|
assert output_volume.data_url.file_path() == "vol_cast/my_file.hdf5"
|
73
|
-
assert output_volume.data_url.data_path() == HDF5Volume.DATA_DATASET_NAME
|
73
|
+
assert output_volume.data_url.data_path() == "volume/" + HDF5Volume.DATA_DATASET_NAME
|
74
74
|
assert output_volume.metadata_url.file_path() == "vol_cast/my_file.hdf5"
|
75
|
-
assert output_volume.metadata_url.data_path() == HDF5Volume.METADATA_GROUP_NAME
|
75
|
+
assert output_volume.metadata_url.data_path() == "volume/" + HDF5Volume.METADATA_GROUP_NAME
|
76
76
|
|
77
77
|
# test jp2 to hdf5
|
78
78
|
input_volume = JP2KVolume(
|
@@ -119,19 +119,23 @@ def test_find_histogram_single_frame_volume(tmp_path):
|
|
119
119
|
folder=tmp_path,
|
120
120
|
volume_basename="volume",
|
121
121
|
)
|
122
|
-
histogram_file = os.path.join(tmp_path, "
|
122
|
+
histogram_file = os.path.join(tmp_path, "volume_histogram.hdf5")
|
123
123
|
with h5py.File(histogram_file, mode="w") as h5f:
|
124
124
|
h5f.require_group("entry/histogram/results/data")
|
125
125
|
|
126
126
|
# check behavior
|
127
|
-
assert find_histogram(volume=volume) ==
|
127
|
+
assert find_histogram(volume=volume) == DataUrl(
|
128
|
+
file_path=histogram_file,
|
129
|
+
data_path="entry/histogram/results/data",
|
130
|
+
scheme="silx",
|
131
|
+
)
|
128
132
|
|
129
133
|
assert find_histogram(
|
130
134
|
volume=volume,
|
131
135
|
scan=EDFTomoScan(scan=str(tmp_path)),
|
132
136
|
) == DataUrl(
|
133
137
|
file_path=histogram_file,
|
134
|
-
data_path="entry",
|
138
|
+
data_path="entry/histogram/results/data",
|
135
139
|
scheme="silx",
|
136
140
|
)
|
137
141
|
|
@@ -140,7 +144,7 @@ def test_find_histogram_single_frame_volume(tmp_path):
|
|
140
144
|
scan=NXtomoScan(scan=str(tmp_path), entry="entry"),
|
141
145
|
) == DataUrl(
|
142
146
|
file_path=histogram_file,
|
143
|
-
data_path="entry",
|
147
|
+
data_path="entry/histogram/results/data",
|
144
148
|
scheme="silx",
|
145
149
|
)
|
146
150
|
|
@@ -156,19 +160,23 @@ def test_find_histogram_multi_tiff_volume(tmp_path):
|
|
156
160
|
volume = MultiTIFFVolume(
|
157
161
|
file_path=tiff_file,
|
158
162
|
)
|
159
|
-
histogram_file = os.path.join(tmp_path, "
|
163
|
+
histogram_file = os.path.join(tmp_path, "my_tiff_histogram.hdf5")
|
160
164
|
with h5py.File(histogram_file, mode="w") as h5f:
|
161
165
|
h5f.require_group("entry/histogram/results/data")
|
162
166
|
|
163
167
|
# check behavior
|
164
|
-
assert find_histogram(volume=volume) ==
|
168
|
+
assert find_histogram(volume=volume) == DataUrl(
|
169
|
+
file_path=histogram_file,
|
170
|
+
data_path="entry/histogram/results/data",
|
171
|
+
scheme="silx",
|
172
|
+
)
|
165
173
|
|
166
174
|
assert find_histogram(
|
167
175
|
volume=volume,
|
168
176
|
scan=EDFTomoScan(scan=str(tmp_path)),
|
169
177
|
) == DataUrl(
|
170
178
|
file_path=histogram_file,
|
171
|
-
data_path="entry",
|
179
|
+
data_path="entry/histogram/results/data",
|
172
180
|
scheme="silx",
|
173
181
|
)
|
174
182
|
|
@@ -177,7 +185,7 @@ def test_find_histogram_multi_tiff_volume(tmp_path):
|
|
177
185
|
scan=NXtomoScan(scan=str(tmp_path), entry="entry"),
|
178
186
|
) == DataUrl(
|
179
187
|
file_path=histogram_file,
|
180
|
-
data_path="entry",
|
188
|
+
data_path="entry/histogram/results/data",
|
181
189
|
scheme="silx",
|
182
190
|
)
|
183
191
|
|
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")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: nabu
|
3
|
-
Version: 2024.1.
|
3
|
+
Version: 2024.1.6
|
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,8 +1,7 @@
|
|
1
1
|
doc/conf.py,sha256=3xtCarCHrXPr50GbeRDuH-o3Jzojw7mpr7vpGfZPLAE,3787
|
2
2
|
doc/create_conf_doc.py,sha256=IVOdP70KvbW9WS_UQu3Iyd0YfS60E2fJ5IDtQ_s4cDw,1143
|
3
|
-
doc/doc_config.py,sha256=anqeOVjqE2e7eVzg7yuh9dvIneTkrA5doGl1cVBqT7Q,730
|
4
3
|
doc/get_mathjax.py,sha256=VIvKRCdDuF2VoY8JD3mSey9XX13AZMmwTJBHdt1tUs4,1012
|
5
|
-
nabu/__init__.py,sha256=
|
4
|
+
nabu/__init__.py,sha256=R001g25kFvEVDDeajbatTdAG1ufFI08DldAcf4ADwF4,270
|
6
5
|
nabu/tests.py,sha256=cew9OY2uTyncHI_HM32W8CP6B1GTGKaOW65XtMEqs7o,1417
|
7
6
|
nabu/testutils.py,sha256=qqtGgkIhpOpXhgeoXlqCb91Rx-JlI4ALaDF6nt8YRRk,13298
|
8
7
|
nabu/utils.py,sha256=w-xfRb6TFQpS-tao6nlvfmr962pmeec-WH1GltSUCrk,23767
|
@@ -32,6 +31,7 @@ nabu/app/shrink_dataset.py,sha256=P9dorO0Q-gPAWgSHyZi3XQp4jkMTJacDYzNvJY4oh98,35
|
|
32
31
|
nabu/app/stitching.py,sha256=Ibp1oVokLVMz-VX762j1C0E88Di0YJvRt-b8NjGoe7g,3310
|
33
32
|
nabu/app/utils.py,sha256=XUBRWDmth4i3BZHd27rfarFAUP7OEcsMeVmDJ6T4EXA,1178
|
34
33
|
nabu/app/validator.py,sha256=IR-DcUV5h1Fc5CChBfBIaglrGpfKNICX7tGirAroMiw,3368
|
34
|
+
nabu/app/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
35
35
|
nabu/app/tests/test_reduce_dark_flat.py,sha256=T-_zyzD0-f2c5Z-tlzmRF5p3vPtyL2RFb-D5fIYYEoM,2641
|
36
36
|
nabu/cuda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
nabu/cuda/convolution.py,sha256=n8KsJ7IZdPOs_K5QZC6qblnOvIKYwxtdt03oNa0GiMU,241
|
@@ -76,7 +76,7 @@ nabu/estimation/tests/test_focus.py,sha256=deaVGbIFSzHDAReoeAy-1HLsnKWpJQsC2SL9W
|
|
76
76
|
nabu/estimation/tests/test_tilt.py,sha256=PN4tnV3-XU2nNA608kQShaHugWn_-wbHzWCTnLIaCTk,1658
|
77
77
|
nabu/estimation/tests/test_translation.py,sha256=RkOnCYgk9DZGKlIka1snqTv4wbIz_nG7-EHAxnBHsJU,2999
|
78
78
|
nabu/io/__init__.py,sha256=Mx0HRIENk0dJbN3b9tzPZhiOnPMxBItgVNQn_QLLrlI,176
|
79
|
-
nabu/io/cast_volume.py,sha256=
|
79
|
+
nabu/io/cast_volume.py,sha256=fgqbabNHM1H2JKiUJR1kBrcIh9kBY7HpCmLTWbcCvvU,16712
|
80
80
|
nabu/io/detector_distortion.py,sha256=Or4icugi0fGRKWIG0I9hCuR1UZA5Cel25ZGY7cR2j4I,11744
|
81
81
|
nabu/io/reader.py,sha256=1DlUYObfOBEGYJHEqyw1Mb2uQ_b_Z7-FFqMWS-4tIB0,23083
|
82
82
|
nabu/io/reader_helical.py,sha256=_6vZBH-US_VT7oOGJUtYXqPwFws7xZKcmdOthpwvlIQ,4477
|
@@ -84,7 +84,7 @@ nabu/io/tiffwriter_zmm.py,sha256=ykaSFqdbYhGNxdBrJRT_rxihx5wj9G8qMQMI1e07fNk,383
|
|
84
84
|
nabu/io/utils.py,sha256=pFRULSlmGzJnzBbeSNKRhnKbBPbV0XaeUsxnWmnMtR4,9223
|
85
85
|
nabu/io/writer.py,sha256=cWKY7RcNUztOs1ktzLP2G087fLvq4yNMNdvvBdnoOSk,31417
|
86
86
|
nabu/io/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
87
|
-
nabu/io/tests/test_cast_volume.py,sha256=
|
87
|
+
nabu/io/tests/test_cast_volume.py,sha256=WCDStfV_eu4tjeKibWXrXEDbN0hPJGOzacGv6efgHAI,10743
|
88
88
|
nabu/io/tests/test_detector_distortion.py,sha256=-l-fl_RmSoZHl9aDoHDoJE13L8w9ghBXGASc9PYGzqw,6341
|
89
89
|
nabu/io/tests/test_writers.py,sha256=PjHRI8euuRnejwE_LNMSdwqUq18V0V3VJwmRhi8xvyk,7188
|
90
90
|
nabu/misc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -134,7 +134,7 @@ nabu/pipeline/fallback_utils.py,sha256=7ccrKYE-rp3fydb72VA6W0_eKcEoqYBEAPlmij_ly
|
|
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=
|
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
|
@@ -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.
|
292
|
-
nabu-2024.1.
|
293
|
-
nabu-2024.1.
|
294
|
-
nabu-2024.1.
|
295
|
-
nabu-2024.1.
|
296
|
-
nabu-2024.1.
|
291
|
+
nabu-2024.1.6.dist-info/LICENSE,sha256=1eAIPSnEsnSFNUODnLtNtQTs76exG3ZxJ1DJR6zoUBA,1066
|
292
|
+
nabu-2024.1.6.dist-info/METADATA,sha256=ogaBqKAavm40N8GeX3XPDsRTwKm12-BgSfbB3HuR7ag,5224
|
293
|
+
nabu-2024.1.6.dist-info/WHEEL,sha256=5sUXSg9e4bi7lTLOHcm6QEYwO5TIF1TNbTSVFVjcJcc,92
|
294
|
+
nabu-2024.1.6.dist-info/entry_points.txt,sha256=cJKGkBeykVL7uK3E4R0RLRqMXifTL2qdO573syPAvJc,1288
|
295
|
+
nabu-2024.1.6.dist-info/top_level.txt,sha256=fsm_N3eXLRZk2QXF9OSKPNDPFXOz8FAQjHh5avT3dok,9
|
296
|
+
nabu-2024.1.6.dist-info/RECORD,,
|
doc/doc_config.py
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
#!/usr/bin/env python
|
2
|
-
|
3
|
-
from nabu.resources.nabu_config import nabu_config
|
4
|
-
|
5
|
-
|
6
|
-
def generate(file_):
|
7
|
-
def write(content):
|
8
|
-
print(content, file=file_)
|
9
|
-
for section, values in nabu_config.items():
|
10
|
-
if section == "about":
|
11
|
-
continue
|
12
|
-
write("## %s\n" % section)
|
13
|
-
for key, val in values.items():
|
14
|
-
if val["type"] == "unsupported":
|
15
|
-
continue
|
16
|
-
write(val["help"] + "\n")
|
17
|
-
write(
|
18
|
-
"```ini\n%s = %s\n```"
|
19
|
-
% (key, val["default"])
|
20
|
-
)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
if __name__ == "__main__":
|
25
|
-
|
26
|
-
import sys, os
|
27
|
-
print(os.path.abspath(__file__))
|
28
|
-
exit(0)
|
29
|
-
|
30
|
-
fname = "/tmp/test.md"
|
31
|
-
with open(fname, "w") as f:
|
32
|
-
generate(f)
|
File without changes
|
File without changes
|
File without changes
|