dclab 0.64.3__cp310-cp310-macosx_10_9_x86_64.whl → 0.66.0__cp310-cp310-macosx_10_9_x86_64.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.

Potentially problematic release.


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

dclab/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.64.3'
21
- __version_tuple__ = version_tuple = (0, 64, 3)
20
+ __version__ = version = '0.66.0'
21
+ __version_tuple__ = version_tuple = (0, 66, 0)
Binary file
@@ -741,7 +741,9 @@ class RTDCBase(abc.ABC):
741
741
  # need the referring dataset.
742
742
  "mapping_referrer": self,
743
743
  # Make sure the measurement identifier is checked.
744
- "measurement_identifier": self.get_measurement_identifier(),
744
+ "referrer_identifier": self.get_measurement_identifier(),
745
+ # Make sure the basin identifier is checked.
746
+ "basin_identifier": bdict.get("identifier"),
745
747
  # allow to ignore basins
746
748
  "ignored_basins": bd_keys,
747
749
  # basin key
@@ -334,8 +334,8 @@ class Export(object):
334
334
  # Define a new measurement identifier, so that we are not running
335
335
  # into any problems with basins being defined for filtered data.
336
336
  ds_run_id = ds.get_measurement_identifier()
337
- random_ap = str(uuid.uuid4())[:4]
338
- meta["experiment"]["run identifier"] = f"{ds_run_id}-{random_ap}"
337
+ random_ap = f"dclab-{str(uuid.uuid4())[:7]}"
338
+ meta["experiment"]["run identifier"] = f"{ds_run_id}_{random_ap}"
339
339
 
340
340
  if filtered:
341
341
  filter_arr = ds.filter.all
@@ -438,7 +438,6 @@ class Export(object):
438
438
  if progress_callback:
439
439
  progress_callback(1 - 1 / (len(features) or 1),
440
440
  "writing basins")
441
-
442
441
  # We have to store basins. There are three options:
443
442
  # - filtering disabled: just copy basins
444
443
  # - filtering enabled
@@ -450,6 +449,8 @@ class Export(object):
450
449
  basin_list = [bn.as_dict() for bn in ds.basins]
451
450
  # In addition to the upstream basins, also store a reference
452
451
  # to the original file from which the export was done.
452
+ # Get the identifier of the current dataset for the new basins.
453
+ basin_id = ds.get_measurement_identifier()
453
454
  if ds.format in get_basin_classes():
454
455
  # The dataset has a format that matches a basin format
455
456
  # directly.
@@ -464,6 +465,7 @@ class Export(object):
464
465
  "basin_format": ds.format,
465
466
  "basin_locs": basin_locs,
466
467
  "basin_descr": f"Exported with dclab {version}",
468
+ "basin_id": basin_id,
467
469
  })
468
470
  elif (ds.format == "hierarchy"
469
471
  and ds.get_root_parent().format in get_basin_classes()):
@@ -497,6 +499,7 @@ class Export(object):
497
499
  child=ds,
498
500
  child_indices=np.arange(len(ds))
499
501
  ),
502
+ "basin_id": basin_id,
500
503
  })
501
504
 
502
505
  for bn_dict in basin_list:
@@ -176,7 +176,8 @@ class Basin(abc.ABC):
176
176
  name: str = None,
177
177
  description: str = None,
178
178
  features: List[str] = None,
179
- measurement_identifier: str = None,
179
+ referrer_identifier: str = None,
180
+ basin_identifier: str = None,
180
181
  mapping: Literal["same",
181
182
  "basinmap0",
182
183
  "basinmap1",
@@ -208,10 +209,18 @@ class Basin(abc.ABC):
208
209
  features: list of str
209
210
  List of features this basin provides; This list is enforced,
210
211
  even if the basin actually contains more features.
211
- measurement_identifier: str
212
+ referrer_identifier: str
212
213
  A measurement identifier against which to check the basin.
214
+ If the basin mapping is "same", then this must match the
215
+ identifier of the basin exactly, otherwise it must start
216
+ with the basin identifier (e.g. "basin-id_referrer-sub-id").
213
217
  If this is set to None (default), there is no certainty
214
218
  that the downstream dataset is from the same measurement.
219
+ basin_identifier: str
220
+ A measurement identifier that must match the basin exactly.
221
+ In contrast to `referrer_identifier`, the basin identifier is
222
+ the identifier of the basin file. If `basin_identifier` is
223
+ specified, the identifier of the basin must be identical to it.
215
224
  mapping: str
216
225
  Which type of mapping to use. This can be either "same"
217
226
  when the event list of the basin is identical to that
@@ -261,8 +270,9 @@ class Basin(abc.ABC):
261
270
  # features this basin provides
262
271
  self._features = features
263
272
  #: measurement identifier of the referencing dataset
264
- self.measurement_identifier = measurement_identifier
265
- self._measurement_identifier_verified = False
273
+ self.referrer_identifier = referrer_identifier
274
+ self.basin_identifier = basin_identifier or None
275
+ self._identifiers_verification = None
266
276
  #: ignored basins
267
277
  self.ignored_basins = ignored_basins or []
268
278
  #: additional keyword arguments passed to the basin
@@ -304,13 +314,13 @@ class Basin(abc.ABC):
304
314
 
305
315
  return f"<{self.__class__.__name__} ({opt_str}) at {hex(id(self))}>"
306
316
 
307
- def _assert_measurement_identifier(self):
317
+ def _assert_referrer_identifier(self):
308
318
  """Make sure the basin matches the measurement identifier
309
319
  """
310
320
  if not self.verify_basin(run_identifier=True):
311
321
  raise KeyError(f"Measurement identifier of basin {self.ds} "
312
322
  f"({self.get_measurement_identifier()}) does "
313
- f"not match {self.measurement_identifier}!")
323
+ f"not match {self.referrer_identifier}!")
314
324
 
315
325
  @property
316
326
  def basinmap(self):
@@ -410,7 +420,7 @@ class Basin(abc.ABC):
410
420
 
411
421
  def get_feature_data(self, feat):
412
422
  """Return an object representing feature data of the basin"""
413
- self._assert_measurement_identifier()
423
+ self._assert_referrer_identifier()
414
424
  return self.ds[feat]
415
425
 
416
426
  def get_measurement_identifier(self):
@@ -455,20 +465,30 @@ class Basin(abc.ABC):
455
465
  # Only check for run identifier if requested and if the availability
456
466
  # check did not fail.
457
467
  if run_identifier and check_avail:
458
- if not self._measurement_identifier_verified:
459
- if self.measurement_identifier is None:
468
+ if self._identifiers_verification is None:
469
+ # This is the measurement identifier of the basin.
470
+ basin_identifier = self.get_measurement_identifier()
471
+
472
+ # Perform a sanity check for the basin identifier.
473
+ if (self.basin_identifier
474
+ and self.basin_identifier != basin_identifier):
475
+ # We should not proceed any further with this basin.
476
+ self._identifiers_verification = False
477
+ warnings.warn(
478
+ f"Basin identifier mismatch for {self}. Expected "
479
+ f"'{self.basin_identifier}', got '{basin_identifier}'")
480
+
481
+ if self.referrer_identifier is None:
460
482
  # No measurement identifier was presented by the
461
483
  # referencing dataset. We are in the dark.
462
484
  # Don't perform any checks.
463
- self._measurement_identifier_verified = True
485
+ self._identifiers_verification = True
464
486
  else:
465
- # This is the measurement identifier of the basin.
466
- basin_identifier = self.get_measurement_identifier()
467
487
  if basin_identifier is None:
468
488
  # Again, we are in the dark, because the basin dataset
469
489
  # does not have an identifier. This is an undesirable
470
490
  # situation, but there is nothing we can do about it.
471
- self._measurement_identifier_verified = True
491
+ self._identifiers_verification = True
472
492
  else:
473
493
  if self.mapping == "same":
474
494
  # When we have identical mapping, then the
@@ -479,10 +499,10 @@ class Basin(abc.ABC):
479
499
  # data), then the measurement identifier has to
480
500
  # partially match.
481
501
  verifier = str.startswith
482
- self._measurement_identifier_verified = verifier(
483
- self.measurement_identifier, basin_identifier)
502
+ self._identifiers_verification = verifier(
503
+ self.referrer_identifier, basin_identifier)
484
504
 
485
- check_rid = self._measurement_identifier_verified
505
+ check_rid = self._identifiers_verification
486
506
  else:
487
507
  check_rid = True
488
508
 
@@ -207,6 +207,7 @@ class RTDCWriter:
207
207
  basin_descr: str | None = None,
208
208
  basin_feats: List[str] = None,
209
209
  basin_map: np.ndarray | Tuple[str, np.ndarray] = None,
210
+ basin_id: str = None,
210
211
  internal_data: Dict | h5py.Group = None,
211
212
  verify: bool = True,
212
213
  perishable: bool = False,
@@ -243,6 +244,12 @@ class RTDCWriter:
243
244
  a case, you may specify a tuple `(feature_name, mapping_array)`
244
245
  where `feature_name` is the explicit mapping name, e.g.
245
246
  `"basinmap3"`.
247
+ basin_id: str
248
+ Identifier of the basin. This is the string returned by
249
+ :meth:`.RTDCBase.get_measurement_identifier`. This is
250
+ a unique string that identifies the data within a basin.
251
+ If not specified and `verify=True`, this value is automatically
252
+ taken from the basin file.
246
253
  internal_data: dict or instance of h5py.Group
247
254
  A dictionary or an `h5py.Group` containing the basin data.
248
255
  The data are copied to the "basin_events" group, if
@@ -310,19 +317,30 @@ class RTDCWriter:
310
317
  # We have to import this here to avoid circular imports
311
318
  from .load import new_dataset
312
319
  # Make sure the basin can be opened by dclab, verify its ID
313
- cur_id = self.h5file.attrs.get("experiment:run identifier")
320
+ ref_id = self.h5file.attrs.get("experiment:run identifier")
314
321
  for loc in basin_locs:
315
322
  with new_dataset(loc) as ds:
316
323
  # We can open the file, which is great.
317
- if cur_id:
318
- # Compare the IDs.
319
- ds_id = ds.get_measurement_identifier()
320
- if not (ds_id == cur_id
324
+ # Compare the IDs.
325
+ bn_id = ds.get_measurement_identifier()
326
+ # Check whether `basin_id` matches the actual basin
327
+ if basin_id:
328
+ if basin_id != bn_id:
329
+ raise ValueError(
330
+ f"Measurement identifier mismatch for "
331
+ f"{loc}: got {bn_id}, expected {basin_id=})!")
332
+ else:
333
+ # If `basin_id` was not specified, set it here for
334
+ # user convenience.
335
+ basin_id = bn_id or None
336
+ # Check whether the referrer ID matches the basin ID.
337
+ if ref_id:
338
+ if not (bn_id == ref_id
321
339
  or (basin_map is not None
322
- and cur_id.startswith(ds_id))):
340
+ and ref_id.startswith(bn_id))):
323
341
  raise ValueError(
324
342
  f"Measurement identifier mismatch between "
325
- f"{self.path} ({cur_id}) and {loc} ({ds_id})!")
343
+ f"{self.path} ({ref_id}) and {loc} ({bn_id})!")
326
344
  if basin_feats:
327
345
  for feat in basin_feats:
328
346
  if not dfn.feature_exists(feat):
@@ -389,6 +407,7 @@ class RTDCWriter:
389
407
  "features": None if basin_feats is None else sorted(basin_feats),
390
408
  "mapping": basin_map_name,
391
409
  "perishable": perishable,
410
+ "identifier": basin_id,
392
411
  }
393
412
  if basin_type == "file":
394
413
  flocs = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dclab
3
- Version: 0.64.3
3
+ Version: 0.66.0
4
4
  Summary: Library for real-time deformability cytometry (RT-DC)
5
5
  Author: Benedikt Hartmann, Eoghan O'Connell, Maik Herbig, Maximilian Schlögel, Nadia Sbaa, Paul Müller, Philipp Rosendahl, Raghava Alajangi
6
6
  Maintainer-email: Paul Müller <dev@craban.de>
@@ -1,10 +1,10 @@
1
1
  dclab/kde_methods.py,sha256=f0-zDN7ETintvGB3gSzxwgBb53YtT9jZtzI70EAX50g,365
2
- dclab/_version.py,sha256=JHoO4OvpmaE3KGtpKkOT4qLarDtYaIQTa9jOD_gb43s,513
2
+ dclab/_version.py,sha256=LxUMbTNTE_mpL3yJaLLTdWd5Zvz3gifurvXDekNg0gY,513
3
3
  dclab/util.py,sha256=HFT5ZQV6AW8GIIruVMldukbVVdlMyKH50GUfOogAcxI,5860
4
4
  dclab/downsampling.pyx,sha256=OK7zbgGLl5gVyoU8ZBHo9EWwb8C9ChavmLNEvQvC9T0,7258
5
5
  dclab/__init__.py,sha256=wyJWhElQRPcq09vUqUnuquTU_KHgHxv6wQxuxQ988Iw,1583
6
6
  dclab/warn.py,sha256=MjJvyQeuvIXFQ2-fHDzbmXJ0scnHqqRJlIxfuLI_utE,523
7
- dclab/downsampling.cpython-310-darwin.so,sha256=uVwmmoSyetYTxgkALcsjBUHka4hbl4UonFVeKmRFIQE,237696
7
+ dclab/downsampling.cpython-310-darwin.so,sha256=dkt60-4_SO8whKIckTc0-jqfUmJeRfHlKBJgcqj_N3E,237696
8
8
  dclab/cached.py,sha256=eWTYBiI-HQM7JuPH-oxa5LLnhAX32GpRwlYg2kQ3sTA,2917
9
9
  dclab/http_utils.py,sha256=XHicbHQts5LY3zSNmYqNgAZpKTktotEiwQgJ8d2sBlk,10912
10
10
  dclab/polygon_filter.py,sha256=qexmo-rXe06CUPZhN6EMJy4y4B5gXZeqejdvIB2arOE,13480
@@ -70,12 +70,12 @@ dclab/external/skimage/pnpoly.py,sha256=r8hFNiTz5XlUoNZjosqA0iyv1FPn0l7ewbplgFgk
70
70
  dclab/external/skimage/_find_contours.py,sha256=16v5eeTZBmevG8SSuXtJ6yUpVPhwfSmtc8pDD0nuuOU,9340
71
71
  dclab/external/skimage/__init__.py,sha256=-B2QUKHAFzQuBWuuKvPDC5JIl0Zb-x3OGmbwPaE9VwQ,72
72
72
  dclab/external/skimage/_pnpoly.pyx,sha256=Qdn6xPazDschBqbr46DzB75MB2MnqvdnoTSBMK7kUGE,2504
73
- dclab/external/skimage/_pnpoly.cpython-310-darwin.so,sha256=vTOYlXMJtGdl9N_5Oq8-zDl-yuG55oDQqJjjI6t1tNo,194992
73
+ dclab/external/skimage/_pnpoly.cpython-310-darwin.so,sha256=NVszlmZXhVV1-Y0KL7tuJRdKjAqA6lS5Gofh3T4165k,194992
74
74
  dclab/external/skimage/_find_contours_cy.pyx,sha256=pZJOBhMHzYEMkcz4WQVyjn7jDNrdjCfet47FU1hRAxk,7161
75
- dclab/external/skimage/_find_contours_cy.cpython-310-darwin.so,sha256=jce89UrZLPG0VpnoRktgKSBpx-SgKzhgPQQQntcwNm8,189512
75
+ dclab/external/skimage/_find_contours_cy.cpython-310-darwin.so,sha256=clbvlmgdfImjRl2bHJ-JUiEoMTLxaKFnDwYJwKVAStY,189512
76
76
  dclab/external/skimage/_shared/geometry.pxd,sha256=kRsu9ifv_rL3kbRIgSLf86p0hn2oTMp6s013lZ9bBZM,346
77
77
  dclab/external/skimage/_shared/__init__.py,sha256=2sHZwTtJSlMTa3Q2YSvQW7jrPLMUSqDJQa-ROe5zfcw,37
78
- dclab/external/skimage/_shared/geometry.cpython-310-darwin.so,sha256=yzvzmQ4RW2tw59tW0whkvPt3vEN6DetrmpBVSx-IhQ0,38432
78
+ dclab/external/skimage/_shared/geometry.cpython-310-darwin.so,sha256=3s7dEjOaRr29eUw8hPGPUglMDLLd4qFpVTvldenVjNE,38432
79
79
  dclab/external/skimage/_shared/geometry.pyx,sha256=miCHUh6mBDbRRIoaF_0xAER1MRzsCAzFdlYQZhV7RmE,1667
80
80
  dclab/definitions/feat_logic.py,sha256=_Rr2vK-nbRNjxk5Kf8Iohs_Q3jzUe9EZJgxB9vMwxwE,5379
81
81
  dclab/definitions/meta_parse.py,sha256=YdaTdM8DAMsIFn5ITH9OHYGTXeAOBGWtx22oVjxXcWk,2393
@@ -86,14 +86,14 @@ dclab/definitions/meta_logic.py,sha256=wCgb7DPRHaR8DCWw_VbwNkpslUnazzWfgX0iS8oEe
86
86
  dclab/rtdc_dataset/config.py,sha256=MvBteFya3R6Ch3U6UgTakCsJoBgVykTxS_Z25STWPHU,17432
87
87
  dclab/rtdc_dataset/check.py,sha256=lJNaz4QTe2WNlxik6zSohRHTiAYuP_bKOzSDjPGTUS0,35006
88
88
  dclab/rtdc_dataset/meta_table.py,sha256=ucqBNrgI6rDAuQFuMRckY8lp1LpnYAoRgEsLObWTJCE,648
89
- dclab/rtdc_dataset/feat_basin.py,sha256=iBGhuRkIy-zbonIjYHCQdLd3V3_cebpBfDTvqyLzJK4,26921
89
+ dclab/rtdc_dataset/feat_basin.py,sha256=pSrKSayNjkf_RY3OprE5CPNIUR46r2cd2o1NnkpspAU,27990
90
90
  dclab/rtdc_dataset/fmt_s3.py,sha256=bU3V_WGyqJhxPCH80X_nlNqq-jXcgoZKv_aUBIqwaL8,11877
91
91
  dclab/rtdc_dataset/feat_temp.py,sha256=XbDIS1iUUkRH0Zp9uVlwvK_untJ7hkOnKshK1Drsnt8,3694
92
92
  dclab/rtdc_dataset/__init__.py,sha256=MUHSGVQJ4Zc0IyU2lf01dpDWyOyNveHip-UjSkmPNvQ,486
93
- dclab/rtdc_dataset/core.py,sha256=LjddGHdqZINXKUQcvCyCDmOofdBzyJIXN_z_C-zWGnM,34777
94
- dclab/rtdc_dataset/export.py,sha256=Ukmdz-Mm9iei6vhfp1lh7oNQiAbXvA2o3tRx1XlBWCM,33416
93
+ dclab/rtdc_dataset/core.py,sha256=HNRia2qxlDwCK52ypJ9TsOTlTLqszOEvYtAoCH2od3w,34896
94
+ dclab/rtdc_dataset/export.py,sha256=l-c_HGrrxVum-MLqIWvlz_eJWi0C-GAiMsChXOV3lAE,33657
95
95
  dclab/rtdc_dataset/fmt_dict.py,sha256=gumVQOiVVDFUKow_483PY7cxInqo-NiBBnBhIU8s4lg,3009
96
- dclab/rtdc_dataset/writer.py,sha256=BqP4QSzHxCSxp9z7_cJF2v04taO3ZXE3Wg6zJY6fMao,41819
96
+ dclab/rtdc_dataset/writer.py,sha256=MdqEFf4hpoBjjvNbp120BWCdaP1XjEyS3hxO2WNwApw,42845
97
97
  dclab/rtdc_dataset/filter.py,sha256=AFPUBzOIi3pqXgUdMQ5CIi9ZeGOKC71rfSZKLMLgtog,10023
98
98
  dclab/rtdc_dataset/fmt_http.py,sha256=vXVxRLXZp2_V1v3xk4lu4VUHYXfNHJdsRkVt3trC1RU,3374
99
99
  dclab/rtdc_dataset/load.py,sha256=5_xGw2P8Mjs0gW-vGr2Kn28j6Qv3BvvMvguMibC_mM4,2761
@@ -134,9 +134,9 @@ dclab/rtdc_dataset/fmt_tdms/event_image.py,sha256=-jp7Z-N91e4ieumYQ1huMicj7PMJqw
134
134
  dclab/rtdc_dataset/fmt_tdms/event_trace.py,sha256=Vkym0QKSw2mq1XZl5n8wDkgHXmaZwQGiMAV5AuRSJkE,5215
135
135
  dclab/rtdc_dataset/fmt_tdms/exc.py,sha256=WzrMqnyrzp8gsT8Pf7JKqGGv43ewx7d_qgtirURppRI,813
136
136
  dclab/rtdc_dataset/fmt_tdms/event_contour.py,sha256=kjo0wJx9F0gmmOOyR0NoLw6VEtSl3h63WXXkcbfnoS8,9627
137
- dclab-0.64.3.dist-info/RECORD,,
138
- dclab-0.64.3.dist-info/WHEEL,sha256=aNQV8Up4rZuRmZ4dQF1gRf2_E64p7eyxNGuFzXK-F6k,137
139
- dclab-0.64.3.dist-info/entry_points.txt,sha256=eOpjgznu-eW-9utUpLU-77O5098YyUEgGF3ksGMdtec,273
140
- dclab-0.64.3.dist-info/top_level.txt,sha256=irvwZMgs1edY1Zj60ZFk7Almb9Zhk4k6E6aC4YPFnnM,6
141
- dclab-0.64.3.dist-info/METADATA,sha256=j9pzLR5wQCpAnhWmOjvo8yH9ijCimv5H1_CGlxM-Los,4766
142
- dclab-0.64.3.dist-info/licenses/LICENSE,sha256=gLDaVZWRrlnLdyfOrR0qfWjLbOVcjvoJ-kCLUK0fyXA,15360
137
+ dclab-0.66.0.dist-info/RECORD,,
138
+ dclab-0.66.0.dist-info/WHEEL,sha256=aNQV8Up4rZuRmZ4dQF1gRf2_E64p7eyxNGuFzXK-F6k,137
139
+ dclab-0.66.0.dist-info/entry_points.txt,sha256=eOpjgznu-eW-9utUpLU-77O5098YyUEgGF3ksGMdtec,273
140
+ dclab-0.66.0.dist-info/top_level.txt,sha256=irvwZMgs1edY1Zj60ZFk7Almb9Zhk4k6E6aC4YPFnnM,6
141
+ dclab-0.66.0.dist-info/METADATA,sha256=Mxx90M0sUHGcyezYK-_cY6xy60fYvg0GLc99e6y_3Jk,4766
142
+ dclab-0.66.0.dist-info/licenses/LICENSE,sha256=gLDaVZWRrlnLdyfOrR0qfWjLbOVcjvoJ-kCLUK0fyXA,15360
File without changes