dclab 0.67.0__cp314-cp314-macosx_10_13_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.

Files changed (142) hide show
  1. dclab/__init__.py +41 -0
  2. dclab/_version.py +34 -0
  3. dclab/cached.py +97 -0
  4. dclab/cli/__init__.py +10 -0
  5. dclab/cli/common.py +237 -0
  6. dclab/cli/task_compress.py +126 -0
  7. dclab/cli/task_condense.py +223 -0
  8. dclab/cli/task_join.py +229 -0
  9. dclab/cli/task_repack.py +98 -0
  10. dclab/cli/task_split.py +154 -0
  11. dclab/cli/task_tdms2rtdc.py +186 -0
  12. dclab/cli/task_verify_dataset.py +75 -0
  13. dclab/definitions/__init__.py +79 -0
  14. dclab/definitions/feat_const.py +202 -0
  15. dclab/definitions/feat_logic.py +182 -0
  16. dclab/definitions/meta_const.py +252 -0
  17. dclab/definitions/meta_logic.py +111 -0
  18. dclab/definitions/meta_parse.py +94 -0
  19. dclab/downsampling.cpython-314-darwin.so +0 -0
  20. dclab/downsampling.pyx +230 -0
  21. dclab/external/__init__.py +4 -0
  22. dclab/external/packaging/LICENSE +3 -0
  23. dclab/external/packaging/LICENSE.APACHE +177 -0
  24. dclab/external/packaging/LICENSE.BSD +23 -0
  25. dclab/external/packaging/__init__.py +6 -0
  26. dclab/external/packaging/_structures.py +61 -0
  27. dclab/external/packaging/version.py +505 -0
  28. dclab/external/skimage/LICENSE +28 -0
  29. dclab/external/skimage/__init__.py +2 -0
  30. dclab/external/skimage/_find_contours.py +216 -0
  31. dclab/external/skimage/_find_contours_cy.cpython-314-darwin.so +0 -0
  32. dclab/external/skimage/_find_contours_cy.pyx +188 -0
  33. dclab/external/skimage/_pnpoly.cpython-314-darwin.so +0 -0
  34. dclab/external/skimage/_pnpoly.pyx +99 -0
  35. dclab/external/skimage/_shared/__init__.py +1 -0
  36. dclab/external/skimage/_shared/geometry.cpython-314-darwin.so +0 -0
  37. dclab/external/skimage/_shared/geometry.pxd +6 -0
  38. dclab/external/skimage/_shared/geometry.pyx +55 -0
  39. dclab/external/skimage/measure.py +7 -0
  40. dclab/external/skimage/pnpoly.py +53 -0
  41. dclab/external/statsmodels/LICENSE +35 -0
  42. dclab/external/statsmodels/__init__.py +6 -0
  43. dclab/external/statsmodels/nonparametric/__init__.py +1 -0
  44. dclab/external/statsmodels/nonparametric/_kernel_base.py +203 -0
  45. dclab/external/statsmodels/nonparametric/kernel_density.py +165 -0
  46. dclab/external/statsmodels/nonparametric/kernels.py +36 -0
  47. dclab/features/__init__.py +9 -0
  48. dclab/features/bright.py +81 -0
  49. dclab/features/bright_bc.py +93 -0
  50. dclab/features/bright_perc.py +63 -0
  51. dclab/features/contour.py +161 -0
  52. dclab/features/emodulus/__init__.py +339 -0
  53. dclab/features/emodulus/load.py +252 -0
  54. dclab/features/emodulus/lut_HE-2D-FEM-22.txt +16432 -0
  55. dclab/features/emodulus/lut_HE-3D-FEM-22.txt +1276 -0
  56. dclab/features/emodulus/lut_LE-2D-FEM-19.txt +13082 -0
  57. dclab/features/emodulus/pxcorr.py +135 -0
  58. dclab/features/emodulus/scale_linear.py +247 -0
  59. dclab/features/emodulus/viscosity.py +260 -0
  60. dclab/features/fl_crosstalk.py +95 -0
  61. dclab/features/inert_ratio.py +377 -0
  62. dclab/features/volume.py +242 -0
  63. dclab/http_utils.py +322 -0
  64. dclab/isoelastics/__init__.py +468 -0
  65. dclab/isoelastics/iso_HE-2D-FEM-22-area_um-deform.txt +2440 -0
  66. dclab/isoelastics/iso_HE-2D-FEM-22-volume-deform.txt +2635 -0
  67. dclab/isoelastics/iso_HE-3D-FEM-22-area_um-deform.txt +1930 -0
  68. dclab/isoelastics/iso_HE-3D-FEM-22-volume-deform.txt +2221 -0
  69. dclab/isoelastics/iso_LE-2D-FEM-19-area_um-deform.txt +2151 -0
  70. dclab/isoelastics/iso_LE-2D-FEM-19-volume-deform.txt +2250 -0
  71. dclab/isoelastics/iso_LE-2D-ana-18-area_um-deform.txt +1266 -0
  72. dclab/kde/__init__.py +1 -0
  73. dclab/kde/base.py +459 -0
  74. dclab/kde/contours.py +222 -0
  75. dclab/kde/methods.py +313 -0
  76. dclab/kde_contours.py +10 -0
  77. dclab/kde_methods.py +11 -0
  78. dclab/lme4/__init__.py +5 -0
  79. dclab/lme4/lme4_template.R +94 -0
  80. dclab/lme4/rsetup.py +204 -0
  81. dclab/lme4/wrapr.py +386 -0
  82. dclab/polygon_filter.py +398 -0
  83. dclab/rtdc_dataset/__init__.py +15 -0
  84. dclab/rtdc_dataset/check.py +902 -0
  85. dclab/rtdc_dataset/config.py +533 -0
  86. dclab/rtdc_dataset/copier.py +353 -0
  87. dclab/rtdc_dataset/core.py +896 -0
  88. dclab/rtdc_dataset/export.py +867 -0
  89. dclab/rtdc_dataset/feat_anc_core/__init__.py +24 -0
  90. dclab/rtdc_dataset/feat_anc_core/af_basic.py +75 -0
  91. dclab/rtdc_dataset/feat_anc_core/af_emodulus.py +160 -0
  92. dclab/rtdc_dataset/feat_anc_core/af_fl_max_ctc.py +133 -0
  93. dclab/rtdc_dataset/feat_anc_core/af_image_contour.py +113 -0
  94. dclab/rtdc_dataset/feat_anc_core/af_ml_class.py +102 -0
  95. dclab/rtdc_dataset/feat_anc_core/ancillary_feature.py +320 -0
  96. dclab/rtdc_dataset/feat_anc_ml/__init__.py +32 -0
  97. dclab/rtdc_dataset/feat_anc_plugin/__init__.py +3 -0
  98. dclab/rtdc_dataset/feat_anc_plugin/plugin_feature.py +329 -0
  99. dclab/rtdc_dataset/feat_basin.py +762 -0
  100. dclab/rtdc_dataset/feat_temp.py +102 -0
  101. dclab/rtdc_dataset/filter.py +263 -0
  102. dclab/rtdc_dataset/fmt_dcor/__init__.py +7 -0
  103. dclab/rtdc_dataset/fmt_dcor/access_token.py +52 -0
  104. dclab/rtdc_dataset/fmt_dcor/api.py +173 -0
  105. dclab/rtdc_dataset/fmt_dcor/base.py +299 -0
  106. dclab/rtdc_dataset/fmt_dcor/basin.py +73 -0
  107. dclab/rtdc_dataset/fmt_dcor/logs.py +26 -0
  108. dclab/rtdc_dataset/fmt_dcor/tables.py +66 -0
  109. dclab/rtdc_dataset/fmt_dict.py +103 -0
  110. dclab/rtdc_dataset/fmt_hdf5/__init__.py +6 -0
  111. dclab/rtdc_dataset/fmt_hdf5/base.py +192 -0
  112. dclab/rtdc_dataset/fmt_hdf5/basin.py +30 -0
  113. dclab/rtdc_dataset/fmt_hdf5/events.py +276 -0
  114. dclab/rtdc_dataset/fmt_hdf5/feat_defect.py +164 -0
  115. dclab/rtdc_dataset/fmt_hdf5/logs.py +33 -0
  116. dclab/rtdc_dataset/fmt_hdf5/tables.py +60 -0
  117. dclab/rtdc_dataset/fmt_hierarchy/__init__.py +11 -0
  118. dclab/rtdc_dataset/fmt_hierarchy/base.py +278 -0
  119. dclab/rtdc_dataset/fmt_hierarchy/events.py +146 -0
  120. dclab/rtdc_dataset/fmt_hierarchy/hfilter.py +140 -0
  121. dclab/rtdc_dataset/fmt_hierarchy/mapper.py +134 -0
  122. dclab/rtdc_dataset/fmt_http.py +102 -0
  123. dclab/rtdc_dataset/fmt_s3.py +354 -0
  124. dclab/rtdc_dataset/fmt_tdms/__init__.py +476 -0
  125. dclab/rtdc_dataset/fmt_tdms/event_contour.py +264 -0
  126. dclab/rtdc_dataset/fmt_tdms/event_image.py +220 -0
  127. dclab/rtdc_dataset/fmt_tdms/event_mask.py +62 -0
  128. dclab/rtdc_dataset/fmt_tdms/event_trace.py +146 -0
  129. dclab/rtdc_dataset/fmt_tdms/exc.py +37 -0
  130. dclab/rtdc_dataset/fmt_tdms/naming.py +151 -0
  131. dclab/rtdc_dataset/load.py +77 -0
  132. dclab/rtdc_dataset/meta_table.py +25 -0
  133. dclab/rtdc_dataset/writer.py +1019 -0
  134. dclab/statistics.py +226 -0
  135. dclab/util.py +176 -0
  136. dclab/warn.py +15 -0
  137. dclab-0.67.0.dist-info/METADATA +153 -0
  138. dclab-0.67.0.dist-info/RECORD +142 -0
  139. dclab-0.67.0.dist-info/WHEEL +6 -0
  140. dclab-0.67.0.dist-info/entry_points.txt +8 -0
  141. dclab-0.67.0.dist-info/licenses/LICENSE +283 -0
  142. dclab-0.67.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,37 @@
1
+ class ContourIndexingError(BaseException):
2
+ """Use when contour indices are confused"""
3
+ pass
4
+
5
+
6
+ class IncompleteTDMSFileFormatError(BaseException):
7
+ """Use for incomplete dataset (e.g. missing para.ini)"""
8
+
9
+
10
+ class InvalidTDMSFileFormatError(BaseException):
11
+ """Use for invalid tdms files (e.g. unknown columns)"""
12
+ pass
13
+
14
+
15
+ class InvalidVideoFileError(BaseException):
16
+ """Used for bad video files"""
17
+ pass
18
+
19
+
20
+ class CorruptFrameWarning(UserWarning):
21
+ """Video frame corrupt or missing"""
22
+ pass
23
+
24
+
25
+ class InitialFrameMissingWarning(CorruptFrameWarning):
26
+ """Initial frame of video is missing"""
27
+ pass
28
+
29
+
30
+ class SlowVideoWarning(UserWarning):
31
+ """Getting video data will be slow"""
32
+ pass
33
+
34
+
35
+ class MultipleSamplesPerEventFound(UserWarning):
36
+ """Ambiguities in trace data"""
37
+ pass
@@ -0,0 +1,151 @@
1
+ # Keys are the feature names dclab and
2
+ # values are the feature names in the tdms file format.
3
+ dclab2tdms = {
4
+ "area_cvx": "area",
5
+ "area_msd": "raw area",
6
+ "bright_avg": "Brightness",
7
+ "bright_sd": "BrightnessSD",
8
+ "circ": "circularity",
9
+ "fl1_area": "FL1area",
10
+ "fl1_dist": "FL1dpeaks",
11
+ "fl1_max": "FL1max",
12
+ "fl1_npeaks": "FL1npeaks",
13
+ "fl1_pos": "FL1pos",
14
+ "fl1_width": "FL1width",
15
+ "fl2_area": "FL2area",
16
+ "fl2_dist": "FL2dpeaks",
17
+ "fl2_max": "FL2max",
18
+ "fl2_npeaks": "FL2npeaks",
19
+ "fl2_pos": "FL2pos",
20
+ "fl2_width": "FL2width",
21
+ "fl3_area": "FL3area",
22
+ "fl3_dist": "FL3dpeaks",
23
+ "fl3_max": "FL3max",
24
+ "fl3_npeaks": "FL3npeaks",
25
+ "fl3_pos": "FL3pos",
26
+ "fl3_width": "FL3width",
27
+ "g_force": "gValue",
28
+ "frame": "time", # [sic]
29
+ "inert_ratio_cvx": "InertiaRatio",
30
+ "inert_ratio_raw": "InertiaRatioRaw",
31
+ "nevents": "NrOfCells",
32
+ "pc1": "PC1",
33
+ "pc2": "PC2",
34
+ "pos_x": "x",
35
+ "pos_y": "y",
36
+ "size_x": "ax2",
37
+ "size_y": "ax1",
38
+ "temp": "temp",
39
+ "temp_amb": "temp_amb",
40
+ }
41
+
42
+ # Add lower-case userdef features
43
+ for _i in range(10):
44
+ dclab2tdms["userdef{}".format(_i)] = "userDef{}".format(_i)
45
+
46
+ # inverse of dclab2tdms
47
+ tdms2dclab = {}
48
+ for kk in dclab2tdms:
49
+ tdms2dclab[dclab2tdms[kk]] = kk
50
+
51
+ # Add capitalized userdef features as well.
52
+ # see https://github.com/DC-analysis/DCscope/issues/212
53
+ for _i in range(10):
54
+ tdms2dclab["UserDef{}".format(_i)] = "userdef{}".format(_i)
55
+
56
+ # traces_tdms file definitions
57
+ # The second feature should not contain duplicates! - even if the
58
+ # entries in the first features are different.
59
+ tr_data_map = {
60
+ "fl1_raw": ["fluorescence traces", "FL1raw"],
61
+ "fl2_raw": ["fluorescence traces", "FL2raw"],
62
+ "fl3_raw": ["fluorescence traces", "FL3raw"],
63
+ "fl1_median": ["fluorescence traces", "FL1med"],
64
+ "fl2_median": ["fluorescence traces", "FL2med"],
65
+ "fl3_median": ["fluorescence traces", "FL3med"],
66
+ }
67
+
68
+ #: for param.ini and camera.ini
69
+ configmap = {
70
+ "experiment": {
71
+ "run index": ("General", "Measurement Number"),
72
+ "sample": ("General", "Sample Name"),
73
+ "date": ("General", "Date [YYYY-MM-DD]"),
74
+ "time": ("General", "Start Time [hh:mm:ss]"),
75
+ },
76
+ # All special keywords related to RT-FDC
77
+ "fluorescence": {
78
+ "bit depth": ("FLUOR", "Bitdepthraw"),
79
+ "channel count": ("FLUOR", "FL-Channels"),
80
+ "channel 1 name": ("FLUOR", "Channel 1 Name"),
81
+ "channel 2 name": ("FLUOR", "Channel 2 Name"),
82
+ "channel 3 name": ("FLUOR", "Channel 3 Name"),
83
+ "channels installed": ("FLUOR", "Channels Installed"),
84
+ "laser 1 power": ("FLUOR", "Laser1 488 nm Power [%]"),
85
+ "laser 2 power": ("FLUOR", "Laser2 561 nm Power [%]"),
86
+ "laser 3 power": ("FLUOR", "Laser3 640 nm Power [%]"),
87
+ "laser count": ("FLUOR", "Laser Count"),
88
+ "lasers installed": ("FLUOR", "Lasers Installed"),
89
+ "sample rate": ("FLUOR", "Samplerate [sps]"),
90
+ "samples per event": ("FLUOR", "Samples Per Event"),
91
+ "signal max": ("FLUOR", "ADCmax [V]"),
92
+ "signal min": ("FLUOR", "ADCmin [V]"),
93
+ "trace median": ("FLUOR", "Trace Median"),
94
+ },
95
+ # All tdms-related parameters
96
+ "fmt_tdms": {
97
+ "video frame offset": ("General", "video frame offset"),
98
+ },
99
+ # All imaging-related keywords
100
+ "imaging": {
101
+ "flash device": "LED (undefined)",
102
+ "flash duration": ("General", "Shutter Time LED [us]"),
103
+ "frame rate": ("Framerate", "Frame Rate"),
104
+ "pixel size": ("Image", "Pix Size"),
105
+ "roi position x": ("ROI", "x-pos"),
106
+ "roi position y": ("ROI", "y-pos"),
107
+ "roi size x": ("ROI", "width"),
108
+ "roi size y": ("ROI", "height"),
109
+ },
110
+ # All parameters for online contour extraction from the event images
111
+ "online_contour": {
112
+ "bin area min": ("Image", "Trig Thresh"),
113
+ "bin kernel": ("Image", "Bin Ops"),
114
+ "bin threshold": ("Image", "Thresh"),
115
+ "image blur": ("Image", "Blur"),
116
+ "no absdiff": ("Image", "Diff_Method"),
117
+ },
118
+ # All online filters
119
+ "online_filter": {
120
+ "aspect min": ("Image", "Cell Aspect Min"),
121
+ "aspect max": ("Image", "Cell Aspect Max"),
122
+ "size_x max": ("Image", "Cell Max Length"),
123
+ "size_y max": ("Image", "Cell Max Height"),
124
+ },
125
+ # All setup-related keywords, except imaging
126
+ "setup": {
127
+ "channel width": ("General", "Channel width [um]"),
128
+ "chip region": ("General", "Region"),
129
+ "flow rate": ("General", "Flow Rate [ul/s]"),
130
+ "flow rate sample": ("General", "Sample Flow Rate [ul/s]"),
131
+ "flow rate sheath": ("General", "Sheath Flow Rate [ul/s]"),
132
+ "identifier": ("General", "Identifier"),
133
+ "medium": ("General", "Buffer Medium"),
134
+ "module composition": ("Image", "Setup"),
135
+ "software version": ("General", "Software Version"),
136
+ },
137
+ }
138
+
139
+ #: for SoftwareSettings.ini
140
+ config_map_set = {
141
+ "online_contour": {
142
+ "bin kernel": ("MaintenanceD", "bin_ops"),
143
+ "image blur": ("MaintenanceD", "blur"),
144
+ },
145
+ "fluorescence": {
146
+ "laser 1 power": ("Fluorescence", "Laser1_Power"),
147
+ "laser 2 power": ("Fluorescence", "Laser2_Power"),
148
+ "laser 3 power": ("Fluorescence", "Laser3_Power"),
149
+ "trace median": ("Maintenance", "median_pmt"),
150
+ },
151
+ }
@@ -0,0 +1,77 @@
1
+ """Load RT-DC datasets"""
2
+ import errno
3
+ import io
4
+ import os
5
+ import pathlib
6
+
7
+ from .core import RTDCBase
8
+ from . import (
9
+ fmt_dict, fmt_dcor, fmt_hdf5, fmt_hierarchy, fmt_http, fmt_s3, fmt_tdms)
10
+
11
+
12
+ def load_file(path, identifier=None, **kwargs):
13
+ path = pathlib.Path(path).resolve()
14
+ for fmt in [fmt_hdf5.RTDC_HDF5, fmt_tdms.RTDC_TDMS]:
15
+ if fmt.can_open(path):
16
+ return fmt(path, identifier=identifier, **kwargs)
17
+ else:
18
+ raise ValueError("Unknown file format: '{}'".format(path.suffix))
19
+
20
+
21
+ def new_dataset(data, identifier=None, **kwargs):
22
+ """Initialize a new RT-DC dataset
23
+
24
+ Parameters
25
+ ----------
26
+ data:
27
+ can be one of the following:
28
+
29
+ - dict
30
+ - .tdms file
31
+ - .rtdc file
32
+ - subclass of `RTDCBase`
33
+ (will create a hierarchy child)
34
+ - DCOR resource URL
35
+ - URL to file in S3-compatible object store
36
+ identifier: str
37
+ A unique identifier for this dataset. If set to `None`
38
+ an identifier is generated.
39
+ kwargs:
40
+ Additional parameters passed to the RTDCBase subclass
41
+
42
+ Returns
43
+ -------
44
+ dataset: subclass of :class:`dclab.rtdc_dataset.RTDCBase`
45
+ A new dataset instance
46
+ """
47
+ if isinstance(data, dict):
48
+ return fmt_dict.RTDC_Dict(data, identifier=identifier, **kwargs)
49
+ elif isinstance(data, io.BytesIO):
50
+ return fmt_hdf5.RTDC_HDF5(data, **kwargs)
51
+ elif fmt_dcor.is_dcor_url(data):
52
+ return fmt_dcor.RTDC_DCOR(data, identifier=identifier, **kwargs)
53
+ elif fmt_http.is_http_url(data):
54
+ if fmt_http.is_url_available(data, ret_reason=False):
55
+ return fmt_http.RTDC_HTTP(data, identifier=identifier)
56
+ elif fmt_s3.is_s3_url(data):
57
+ return fmt_s3.RTDC_S3(data, identifier=identifier, **kwargs)
58
+ else:
59
+ raise NotImplementedError(f"Unknown remote format: {data}")
60
+ elif isinstance(data, RTDCBase):
61
+ return fmt_hierarchy.RTDC_Hierarchy(data, identifier=identifier,
62
+ **kwargs)
63
+ elif isinstance(data, (pathlib.Path, str)):
64
+ # If we are given a `file:` specifier, remove it. We might be
65
+ # looking at a network share (not mounted as a drive) on Windows
66
+ # (e.g. "file:\\127.0.0.1\shared\data.rtdc").
67
+ if isinstance(data, str) and data.startswith("file:"):
68
+ data = data[5:]
69
+ path = pathlib.Path(data).resolve()
70
+ if not path.exists():
71
+ raise FileNotFoundError(
72
+ errno.ENOENT, os.strerror(errno.ENOENT), str(path))
73
+ else:
74
+ return load_file(data, identifier=identifier, **kwargs)
75
+ else:
76
+ msg = "data type not supported: {}".format(data.__class__)
77
+ raise NotImplementedError(msg)
@@ -0,0 +1,25 @@
1
+ import abc
2
+
3
+
4
+ class MetaTable(abc.ABC):
5
+ @abc.abstractmethod
6
+ def __array__(self, *args, **kwargs):
7
+ """Return array representation of the table"""
8
+
9
+ @property
10
+ @abc.abstractmethod
11
+ def meta(self):
12
+ """Return metadata of the table (e.g. graph colors)"""
13
+
14
+ @abc.abstractmethod
15
+ def has_graphs(self):
16
+ """Return True when the table has key-based graphs"""
17
+
18
+ @abc.abstractmethod
19
+ def keys(self):
20
+ """Return keys of the graphs, None if `not self.has_graphs()`"""
21
+
22
+ @abc.abstractmethod
23
+ def __getitem__(self, key):
24
+ """Return a graph or otherwise part of the data array"""
25
+ pass