dcnum 0.31.2__tar.gz → 0.31.4__tar.gz

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 (181) hide show
  1. {dcnum-0.31.2 → dcnum-0.31.4}/CHANGELOG +192 -3
  2. {dcnum-0.31.2 → dcnum-0.31.4}/PKG-INFO +4 -5
  3. {dcnum-0.31.2 → dcnum-0.31.4}/README.rst +3 -4
  4. {dcnum-0.31.2 → dcnum-0.31.4}/benchmark/benchmark.py +2 -2
  5. dcnum-0.31.4/benchmark/bm_segm_torch_uni_inductor.py +62 -0
  6. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/__init__.py +3 -0
  7. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/_version.py +3 -3
  8. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/common.py +28 -3
  9. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/external/skimage_morphology.py +2 -0
  10. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/__init__.py +2 -0
  11. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_background/__init__.py +2 -0
  12. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_background/base.py +14 -8
  13. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_background/bg_copy.py +8 -5
  14. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_background/bg_roll_median.py +53 -26
  15. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_background/bg_sparse_median.py +45 -19
  16. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_brightness/__init__.py +2 -0
  17. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_brightness/bright_all.py +18 -5
  18. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_brightness/common.py +2 -0
  19. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_contour/__init__.py +2 -0
  20. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_contour/contour.py +3 -1
  21. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_contour/moments.py +17 -7
  22. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_contour/volume.py +5 -3
  23. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_texture/__init__.py +2 -0
  24. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_texture/common.py +2 -0
  25. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/feat_texture/tex_all.py +45 -12
  26. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/gate.py +34 -13
  27. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/feat/queue_event_extractor.py +43 -12
  28. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/logic/__init__.py +2 -0
  29. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/logic/chunk_slot.py +6 -1
  30. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/logic/chunk_slot_data.py +31 -10
  31. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/logic/ctrl.py +258 -56
  32. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/logic/job.py +40 -19
  33. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/logic/json_encoder.py +7 -1
  34. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/logic/slot_register.py +82 -34
  35. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/logic/universal_worker.py +12 -2
  36. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/meta/__init__.py +2 -0
  37. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/meta/paths.py +18 -5
  38. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/meta/ppid.py +47 -18
  39. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/os_env_st.py +2 -0
  40. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/read/__init__.py +1 -0
  41. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/read/cache.py +20 -10
  42. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/read/const.py +1 -0
  43. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/read/detect_flicker.py +17 -5
  44. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/read/hdf5_concat.py +47 -24
  45. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/read/hdf5_data.py +184 -44
  46. dcnum-0.31.4/dcnum/read/mapped.py +227 -0
  47. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/__init__.py +1 -0
  48. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segm_thresh.py +4 -1
  49. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segm_torch/__init__.py +1 -0
  50. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segm_torch/segm_torch_base.py +4 -1
  51. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segm_torch/segm_torch_mpo.py +2 -1
  52. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segm_torch/segm_torch_sto.py +1 -0
  53. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segm_torch/segm_torch_uni.py +5 -2
  54. dcnum-0.31.4/dcnum/segm/segm_torch/torch_graph_opt.py +105 -0
  55. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segm_torch/torch_model.py +191 -21
  56. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segm_torch/torch_postproc.py +10 -7
  57. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segm_torch/torch_preproc.py +1 -0
  58. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segm_torch/torch_setup.py +24 -21
  59. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segmenter.py +67 -26
  60. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segmenter_manager_thread.py +2 -2
  61. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segmenter_mpo.py +63 -18
  62. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segmenter_sto.py +5 -3
  63. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/segm/segmenter_uni.py +21 -5
  64. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/write/__init__.py +2 -0
  65. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/write/chunk_writer.py +9 -3
  66. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/write/event_stash.py +3 -1
  67. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/write/queue_writer_base.py +45 -12
  68. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/write/queue_writer_process.py +11 -5
  69. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/write/queue_writer_thread.py +2 -0
  70. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/write/writer.py +142 -48
  71. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum.egg-info/PKG-INFO +4 -5
  72. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum.egg-info/SOURCES.txt +11 -1
  73. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum.egg-info/scm_file_list.json +11 -1
  74. dcnum-0.31.4/dcnum.egg-info/scm_version.json +8 -0
  75. {dcnum-0.31.2 → dcnum-0.31.4}/docs/conf.py +1 -0
  76. {dcnum-0.31.2 → dcnum-0.31.4}/docs/extensions/github_changelog.py +12 -9
  77. {dcnum-0.31.2 → dcnum-0.31.4}/docs/figures/pipeline_steps_thresh.py +2 -2
  78. {dcnum-0.31.2 → dcnum-0.31.4}/docs/index.rst +1 -0
  79. dcnum-0.31.4/docs/sec_dclab.rst +156 -0
  80. {dcnum-0.31.2 → dcnum-0.31.4}/docs/sec_design.rst +5 -4
  81. {dcnum-0.31.2 → dcnum-0.31.4}/docs/sec_getting_started.rst +9 -0
  82. {dcnum-0.31.2 → dcnum-0.31.4}/docs/sec_pipeline.rst +46 -7
  83. {dcnum-0.31.2 → dcnum-0.31.4}/pyproject.toml +12 -0
  84. {dcnum-0.31.2 → dcnum-0.31.4}/tests/conftest.py +7 -1
  85. {dcnum-0.31.2 → dcnum-0.31.4}/tests/data/Readme.md +7 -0
  86. dcnum-0.31.4/tests/data/feat_reference_values.json +2162 -0
  87. dcnum-0.31.4/tests/data/segm-torch-model_unet-dcnum-test_g2_cb32a.zip +0 -0
  88. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_feat_background_base.py +69 -0
  89. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_feat_background_bg_copy.py +26 -0
  90. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_feat_background_bg_roll_median.py +96 -7
  91. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_feat_background_bg_sparsemed.py +143 -1
  92. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_feat_brightness.py +18 -0
  93. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_feat_gate.py +87 -14
  94. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_feat_haralick.py +12 -0
  95. dcnum-0.31.4/tests/test_feat_queue_event_extractor.py +75 -0
  96. dcnum-0.31.4/tests/test_feat_reproducibility.py +184 -0
  97. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_logic_job.py +26 -1
  98. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_logic_json.py +5 -3
  99. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_logic_pipeline.py +419 -18
  100. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_logic_state_warden.py +8 -9
  101. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_logic_universal_worker.py +2 -2
  102. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_meta_ppid_base.py +5 -4
  103. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_meta_ppid_data.py +7 -0
  104. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_meta_ppid_segm.py +22 -0
  105. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_read_basin.py +5 -5
  106. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_read_cache.py +34 -1
  107. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_read_concat_hdf5.py +18 -1
  108. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_read_detect_flicker.py +3 -0
  109. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_read_hdf5.py +33 -1
  110. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_read_hdf5_basins.py +90 -0
  111. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_read_hdf5_concat.py +0 -2
  112. dcnum-0.31.4/tests/test_read_mapped.py +66 -0
  113. dcnum-0.31.4/tests/test_segm_mpo.py +36 -0
  114. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_segm_no_mask_proc.py +1 -2
  115. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_segm_sto.py +3 -1
  116. dcnum-0.31.2/tests/test_segm_mpo.py → dcnum-0.31.4/tests/test_segm_thresh.py +123 -9
  117. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_segm_torch.py +37 -4
  118. dcnum-0.31.4/tests/test_segm_torch_graph_opt.py +92 -0
  119. dcnum-0.31.4/tests/test_segm_torch_model_file.py +211 -0
  120. dcnum-0.31.4/tests/test_segm_torch_setup.py +23 -0
  121. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_segm_torch_uni.py +29 -7
  122. dcnum-0.31.4/tests/test_segm_uni.py +48 -0
  123. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_write_chunk_writer.py +24 -0
  124. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_write_writer.py +88 -2
  125. dcnum-0.31.2/dcnum/read/mapped.py +0 -123
  126. dcnum-0.31.2/dcnum.egg-info/scm_version.json +0 -8
  127. dcnum-0.31.2/tests/data/segm-torch-model_unet-dcnum-test_g2_0901b.zip +0 -0
  128. dcnum-0.31.2/tests/test_segm_thresh.py +0 -120
  129. dcnum-0.31.2/tests/test_segm_torch_model_file.py +0 -57
  130. {dcnum-0.31.2 → dcnum-0.31.4}/.github/workflows/check.yml +0 -0
  131. {dcnum-0.31.2 → dcnum-0.31.4}/.github/workflows/deploy_pypi.yml +0 -0
  132. {dcnum-0.31.2 → dcnum-0.31.4}/.gitignore +0 -0
  133. {dcnum-0.31.2 → dcnum-0.31.4}/.readthedocs.yml +0 -0
  134. {dcnum-0.31.2 → dcnum-0.31.4}/LICENSE +0 -0
  135. {dcnum-0.31.2 → dcnum-0.31.4}/benchmark/.gitignore +0 -0
  136. {dcnum-0.31.2 → dcnum-0.31.4}/benchmark/Readme.md +0 -0
  137. {dcnum-0.31.2 → dcnum-0.31.4}/benchmark/bm_logic_ctrl_job_runner.py +0 -0
  138. {dcnum-0.31.2 → dcnum-0.31.4}/benchmark/bm_logic_slot_register_task_extract_features.py +0 -0
  139. {dcnum-0.31.2 → dcnum-0.31.4}/benchmark/bm_segm_segmenter.py +0 -0
  140. {dcnum-0.31.2 → dcnum-0.31.4}/benchmark/bm_segm_segmenter_manager_thread.py +0 -0
  141. {dcnum-0.31.2 → dcnum-0.31.4}/benchmark/bm_write_chunk_writer.py +0 -0
  142. {dcnum-0.31.2 → dcnum-0.31.4}/benchmark/bm_write_queue_writer_thread.py +0 -0
  143. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum/external/__init__.py +0 -0
  144. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum.egg-info/dependency_links.txt +0 -0
  145. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum.egg-info/requires.txt +0 -0
  146. {dcnum-0.31.2 → dcnum-0.31.4}/dcnum.egg-info/top_level.txt +0 -0
  147. {dcnum-0.31.2 → dcnum-0.31.4}/docs/.gitignore +0 -0
  148. {dcnum-0.31.2 → dcnum-0.31.4}/docs/figures/pipeline_overview.py +0 -0
  149. {dcnum-0.31.2 → dcnum-0.31.4}/docs/figures/pipeline_steps_unet.py +0 -0
  150. {dcnum-0.31.2 → dcnum-0.31.4}/docs/requirements.txt +0 -0
  151. {dcnum-0.31.2 → dcnum-0.31.4}/docs/sec_changelog.rst +0 -0
  152. {dcnum-0.31.2 → dcnum-0.31.4}/setup.cfg +0 -0
  153. {dcnum-0.31.2 → dcnum-0.31.4}/tests/data/fmt-hdf5_cytoshot_extended-moments-features.zip +0 -0
  154. {dcnum-0.31.2 → dcnum-0.31.4}/tests/data/fmt-hdf5_cytoshot_full-features_2023.zip +0 -0
  155. {dcnum-0.31.2 → dcnum-0.31.4}/tests/data/fmt-hdf5_cytoshot_full-features_2024.zip +0 -0
  156. {dcnum-0.31.2 → dcnum-0.31.4}/tests/data/fmt-hdf5_cytoshot_full-features_legacy_allev_2023.zip +0 -0
  157. {dcnum-0.31.2 → dcnum-0.31.4}/tests/data/fmt-hdf5_shapein_empty.zip +0 -0
  158. {dcnum-0.31.2 → dcnum-0.31.4}/tests/data/fmt-hdf5_shapein_raw-with-variable-length-logs.zip +0 -0
  159. {dcnum-0.31.2 → dcnum-0.31.4}/tests/data/segm-torch-model_unet-dcnum-test_g1_6784c.zip +0 -0
  160. {dcnum-0.31.2 → dcnum-0.31.4}/tests/data/segm-torch-model_unet-dcnum-test_g1_910c2.zip +0 -0
  161. {dcnum-0.31.2 → dcnum-0.31.4}/tests/data/segm-torch-model_unet-dcnum-test_g2_02dcd.zip +0 -0
  162. {dcnum-0.31.2 → dcnum-0.31.4}/tests/data/segm-torch-model_unet-dcnum-test_g2_17ec6.zip +0 -0
  163. {dcnum-0.31.2 → dcnum-0.31.4}/tests/data/segm-torch-test-data_unet-dcnum-test_g1_910c2.zip +0 -0
  164. {dcnum-0.31.2 → dcnum-0.31.4}/tests/helper_methods.py +0 -0
  165. {dcnum-0.31.2 → dcnum-0.31.4}/tests/requirements.txt +0 -0
  166. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_common_join.py +0 -0
  167. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_common_lazy_loader.py +0 -0
  168. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_feat_moments_based.py +0 -0
  169. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_feat_moments_based_extended.py +0 -0
  170. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_feat_volume.py +0 -0
  171. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_init.py +0 -0
  172. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_logic_chunk_slot.py +0 -0
  173. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_logic_slot_register.py +0 -0
  174. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_meta_paths.py +0 -0
  175. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_meta_ppid_bg.py +0 -0
  176. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_meta_ppid_feat.py +0 -0
  177. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_meta_ppid_gate.py +0 -0
  178. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_read_hdf5_index_mapping.py +0 -0
  179. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_segm_base.py +0 -0
  180. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_segm_torch_preproc.py +0 -0
  181. {dcnum-0.31.2 → dcnum-0.31.4}/tests/test_write_queue_writer_thread.py +0 -0
@@ -1,7 +1,196 @@
1
+ 0.31.4
2
+ - fix: the pipeline stopped with "Universal workers failed to spawn"
3
+ when starting the universal workers took longer than 10 s per worker
4
+ (e.g. on a slow system or when the worker processes were suspended);
5
+ wait as long as the workers are alive instead
6
+ - enh: record the logs of the worker processes of multiprocessing
7
+ segmenters (e.g. "torchmpo") in the pipeline log (#19)
8
+ - docs: explain the pipeline generation `DCNUM_PPID_GENERATION` (#22)
9
+ - docs: compare `HDF5Data` with dclab's `RTDCBase` (#35)
10
+ - docs: compare `HDF5Writer` with dclab's `RTDCWriter` (#34)
11
+ - ref: remove unreachable branch for non-array basin mappings in
12
+ `BackgroundCopy`
13
+ - tests: 100% coverage for `dcnum.feat.feat_background`
14
+ - ref: remove unreachable check for zero contour moments in
15
+ `moments_based_features`
16
+ - tests: 100% coverage for `dcnum.feat.gate`, `dcnum.feat.feat_contour`,
17
+ and `dcnum.feat.feat_texture`
18
+ - tests: load `hdf5plugin` in `conftest.py` for all tests (some test files
19
+ failed when run on their own)
20
+ - tests: 100% coverage for `dcnum.feat.queue_event_extractor` (including
21
+ box gating of events with online gates)
22
+ - tests: make sure that the feature extraction stays reproducible
23
+ (reference values of all scalar features, identical results with
24
+ threads, processes, and different numbers of workers)
25
+ - tests: request single-threaded computation in `conftest.py` before
26
+ numpy is imported (debug-mode results differed in the last bits)
27
+ 0.31.3
28
+ - fix: "basinmap1" of the internal sparsemed background basin had the
29
+ shape (1, N) when the output events matched the input frames (e.g. one
30
+ event per frame), so that "image_bg" returned all background images
31
+ for a single event (regression in 0.24.0)
32
+ - fix: `copy_features` wrote the data in the wrong order for an unsorted
33
+ `mapping`, so that e.g. "image" did not match the other features
34
+ for an unsorted "index_mapping" with the "drain" basin strategy
35
+ (regression in 0.23.3)
36
+ - fix: features that the input file only provided via file basins (e.g.
37
+ "image" or "frame" in an output file created with the "tap" basin
38
+ strategy) were missing in the output file
39
+ - fix: the pipeline hung when a universal worker failed (e.g. retrying
40
+ to load a chunk forever or an unexpected error during feature
41
+ extraction); the job now stops with an error
42
+ - fix: `MappedHDF5Dataset` did not support tuple indexing, breaking the
43
+ sparsemed offset correction for image data from a mapped basin (e.g.
44
+ when recomputing the background of a dcnum output file)
45
+ - fix: `DCNumPipelineJob` modified the keyword argument dictionaries
46
+ passed to it, so that reusing e.g. `data_kwargs` for another input
47
+ file resulted in a wrong pixel size
48
+ - fix: `concatenated_hdf5_data` stored relative input paths in the
49
+ virtual datasets, so that the concatenated data could only be read
50
+ from the original working directory (filled with zeros otherwise)
51
+ - fix: errors when writing to the output file (e.g. disk full) were
52
+ only logged and the pipeline finished with an incomplete output
53
+ file; the job now stops with an error
54
+ - fix: when the universal workers failed to spawn, the job runner
55
+ returned silently in the "segmentation" state and the writer kept
56
+ running; the job now stops with an error
57
+ - fix: the pipeline failed at the very end when "index_mapping" was
58
+ a numpy array, because the job log could not be written (support
59
+ numpy arrays in `ExtendedJSONEncoder`)
60
+ - fix: `DCNumJobRunner.join` deleted the log file of a failed job; by
61
+ default, temporary files are now kept when the job ended in the
62
+ "error" state
63
+ - fix: slicing the image chunk caches (e.g. `HDF5Data.image[-5:]`)
64
+ returned wrong data for negative or empty slices and negative
65
+ steps, and out-of-bounds negative indices were not detected
66
+ - fix: rolling median background computation failed when the kernel
67
+ size equaled the number of images
68
+ - fix: sparse median background computation failed for input data
69
+ with a duration of zero (e.g. a single image)
70
+ - fix: "index_mapping" values beyond the dataset size (e.g. `1000`
71
+ or `slice(30, 1000)`) resulted in a wrong dataset size and an
72
+ `IndexError`, and open-ended slices (e.g. `slice(30, None)`) were
73
+ not supported; they are now limited to the dataset size (the
74
+ pipeline identifier still contains the user-specified value)
75
+ - fix: negative "index_mapping" values and mappings that do not
76
+ select any events now raise a `ValueError`
77
+ - fix: segmenters more than two levels below `Segmenter` (e.g. a
78
+ subclass of `SegmentThresh`) were not found by `get_segmenters`,
79
+ so their pipeline identifier could not be resolved
80
+ - fix: `detect_flickering` raised a `TypeError` for `HDF5Data`
81
+ instances, although the docstring allowed them
82
+ - fix: files with more than one basin without a name could not be
83
+ opened (regression in 0.28.3), and basins without a name or
84
+ description could not be copied
85
+ - fix: running dcnum on its own output within the same second failed
86
+ because of duplicate log names; a counter is appended to the names
87
+ of the "dcnum-job" and "dcnum-log" logs if necessary
88
+ - fix: brightness features failed with a `ZeroDivisionError` for
89
+ empty masks; they are NaN now
90
+ - fix: the cached arrays returned by `get_mapping_indices` could be
91
+ modified by callers, changing the result of later calls; they are
92
+ read-only now
93
+ - fix: an explicit `size_thresh_mask=0` for `Gate` (also via the
94
+ "bin area min" metadata with online gates) was replaced by the
95
+ default value 10
96
+ - fix: `HDF5Writer` and `set_default_filter_kwargs` modified the
97
+ `ds_kwds` dictionary passed by the caller in-place
98
+ - fix: `copy_features` silently wrote zero-valued events for negative
99
+ `mapping` indices or indices beyond the input dataset; it now
100
+ raises a `ValueError`
101
+ - fix: `UNISegmenter.segment_single` silently ignored and
102
+ `MPOSegmenter.segment_single` silently applied `bg_off` for
103
+ segmenters without background correction instead of raising a
104
+ `ValueError` like `segment_batch`
105
+ - fix: the PyTorch and OpenVINO setup functions were never executed
106
+ (regression in 0.31.0), so that PyTorch did not use deterministic
107
+ algorithms and OpenVINO telemetry was not disabled
108
+ - fix: do not disable cuDNN; convolutions without cuDNN are four times
109
+ slower on CUDA devices (only TorchScript models were not affected,
110
+ because their fused convolutions always use cuDNN)
111
+ - fix: disable the channels-last layout optimization of the "inductor"
112
+ backend for exported models (dcnm 2.0); with it, cuDNN used convolution
113
+ kernels that were up to three times slower for U-Net models with a
114
+ single input channel
115
+ - fix: if none of the wiring options of a model file can be used in the
116
+ current environment, raise a `WiringUnavailableError` that names the
117
+ reason for every option (was a misleading "does not have wiring
118
+ options" error)
119
+ - fix: the backend of the "torchuni" segmenter was not part of the
120
+ pipeline identifier, although different backends may produce slightly
121
+ different masks
122
+ - fix: `HDF5ImageCache` raised an `AttributeError` instead of warning
123
+ about zero-length image data from a `MappedHDF5Dataset` (e.g. an empty
124
+ "index_mapping"); `MappedHDF5Dataset` now has the "dtype", "file", and
125
+ "name" attributes of the underlying dataset
126
+ - enh: when the backend of the "torchuni" segmenter is chosen
127
+ automatically, skip the wiring options of the model file that cannot be
128
+ used (missing CUDA device, "inductor" without Triton on CUDA or without
129
+ C++ compiler on the CPU, OpenVINO not installed); Triton is optional
130
+ - enh: on CUDA devices, replace convolutions followed by a ReLU in
131
+ exported models (dcnm 2.0) with cuDNN's fused convolution + bias + ReLU
132
+ kernel, as `torch.jit.optimize_for_inference` does for TorchScript
133
+ models
134
+ - enh: compile exported models with the "inductor" backend only once for
135
+ all batch sizes (dynamic batch size); before, the model was recompiled
136
+ e.g. for the smaller batches of the last chunk of a dataset
137
+ - docs: comment on intended behavior of `fill_holes` (mask
138
+ post-processing), Haralick texture features, and the sparsemed
139
+ background assignment after cleansing
140
+ - docs: `concatenated_hdf5_data` does not include the "time" feature
141
+ - docs: fix broken logo in README, inconsistent background note and
142
+ incomplete gating description, building the docs from the
143
+ repository root, and typos in the changelog
144
+ - docs: fix typos and broken markup in docstrings and comments
145
+ - docs: correct docstrings in `read`, `write`, and `meta` that did not
146
+ match the code (e.g. `md5sum`, `require_feature`, `copy_features`)
147
+ - docs: correct docstrings in `logic` that did not match the code
148
+ (e.g. `reserve_slot_for_task`, `task_enforce_basin_strategy`)
149
+ - docs: correct docstrings in `feat` and `segm` that did not match the
150
+ code (e.g. `process_labels`, `segment_batch`, PPID examples)
151
+ - docs: document raised exceptions, side effects, parameters, and
152
+ return values in `read`, `write`, `meta`, and `common`
153
+ - docs: document job defaults, runner states, raised exceptions, side
154
+ effects, and missing parameters in `logic`
155
+ - docs: document parameters, return values, raised exceptions, and
156
+ edge cases in `feat` and `segm`
157
+ - tests: move the `SegmentThresh` tests (a `UNISegmenter`) from
158
+ `test_segm_mpo.py` to `test_segm_thresh.py` and fix their names
159
+ - tests: import `hdf5plugin` in test files that read compressed data,
160
+ so that they also pass when run on their own
161
+ - tests: replace the test model "unet-dcnum-test_g2_0901b" with the
162
+ re-exported "unet-dcnum-test_g2_cb32a" (batch normalization folded,
163
+ valid ZIP comment, "torch.eager" as last CPU wiring option), so that
164
+ the torch tests also pass on Windows without C++ compiler and OpenVINO
165
+ - tests: `test_segm_torch_uni` ("inductor" backend on the CPU) was always
166
+ skipped, because the C++ compiler check never succeeded
167
+ - tests: fix ruff findings in the tests, benchmarks, and docs figure
168
+ scripts; ruff ignores unused `noqa` comments (RUF100) in tests and
169
+ benchmarks, because flake8 needs them
170
+ - ref: fix ruff findings in the dcnum package (unused variables and noqa
171
+ comments, nested if statements, a context manager for the temporary
172
+ file in `concatenated_hdf5_data`, `ClassVar` for
173
+ `mask_default_kwargs`); an invalid type of "index_mapping" now raises a
174
+ `TypeError` instead of a `ValueError`
175
+ - ref: fix pyright findings in `dcnum.read` and `dcnum.write`
176
+ (annotations, None checks); `detect_flickering` raises a `ValueError`
177
+ for `HDF5Data` without image data
178
+ - ref: fix pyright findings in `dcnum.logic` (typed `count_time`
179
+ decorator, annotations, None checks)
180
+ - ref: fix pyright findings in `dcnum.feat`, `dcnum.segm`, `dcnum.meta`,
181
+ and `dcnum.common`; background computation raises a `ValueError` for
182
+ input data without images
183
+ - ref: all modules of the dcnum package import annotations from
184
+ `__future__` (enforced with ruff rule I002); no type annotations in
185
+ strings
1
186
  0.31.2
2
187
  - fix: online gates for `size_x` and `size_y` were ignored (regression in 0.16.6)
3
188
  - fix: "pipeline:dcnum yield" and "experiment:event count" were set to
4
189
  zero when the pipeline did not have to be rerun on a dcnum output file
190
+ - fix: features stored in internal basins of a file basin (e.g. sparsemed
191
+ "image_bg" in files from `create_with_basins`) could not be accessed,
192
+ causing the pipeline to hang when only segmentation was rerun on a dcnum
193
+ output file (regression in 0.26.0)
5
194
  0.31.1
6
195
  - fix: pipeline failed for relative `path_in` when `path_out` is in a
7
196
  different directory (basin path resolved relative to the wrong directory)
@@ -388,7 +577,7 @@
388
577
  - ref: several changes and deprecations in the PPID helper functions
389
578
  - build: change flat-layout to src-layout (issues with editable installs)
390
579
  0.14.0
391
- - fix: protected features (e.g. time, frame) were not included in ouptut
580
+ - fix: protected features (e.g. time, frame) were not included in output
392
581
  files when the input file was basin-based
393
582
  - ref: increment DCNUM_PPID_GENERATION to 6
394
583
  0.13.3
@@ -469,7 +658,7 @@
469
658
  - feat: introduce GPUSegmenter base class
470
659
  - fix: handle bytes-values in HDF5 attributes
471
660
  - ref: correctly introduce `requires_background_correction` for segmenters
472
- - setup: don't requrie cibuildwheel
661
+ - setup: don't require cibuildwheel
473
662
  0.10.0
474
663
  - enh: some minor improvements in efficiency
475
664
  - ref: increment DCNUM_PPID_GENERATION for the sake of clarity
@@ -483,7 +672,7 @@
483
672
  0.0.8
484
673
  - feat: introduce QueueCollectorThread
485
674
  - feat: introduce SegmenterManagerThread
486
- - feat: instroduce EventExtractorManagerThread and corresponding workers
675
+ - feat: introduce EventExtractorManagerThread and corresponding workers
487
676
  - enh: minor improvements for HDF5ImageCache and ImageCorrCache
488
677
  - enh: use data size as cache size if smaller than requested chunk size
489
678
  - enh: return dictionary for brightness feature computation
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dcnum
3
- Version: 0.31.2
3
+ Version: 0.31.4
4
4
  Summary: numerics toolbox for imaging deformability cytometry
5
5
  Author: Maximilian Schlögel, Paul Müller, Raghava Alajangi
6
6
  Maintainer-email: Paul Müller <dev@craban.de>
@@ -31,8 +31,8 @@ Provides-Extra: torch
31
31
  Requires-Dist: torch<3,>=2.2; extra == "torch"
32
32
  Dynamic: license-file
33
33
 
34
- |dcnum|
35
- =======
34
+ dcnum
35
+ =====
36
36
 
37
37
  |PyPI Version| |Build Status| |Coverage Status| |Docs Status|
38
38
 
@@ -60,12 +60,11 @@ For more options, please check out the `documentation
60
60
 
61
61
 
62
62
 
63
- .. |dcnum| image:: https://raw.github.com/DC-analysis/dcnum/main/docs/logo/dcnum.png
64
63
  .. |PyPI Version| image:: https://img.shields.io/pypi/v/dcnum.svg
65
64
  :target: https://pypi.python.org/pypi/dcnum
66
65
  .. |Build Status| image:: https://img.shields.io/github/actions/workflow/status/DC-analysis/dcnum/check.yml
67
66
  :target: https://github.com/DC-analysis/dcnum/actions?query=workflow%3AChecks
68
67
  .. |Coverage Status| image:: https://img.shields.io/codecov/c/github/DC-analysis/dcnum
69
68
  :target: https://codecov.io/gh/DC-analysis/dcnum
70
- .. |Docs Status| image:: https://readthedocs.org/projects/dcnum/badge/?version=latest
69
+ .. |Docs Status| image:: https://img.shields.io/readthedocs/dcnum
71
70
  :target: https://readthedocs.org/projects/dcnum/builds/
@@ -1,5 +1,5 @@
1
- |dcnum|
2
- =======
1
+ dcnum
2
+ =====
3
3
 
4
4
  |PyPI Version| |Build Status| |Coverage Status| |Docs Status|
5
5
 
@@ -27,12 +27,11 @@ For more options, please check out the `documentation
27
27
 
28
28
 
29
29
 
30
- .. |dcnum| image:: https://raw.github.com/DC-analysis/dcnum/main/docs/logo/dcnum.png
31
30
  .. |PyPI Version| image:: https://img.shields.io/pypi/v/dcnum.svg
32
31
  :target: https://pypi.python.org/pypi/dcnum
33
32
  .. |Build Status| image:: https://img.shields.io/github/actions/workflow/status/DC-analysis/dcnum/check.yml
34
33
  :target: https://github.com/DC-analysis/dcnum/actions?query=workflow%3AChecks
35
34
  .. |Coverage Status| image:: https://img.shields.io/codecov/c/github/DC-analysis/dcnum
36
35
  :target: https://codecov.io/gh/DC-analysis/dcnum
37
- .. |Docs Status| image:: https://readthedocs.org/projects/dcnum/badge/?version=latest
36
+ .. |Docs Status| image:: https://img.shields.io/readthedocs/dcnum
38
37
  :target: https://readthedocs.org/projects/dcnum/builds/
@@ -60,8 +60,8 @@ if __name__ == "__main__":
60
60
 
61
61
  for bmp in sorted(benchmark_paths):
62
62
  bmp = pathlib.Path(bmp)
63
- print("")
63
+ print()
64
64
  res = run_benchmark(bmp)
65
65
  with bmp.with_suffix(".txt").open("a") as fd:
66
66
  fd.write(time.strftime(f"%Y-%m-%d_%H.%M.%S {res}\n"))
67
- print("")
67
+ print()
@@ -0,0 +1,62 @@
1
+ """Segmentation with the "inductor" backend, including compilation
2
+
3
+ dcnum segments the images chunk by chunk. On a GPU, each chunk is split
4
+ into batches of about the same size; on the CPU, each chunk is one batch.
5
+ The last chunk of a dataset is usually smaller than the others, so the
6
+ model sees at least two different batch sizes. This benchmark segments
7
+ 2137 frames (1000 + 1000 + 137) with the exported dcnum test model and
8
+ the inductor caches disabled, so every repetition includes compiling the
9
+ model for every batch size it encounters.
10
+
11
+ Runs on the CPU, because the test model in the dcnum repository was
12
+ exported on the CPU (exported models only run on the device they were
13
+ exported for).
14
+ """
15
+ import pathlib
16
+ import tempfile
17
+ import zipfile
18
+
19
+ import h5py
20
+ import hdf5plugin # noqa: F401
21
+ import numpy as np
22
+ import torch
23
+
24
+ from dcnum.segm.segm_torch import SegmentTorchUNI, torch_model
25
+
26
+
27
+ here = pathlib.Path(__file__).parent
28
+ data_dir = here.parent / "tests" / "data"
29
+
30
+
31
+ def extract(zip_name, suffix):
32
+ tmp = pathlib.Path(tempfile.mkdtemp(prefix="bm_segm_torch_uni_"))
33
+ with zipfile.ZipFile(data_dir / zip_name) as zf:
34
+ zf.extractall(tmp)
35
+ return min(tmp.glob(f"*{suffix}"))
36
+
37
+
38
+ class Benchmark:
39
+ def __init__(self):
40
+ # compile from scratch in every repetition
41
+ torch._inductor.config.force_disable_caches = True
42
+ torch._dynamo.reset()
43
+ torch_model.cache_model.clear()
44
+
45
+ self.model_file = extract(
46
+ "segm-torch-model_unet-dcnum-test_g2_cb32a.zip", ".dcnm")
47
+ path_data = extract(
48
+ "fmt-hdf5_cytoshot_full-features_2024.zip", ".rtdc")
49
+ with h5py.File(path_data) as h5:
50
+ image = h5["events/image"][:]
51
+ num_frames = 2137
52
+ reps = num_frames // len(image) + 1
53
+ self.images = np.concatenate([image] * reps)[:num_frames]
54
+ self.device = "cpu"
55
+
56
+ def benchmark(self):
57
+ for start in range(0, len(self.images), 1000):
58
+ SegmentTorchUNI.segment_algorithm(
59
+ self.images[start:start + 1000],
60
+ model_file=self.model_file,
61
+ backend="inductor",
62
+ device=self.device)
@@ -1,4 +1,5 @@
1
1
  """Base library for deformability cytometry postprocessing
2
+
2
3
  MIT License
3
4
 
4
5
  Copyright (c) 2023 Paul Müller
@@ -22,4 +23,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
23
  SOFTWARE.
23
24
  """
24
25
  # flake8: noqa: F401
26
+ from __future__ import annotations
27
+
25
28
  from ._version import __version__, __version_tuple__
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.31.2'
22
- __version_tuple__ = version_tuple = (0, 31, 2)
21
+ __version__ = version = '0.31.4'
22
+ __version_tuple__ = version_tuple = (0, 31, 4)
23
23
 
24
- __commit_id__ = commit_id = 'g848fedabb'
24
+ __commit_id__ = commit_id = 'gabf21d7a4'
@@ -1,4 +1,6 @@
1
1
  """Common helpers: lazy module loading, CPU counting, and worker handling"""
2
+ from __future__ import annotations
3
+
2
4
  from collections.abc import Callable
3
5
  import importlib
4
6
  import logging
@@ -33,12 +35,13 @@ class LazyLoader:
33
35
  structure:
34
36
 
35
37
  - ``module``
38
+
36
39
  - ``submod_1``
37
40
  - ``submod_2``
38
41
 
39
42
  If ``submod_1`` would like to lazily import ``submod_2``::
40
43
 
41
- submod_2 = LazyLoader("submod_2", sibling==__name__)
44
+ submod_2 = LazyLoader("submod_2", sibling=__name__)
42
45
  action_before_import: Callable
43
46
  Called before the import.
44
47
  action_after_import: Callable
@@ -118,7 +121,8 @@ def cpu_count() -> int:
118
121
  if hasattr(os, "sched_getaffinity"):
119
122
  cpu_affin = len(os.sched_getaffinity(0))
120
123
  elif hasattr(os, "process_cpu_count"):
121
- cpu_affin = os.process_cpu_count()
124
+ # Python 3.13+ (`hasattr` check above)
125
+ cpu_affin = os.process_cpu_count() # type: ignore
122
126
  else:
123
127
  cpu_affin = os.cpu_count()
124
128
  if cpu_affin is not None:
@@ -135,7 +139,28 @@ def join_worker(worker,
135
139
  retries=10,
136
140
  logger=None,
137
141
  name=None):
138
- """Patiently join a worker (Thread or Process)"""
142
+ """Patiently join a worker (Thread or Process)
143
+
144
+ Parameters
145
+ ----------
146
+ worker: threading.Thread or multiprocessing.Process
147
+ The worker to join; If it has a ``close`` method (processes),
148
+ it is called after joining.
149
+ timeout: float
150
+ Timeout in seconds for each join attempt
151
+ retries: int
152
+ Number of join attempts
153
+ logger: logging.Logger
154
+ Logger for status messages
155
+ name: str
156
+ Name of the worker used in log messages
157
+
158
+ Raises
159
+ ------
160
+ ValueError
161
+ If the worker could not be joined within ``timeout * retries``
162
+ seconds
163
+ """
139
164
  logger = logger or logging.getLogger(__name__)
140
165
  for _ in range(retries):
141
166
  worker.join(timeout=timeout)
@@ -28,6 +28,8 @@ License: BSD-3-Clause
28
28
  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
29
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
30
  """
31
+ from __future__ import annotations
32
+
31
33
  import numpy as np
32
34
 
33
35
 
@@ -1,4 +1,6 @@
1
1
  # flake8: noqa: F401
2
2
  """Feature computation"""
3
+ from __future__ import annotations
4
+
3
5
  from .queue_event_extractor import QueueEventExtractor
4
6
  from .gate import Gate
@@ -1,5 +1,7 @@
1
1
  # flake8: noqa: F401
2
2
  """Feature computation: background image data from image data"""
3
+ from __future__ import annotations
4
+
3
5
  from .base import Background, get_available_background_methods
4
6
  # Background methods are registered by importing them here.
5
7
  from .bg_copy import BackgroundCopy
@@ -1,4 +1,6 @@
1
1
  """Base class and helpers for background image computation"""
2
+ from __future__ import annotations
3
+
2
4
  import abc
3
5
  import functools
4
6
  import inspect
@@ -27,7 +29,7 @@ class Background(abc.ABC):
27
29
  ----------
28
30
  input_data: array-like or pathlib.Path
29
31
  The input data can be either a path to an HDF5 file with
30
- the "evtens/image" dataset or an array-like object that
32
+ the "events/image" dataset or an array-like object that
31
33
  behaves like an image stack (first axis enumerates events)
32
34
  output_path: pathlib.Path
33
35
  Path to the output file. If ``input_data`` is a path, you can
@@ -73,10 +75,10 @@ class Background(abc.ABC):
73
75
  self.hdin: HDF5Data | None = None
74
76
  """HDF5Data instance for input data"""
75
77
 
76
- self.h5in: h5py.File | None = None
78
+ self.h5in: h5py.File | None = None # type: ignore
77
79
  """input h5py.File"""
78
80
 
79
- self.h5out: h5py.File | None = None
81
+ self.h5out: h5py.File | None = None # type: ignore
80
82
  """output h5py.File"""
81
83
 
82
84
  self.paths_ref = []
@@ -101,7 +103,11 @@ class Background(abc.ABC):
101
103
  # because HDF5Data properly resolves basins and the image
102
104
  # feature might be in a basin.
103
105
  self.hdin = HDF5Data(self.h5in, md5_5m=md5_5m)
104
- self.input_data = self.hdin.image.h5ds
106
+ image = self.hdin.image
107
+ if image is None:
108
+ raise ValueError(f"The input data {input_data} do not "
109
+ f"contain the 'image' feature")
110
+ self.input_data = image.h5ds
105
111
  else:
106
112
  self.input_data = input_data
107
113
 
@@ -149,7 +155,7 @@ class Background(abc.ABC):
149
155
  be backwards-compatible (future versions of dcnum will
150
156
  correctly acknowledge the ID).
151
157
 
152
- The segmenter pipeline ID is defined as::
158
+ The background pipeline ID is defined as::
153
159
 
154
160
  KEY:KW_BACKGROUND
155
161
 
@@ -175,8 +181,7 @@ class Background(abc.ABC):
175
181
  if cls is Background:
176
182
  raise ValueError("Cannot get `key` for `Background` base class!")
177
183
  key = cls.__name__.lower()
178
- if key.startswith("background"):
179
- key = key[10:]
184
+ key = key.removeprefix("background")
180
185
  return key
181
186
 
182
187
  @classmethod
@@ -184,7 +189,7 @@ class Background(abc.ABC):
184
189
  """Return the PPID based on given keyword arguments for a subclass"""
185
190
  code = cls.get_ppid_code()
186
191
  cback = ppid.kwargs_to_ppid(cls, "check_user_kwargs", kwargs)
187
- return ":".join([code, cback])
192
+ return f"{code}:{cback}"
188
193
 
189
194
  @staticmethod
190
195
  def get_ppkw_from_ppid(bg_ppid):
@@ -216,6 +221,7 @@ class Background(abc.ABC):
216
221
  "bg_off" features defined in the output file ``self.h5out``.
217
222
  """
218
223
  t0 = time.perf_counter()
224
+ assert self.h5out is not None
219
225
 
220
226
  # Delete any old background data
221
227
  for ds_key in ["image_bg", "bg_off"]:
@@ -1,4 +1,6 @@
1
1
  """Background "computation" by copying existing background data"""
2
+ from __future__ import annotations
3
+
2
4
  from ...common import h5py
3
5
  from ...write import HDF5Writer
4
6
  from .base import Background
@@ -24,11 +26,12 @@ class BackgroundCopy(Background):
24
26
  for ii, bn_dict in enumerate(self.hdin.basins):
25
27
  if "image_bg" in bn_dict["features"]:
26
28
  # load the basin data
27
- h5group, features, mapping = self.hdin.get_basin_data(ii)
28
- if isinstance(mapping, (int, slice, list)):
29
- raise NotImplementedError(
30
- f"Image data mapping for {type(mapping)} "
31
- f"not supported yet")
29
+ h5group, _features, mapping = self.hdin.get_basin_data(ii)
30
+ if h5group is None:
31
+ bn_name = bn_dict.get("name")
32
+ raise ValueError(
33
+ f"Could not access the basin {bn_name} that "
34
+ f"contains 'image_bg'")
32
35
  with HDF5Writer(self.h5out) as hw:
33
36
  hw.store_basin(
34
37
  name=bn_dict["name"],