Skip to content

Commit

Permalink
enh: ensure all feature data objects have the dtype property
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jan 4, 2024
1 parent 1634862 commit fcf9d8c
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- enh: got rid of for-loop in map_indices_parent2child (~100x speed-up)
- enh: slight improvement of managing manual indices in hierarchy children
- enh: added dtype properties for contour and trace events
- enh: ensure all feature data objects have the dtype property
- ref: new submodule for hierarchy format
0.56.3
- fix: regression missing check for basin availability
Expand Down
3 changes: 3 additions & 0 deletions dclab/rtdc_dataset/fmt_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def __init__(self, ddict, *args, **kwargs):
data = DictContourEvent(ddict[feat])
elif feat == "trace":
data = DictTraceEvent(ddict[feat])
elif isinstance(ddict[feat], list):
# convert e.g. image data to arrays
data = np.array(ddict[feat])
else:
data = ddict[feat]
else:
Expand Down
1 change: 1 addition & 0 deletions dclab/rtdc_dataset/fmt_tdms/event_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def __init__(self, rtdc_dataset):

self.event_offset = 0
self._length = None
self.dtype = np.int16

def __getitem__(self, idx):
if not isinstance(idx, numbers.Integral):
Expand Down
1 change: 1 addition & 0 deletions dclab/rtdc_dataset/fmt_tdms/event_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def __init__(self, rtdc_dataset):
self.event_offset = int(conf["fmt_tdms"]["video frame offset"])
self.video_file = fname
self._shape = None
self.dtype = np.uint8

def __getitem__(self, idx):
if not isinstance(idx, numbers.Integral):
Expand Down
1 change: 1 addition & 0 deletions dclab/rtdc_dataset/fmt_tdms/event_mask.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def __init__(self, rtdc_dataset):
self.config = rtdc_dataset.config
self._shape = None
self._img_shape_cache = None
self.dtype = np.bool_

def __getitem__(self, idx):
if not isinstance(idx, numbers.Integral):
Expand Down
1 change: 1 addition & 0 deletions dclab/rtdc_dataset/fmt_tdms/event_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __init__(self, rtdc_dataset):
self._trace = None
self.mname = rtdc_dataset.path
self.identifier = self.mname
self.dtype = np.int16

def __getitem__(self, trace_key):
if trace_key not in dfn.FLUOR_TRACES:
Expand Down

0 comments on commit fcf9d8c

Please sign in to comment.