dcnum 0.16.8__tar.gz → 0.17.1__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.

Potentially problematic release.


This version of dcnum might be problematic. Click here for more details.

Files changed (98) hide show
  1. {dcnum-0.16.8 → dcnum-0.17.1}/CHANGELOG +13 -0
  2. {dcnum-0.16.8 → dcnum-0.17.1}/PKG-INFO +1 -1
  3. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/_version.py +2 -2
  4. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_background/base.py +0 -8
  5. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/gate.py +0 -7
  6. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/queue_event_extractor.py +1 -19
  7. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/meta/__init__.py +1 -0
  8. dcnum-0.17.1/src/dcnum/meta/paths.py +30 -0
  9. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/meta/ppid.py +2 -9
  10. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/read/const.py +2 -3
  11. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/read/hdf5_data.py +0 -14
  12. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/segm/segm_thresh.py +4 -0
  13. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/segm/segmenter.py +2 -10
  14. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/segm/segmenter_gpu.py +0 -6
  15. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum.egg-info/PKG-INFO +1 -1
  16. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum.egg-info/SOURCES.txt +9 -7
  17. dcnum-0.17.1/tests/test_meta_paths.py +42 -0
  18. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_read_hdf5.py +4 -1
  19. {dcnum-0.16.8 → dcnum-0.17.1}/.github/workflows/check.yml +0 -0
  20. {dcnum-0.16.8 → dcnum-0.17.1}/.github/workflows/deploy_pypi.yml +0 -0
  21. {dcnum-0.16.8 → dcnum-0.17.1}/.gitignore +0 -0
  22. {dcnum-0.16.8 → dcnum-0.17.1}/.readthedocs.yml +0 -0
  23. {dcnum-0.16.8 → dcnum-0.17.1}/LICENSE +0 -0
  24. {dcnum-0.16.8 → dcnum-0.17.1}/README.rst +0 -0
  25. {dcnum-0.16.8 → dcnum-0.17.1}/docs/conf.py +0 -0
  26. {dcnum-0.16.8 → dcnum-0.17.1}/docs/extensions/github_changelog.py +0 -0
  27. {dcnum-0.16.8 → dcnum-0.17.1}/docs/index.rst +0 -0
  28. {dcnum-0.16.8 → dcnum-0.17.1}/docs/requirements.txt +0 -0
  29. {dcnum-0.16.8 → dcnum-0.17.1}/pyproject.toml +0 -0
  30. {dcnum-0.16.8 → dcnum-0.17.1}/setup.cfg +0 -0
  31. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/__init__.py +0 -0
  32. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/__init__.py +0 -0
  33. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/event_extractor_manager_thread.py +0 -0
  34. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_background/__init__.py +0 -0
  35. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_background/bg_copy.py +0 -0
  36. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_background/bg_roll_median.py +0 -0
  37. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_background/bg_sparse_median.py +0 -0
  38. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_brightness/__init__.py +0 -0
  39. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_brightness/bright_all.py +0 -0
  40. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_brightness/common.py +0 -0
  41. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_moments/__init__.py +0 -0
  42. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_moments/ct_opencv.py +0 -0
  43. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_moments/mt_legacy.py +0 -0
  44. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_texture/__init__.py +0 -0
  45. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_texture/common.py +0 -0
  46. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/feat/feat_texture/tex_all.py +0 -0
  47. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/logic/__init__.py +0 -0
  48. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/logic/ctrl.py +0 -0
  49. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/logic/job.py +0 -0
  50. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/logic/json_encoder.py +0 -0
  51. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/read/__init__.py +0 -0
  52. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/read/cache.py +0 -0
  53. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/segm/__init__.py +0 -0
  54. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/segm/segmenter_cpu.py +0 -0
  55. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/segm/segmenter_manager_thread.py +0 -0
  56. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/write/__init__.py +0 -0
  57. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/write/deque_writer_thread.py +0 -0
  58. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/write/queue_collector_thread.py +0 -0
  59. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum/write/writer.py +0 -0
  60. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum.egg-info/dependency_links.txt +0 -0
  61. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum.egg-info/requires.txt +0 -0
  62. {dcnum-0.16.8 → dcnum-0.17.1}/src/dcnum.egg-info/top_level.txt +0 -0
  63. {dcnum-0.16.8 → dcnum-0.17.1}/tests/conftest.py +0 -0
  64. {dcnum-0.16.8 → dcnum-0.17.1}/tests/data/fmt-hdf5_cytoshot_extended-moments-features.zip +0 -0
  65. {dcnum-0.16.8 → dcnum-0.17.1}/tests/data/fmt-hdf5_cytoshot_full-features_2023.zip +0 -0
  66. {dcnum-0.16.8 → dcnum-0.17.1}/tests/data/fmt-hdf5_cytoshot_full-features_legacy_allev_2023.zip +0 -0
  67. {dcnum-0.16.8 → dcnum-0.17.1}/tests/data/fmt-hdf5_shapein_empty.zip +0 -0
  68. {dcnum-0.16.8 → dcnum-0.17.1}/tests/data/fmt-hdf5_shapein_raw-with-variable-length-logs.zip +0 -0
  69. {dcnum-0.16.8 → dcnum-0.17.1}/tests/helper_methods.py +0 -0
  70. {dcnum-0.16.8 → dcnum-0.17.1}/tests/requirements.txt +0 -0
  71. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_feat_background_base.py +0 -0
  72. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_feat_background_bg_copy.py +0 -0
  73. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_feat_background_bg_roll_median.py +0 -0
  74. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_feat_background_bg_sparsemed.py +0 -0
  75. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_feat_brightness.py +0 -0
  76. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_feat_event_extractor_manager.py +0 -0
  77. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_feat_gate.py +0 -0
  78. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_feat_haralick.py +0 -0
  79. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_feat_moments_based.py +0 -0
  80. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_feat_moments_based_extended.py +0 -0
  81. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_init.py +0 -0
  82. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_logic_job.py +0 -0
  83. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_logic_join.py +0 -0
  84. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_logic_json.py +0 -0
  85. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_logic_pipeline.py +0 -0
  86. /dcnum-0.16.8/tests/test_ppid.py → /dcnum-0.17.1/tests/test_meta_ppid_base.py +0 -0
  87. /dcnum-0.16.8/tests/test_ppid_bg.py → /dcnum-0.17.1/tests/test_meta_ppid_bg.py +0 -0
  88. /dcnum-0.16.8/tests/test_ppid_data.py → /dcnum-0.17.1/tests/test_meta_ppid_data.py +0 -0
  89. /dcnum-0.16.8/tests/test_ppid_feat.py → /dcnum-0.17.1/tests/test_meta_ppid_feat.py +0 -0
  90. /dcnum-0.16.8/tests/test_ppid_gate.py → /dcnum-0.17.1/tests/test_meta_ppid_gate.py +0 -0
  91. /dcnum-0.16.8/tests/test_ppid_segm.py → /dcnum-0.17.1/tests/test_meta_ppid_segm.py +0 -0
  92. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_read_basin.py +0 -0
  93. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_read_concat_hdf5.py +0 -0
  94. /dcnum-0.16.8/tests/test_segmenter.py → /dcnum-0.17.1/tests/test_segm_base.py +0 -0
  95. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_segm_thresh.py +0 -0
  96. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_write_deque_writer_thread.py +0 -0
  97. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_write_queue_collector_thread.py +0 -0
  98. {dcnum-0.16.8 → dcnum-0.17.1}/tests/test_write_writer.py +0 -0
@@ -1,3 +1,16 @@
1
+ 0.17.1
2
+ - ref: remove "bg_med" and "index_online" from protected scalar features,
3
+ because "bg_med" may change due to a different background computation
4
+ method and "index_online" enumerates events from online segmentation
5
+ 0.17.0
6
+ - feat: allow to register topical search paths
7
+ - ref: remove deprecated `get_ppid_from_kwargs` methods
8
+ - ref: remove deprecated `preselect` and `ptp_median` keyword
9
+ arguments from `QueueEventExtractor`
10
+ - ref: remove deprecated "key" from `get_class_method_info` info dict
11
+ - ref: issue UserWarning instead of DeprecationWarning when
12
+ - ref: remove pixel size check for HDF5 data
13
+ - ref: remove unused `_get_model_file` from GPUSegmenter
1
14
  0.16.8
2
15
  - fix: correctly set number of workers for CPUSegmenter
3
16
  - enh: update list of environment variables that should be set to
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcnum
3
- Version: 0.16.8
3
+ Version: 0.17.1
4
4
  Summary: numerics toolbox for imaging deformability cytometry
5
5
  Author: Maximilian Schlögel, Paul Müller
6
6
  Maintainer-email: Paul Müller <dev@craban.de>
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.16.8'
16
- __version_tuple__ = version_tuple = (0, 16, 8)
15
+ __version__ = version = '0.17.1'
16
+ __version_tuple__ = version_tuple = (0, 17, 1)
@@ -4,7 +4,6 @@ import inspect
4
4
  import multiprocessing as mp
5
5
  import pathlib
6
6
  import uuid
7
- import warnings
8
7
 
9
8
  import h5py
10
9
  import numpy as np
@@ -212,13 +211,6 @@ class Background(abc.ABC):
212
211
  def process_approach(self):
213
212
  """The actual background computation approach"""
214
213
 
215
- @classmethod
216
- def get_ppid_from_kwargs(cls, kwargs):
217
- warnings.warn(
218
- "Please use get_ppid_from_ppkw instead of get_ppid_from_kwargs",
219
- DeprecationWarning)
220
- return cls.get_ppid_from_ppkw(kwargs)
221
-
222
214
 
223
215
  @functools.cache
224
216
  def get_available_background_methods():
@@ -139,13 +139,6 @@ class Gate:
139
139
  ppid=pp_gate_kwargs)
140
140
  return kwargs
141
141
 
142
- @classmethod
143
- def get_ppid_from_kwargs(cls, kwargs):
144
- warnings.warn(
145
- "Please use get_ppid_from_ppkw instead of get_ppid_from_kwargs",
146
- DeprecationWarning)
147
- return cls.get_ppid_from_ppkw(kwargs)
148
-
149
142
  def gate_event(self, event):
150
143
  """Return None if the event should not be used, else `event`"""
151
144
  if self.box_gates and event:
@@ -7,7 +7,6 @@ import os
7
7
  import queue
8
8
  import threading
9
9
  import traceback
10
- import warnings
11
10
 
12
11
  import numpy as np
13
12
 
@@ -126,8 +125,7 @@ class QueueEventExtractor:
126
125
  num_extractors: int,
127
126
  log_queue: mp.Queue,
128
127
  log_level: int = logging.INFO,
129
- preselect: None = None,
130
- ptp_median: None = None):
128
+ ):
131
129
  """Get initialization arguments for :cass:`.QueueEventExtractor`
132
130
 
133
131
  This method was created for convenience reasons:
@@ -147,8 +145,6 @@ class QueueEventExtractor:
147
145
  Queue the worker uses for sending log messages
148
146
  log_level: int
149
147
  Logging level to use in the worker process
150
- preselect, ptp_median:
151
- Deprecated
152
148
 
153
149
  Returns
154
150
  -------
@@ -160,13 +156,6 @@ class QueueEventExtractor:
160
156
  # queue with event-wise feature dictionaries
161
157
  event_queue = mp_spawn.Queue()
162
158
 
163
- if preselect is not None:
164
- warnings.warn("The `preselect` argument is deprecated!",
165
- DeprecationWarning)
166
- if ptp_median is not None:
167
- warnings.warn("The `ptp_median` argument is deprecated!",
168
- DeprecationWarning)
169
-
170
159
  # Note that the order must be identical to __init__
171
160
  args = collections.OrderedDict()
172
161
  args["data"] = data
@@ -382,13 +371,6 @@ class QueueEventExtractor:
382
371
  self.log_queue.close()
383
372
  self.log_queue.join_thread()
384
373
 
385
- @classmethod
386
- def get_ppid_from_kwargs(cls, kwargs):
387
- warnings.warn(
388
- "Please use get_ppid_from_ppkw instead of get_ppid_from_kwargs",
389
- DeprecationWarning)
390
- return cls.get_ppid_from_ppkw(kwargs)
391
-
392
374
 
393
375
  class EventExtractorProcess(QueueEventExtractor, mp_spawn.Process):
394
376
  """Multiprocessing worker for regular segmentation and extraction"""
@@ -1,2 +1,3 @@
1
1
  # flake8: noqa: F401
2
+ from . import paths
2
3
  from . import ppid
@@ -0,0 +1,30 @@
1
+ import pathlib
2
+
3
+ search_path_registry = {}
4
+
5
+
6
+ def register_search_path(topic: str,
7
+ search_path: str | pathlib.Path):
8
+ """Register a search path for a given topic
9
+
10
+ Search paths are a global solution for organizing the locations
11
+ of resources that are part of an analysis pipeline. For instance,
12
+ if the location of such a file that depends on where your pipeline is
13
+ running, you can register multiple search paths and the file will
14
+ be found using :func:`find_file`.
15
+ """
16
+ topic_list = search_path_registry.setdefault(topic, [])
17
+ topic_list.append(pathlib.Path(search_path))
18
+
19
+
20
+ def find_file(topic: str,
21
+ file_name: str):
22
+ """Find a file in the search path for the given topic"""
23
+ search_paths = search_path_registry.get(topic, [])
24
+ for pp in search_paths:
25
+ pf = pp / file_name
26
+ if pf.is_file():
27
+ return pf
28
+ else:
29
+ raise KeyError(f"Could not find {file_name} for {topic} in the "
30
+ f"registered search paths {search_paths}")
@@ -71,14 +71,8 @@ def get_class_method_info(class_obj: ClassWithPPIDCapabilities,
71
71
  are extracted.
72
72
  """
73
73
  doc = class_obj.__doc__ or class_obj.__init__.__doc__
74
- if hasattr(class_obj, "key"):
75
- warnings.warn(f"{class_obj.__class__} implements `key` which is "
76
- f"deprecated. Please rename to `get_ppid_code`.",
77
- DeprecationWarning)
78
- setattr(class_obj, "get_ppid_code", class_obj.key)
79
74
  info = {
80
75
  "code": class_obj.get_ppid_code(),
81
- "key": class_obj.get_ppid_code(), # Deprecated
82
76
  "doc": doc,
83
77
  "title": doc.split("\n")[0],
84
78
  }
@@ -116,11 +110,10 @@ def kwargs_to_ppid(cls: ClassWithPPIDCapabilities,
116
110
  f"segmenter and had to implement `__init__`, make sure "
117
111
  f"that it accepts all kwonly-arguments its super class "
118
112
  f"accepts. If this is not the case, you are probably "
119
- f"passing bad kwargs to the segmenter!"
113
+ f"passing invalid kwargs to the segmenter."
120
114
  )
121
115
  if allow_invalid_keys:
122
- warnings.warn(msg + " Please cleanup your code!",
123
- DeprecationWarning)
116
+ warnings.warn(msg, UserWarning)
124
117
  else:
125
118
  raise KeyError(msg)
126
119
  kwannot = info["annotations"][method]
@@ -1,10 +1,9 @@
1
- #: Scalar features that apply to all events in a frame
1
+ #: Scalar features that apply to all events in a frame and which are
2
+ #: not computed from image or image_bg data.
2
3
  PROTECTED_FEATURES = [
3
- "bg_med",
4
4
  "flow_rate",
5
5
  "frame",
6
6
  "g_force",
7
- "index_online",
8
7
  "pressure",
9
8
  "temp",
10
9
  "temp_amb",
@@ -162,20 +162,6 @@ class HDF5Data:
162
162
 
163
163
  if state["pixel_size"] is not None:
164
164
  self.pixel_size = state["pixel_size"]
165
- else:
166
- # Set known pixel size if possible
167
- did = self.meta.get("setup:identifier", "EMPTY")
168
- if (did.startswith("RC-")
169
- and (self.pixel_size < 0.255 or self.pixel_size > 0.275)):
170
- warnings.warn(
171
- f"Correcting for invalid pixel size in '{self.path}'!")
172
- warnings.warn(
173
- "Correcting the pixel size is deprecated in dcnum; please "
174
- "make sure your input data are clean before processing",
175
- DeprecationWarning
176
- )
177
- # Set default pixel size for Rivercyte devices
178
- self.pixel_size = 0.2645
179
165
 
180
166
  self.image_cache_size = state["image_cache_size"]
181
167
 
@@ -15,6 +15,10 @@ class SegmentThresh(CPUSegmenter):
15
15
 
16
16
  Parameters
17
17
  ----------
18
+ thresh: int
19
+ grayscale threhold value for creating the mask image;
20
+ For a background-corrected image, pixels with values below
21
+ this value are considered to be part of the mask.
18
22
  """
19
23
  super(SegmentThresh, self).__init__(thresh=thresh, *args, **kwargs)
20
24
 
@@ -4,7 +4,6 @@ import functools
4
4
  import inspect
5
5
  import logging
6
6
  from typing import Dict
7
- import warnings
8
7
 
9
8
  import cv2
10
9
  import numpy as np
@@ -132,10 +131,10 @@ class Segmenter(abc.ABC):
132
131
  # Start with the default mask kwargs defined for this subclass
133
132
  kwargs_mask_used = copy.deepcopy(cls.mask_default_kwargs)
134
133
  kwargs_mask_used.update(kwargs_mask)
135
- key = cls.get_ppid_code()
134
+ code = cls.get_ppid_code()
136
135
  csegm = kwargs_to_ppid(cls, "segment_approach", kwargs)
137
136
  cmask = kwargs_to_ppid(cls, "process_mask", kwargs_mask_used)
138
- return ":".join([key, csegm, cmask])
137
+ return ":".join([code, csegm, cmask])
139
138
 
140
139
  @staticmethod
141
140
  def get_ppkw_from_ppid(segm_ppid):
@@ -280,13 +279,6 @@ class Segmenter(abc.ABC):
280
279
  def segment_batch(self, data, start=None, stop=None):
281
280
  """Return the integer labels for an entire batch"""
282
281
 
283
- @classmethod
284
- def get_ppid_from_kwargs(cls, *args, **kwargs):
285
- warnings.warn(
286
- "Please use get_ppid_from_ppkw instead of get_ppid_from_kwargs.",
287
- DeprecationWarning)
288
- return cls.get_ppid_from_ppkw(*args, **kwargs)
289
-
290
282
 
291
283
  @functools.cache
292
284
  def get_available_segmenters():
@@ -1,5 +1,4 @@
1
1
  import abc
2
- import pathlib
3
2
  from typing import Dict
4
3
 
5
4
  import numpy as np
@@ -39,11 +38,6 @@ class GPUSegmenter(Segmenter, abc.ABC):
39
38
  debug=debug,
40
39
  **kwargs)
41
40
 
42
- @staticmethod
43
- def _get_model_path(model_file):
44
- """Custom hook that may be defined by subclasses"""
45
- return pathlib.Path(model_file)
46
-
47
41
  def segment_batch(self,
48
42
  image_data: np.ndarray,
49
43
  start: int = None,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dcnum
3
- Version: 0.16.8
3
+ Version: 0.17.1
4
4
  Summary: numerics toolbox for imaging deformability cytometry
5
5
  Author: Maximilian Schlögel, Paul Müller
6
6
  Maintainer-email: Paul Müller <dev@craban.de>
@@ -40,6 +40,7 @@ src/dcnum/logic/ctrl.py
40
40
  src/dcnum/logic/job.py
41
41
  src/dcnum/logic/json_encoder.py
42
42
  src/dcnum/meta/__init__.py
43
+ src/dcnum/meta/paths.py
43
44
  src/dcnum/meta/ppid.py
44
45
  src/dcnum/read/__init__.py
45
46
  src/dcnum/read/cache.py
@@ -73,17 +74,18 @@ tests/test_logic_job.py
73
74
  tests/test_logic_join.py
74
75
  tests/test_logic_json.py
75
76
  tests/test_logic_pipeline.py
76
- tests/test_ppid.py
77
- tests/test_ppid_bg.py
78
- tests/test_ppid_data.py
79
- tests/test_ppid_feat.py
80
- tests/test_ppid_gate.py
81
- tests/test_ppid_segm.py
77
+ tests/test_meta_paths.py
78
+ tests/test_meta_ppid_base.py
79
+ tests/test_meta_ppid_bg.py
80
+ tests/test_meta_ppid_data.py
81
+ tests/test_meta_ppid_feat.py
82
+ tests/test_meta_ppid_gate.py
83
+ tests/test_meta_ppid_segm.py
82
84
  tests/test_read_basin.py
83
85
  tests/test_read_concat_hdf5.py
84
86
  tests/test_read_hdf5.py
87
+ tests/test_segm_base.py
85
88
  tests/test_segm_thresh.py
86
- tests/test_segmenter.py
87
89
  tests/test_write_deque_writer_thread.py
88
90
  tests/test_write_queue_collector_thread.py
89
91
  tests/test_write_writer.py
@@ -0,0 +1,42 @@
1
+ import pytest
2
+
3
+ from dcnum.meta import paths
4
+
5
+
6
+ @pytest.fixture(autouse=True)
7
+ def clear_search_paths():
8
+ paths.search_path_registry.clear()
9
+
10
+
11
+ def test_find_file_in_path(tmp_path):
12
+ file = tmp_path / "myfile.txt"
13
+ file.touch()
14
+ # register a search path
15
+ paths.register_search_path("hans", tmp_path)
16
+ act = paths.find_file("hans", file.name)
17
+ assert str(act.resolve()) == str(file.resolve())
18
+
19
+
20
+ def test_find_file_in_path_multiple(tmp_path):
21
+ dir1 = tmp_path / "foo"
22
+ dir2 = tmp_path / "bar"
23
+ file = dir2 / "myfile.txt"
24
+ dir1.mkdir()
25
+ dir2.mkdir()
26
+ file.touch()
27
+ # register a search path
28
+ paths.register_search_path("mantra", dir1)
29
+ paths.register_search_path("mantra", dir2)
30
+ act = paths.find_file("mantra", file.name)
31
+ assert str(act.resolve()) == str(file.resolve())
32
+
33
+
34
+ def test_find_file_in_path_not_found(tmp_path):
35
+ # find non-existent file
36
+ with pytest.raises(KeyError, match="Could not find"):
37
+ paths.find_file("peter", "myfile.txt")
38
+
39
+ # register a search path
40
+ paths.register_search_path("hans", tmp_path / "does_not_exist")
41
+ with pytest.raises(KeyError, match="Could not find"):
42
+ paths.find_file("hans", "myfile.txt")
@@ -201,7 +201,10 @@ def test_open_real_data():
201
201
 
202
202
  # scalar features
203
203
  fsc = h5dat.features_scalar_frame
204
- exp = ['bg_med', 'frame', 'time']
204
+ # Changed in version 0.17.1: bg_med is not returned anymore,
205
+ # because it is computed from the background image which
206
+ # depends on the background method employed.
207
+ exp = ['frame', 'time']
205
208
  assert set(fsc) == set(exp)
206
209
 
207
210
  # feature names
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes