Skip to content

Commit

Permalink
fix: remove hack that populates feature names for basins unreliably
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Apr 4, 2024
1 parent 6f4f2ab commit 8d55822
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.58.2
- fix: KeyError when iteration over DCOR logs or tables
- fix: remove hack that populates feature names for basins unreliably
- enh: lazily load logs and tables in `fmt_hierarchy`
0.58.1
- fix: exporting with basins from a hierarchy child did not write a
Expand Down
5 changes: 0 additions & 5 deletions dclab/rtdc_dataset/fmt_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ def __init__(self, *args, **kwargs):

def _load_dataset(self, location, **kwargs):
h5file = RTDC_HTTP(location, **kwargs)
# If the user specified the events of the basin, then store it
# directly in the .H5Events class of .RTDC_HDF5. This saves us
# approximately 2 seconds of listing the members of the "events"
# group from the URL.
h5file._events._features_list = self._features
return h5file

def is_available(self):
Expand Down
5 changes: 0 additions & 5 deletions dclab/rtdc_dataset/fmt_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,6 @@ def __init__(self, *args, **kwargs):

def _load_dataset(self, location, **kwargs):
h5file = RTDC_S3(location, **kwargs)
# If the user specified the events of the basin, then store it
# directly in the .H5Events class of .RTDC_HDF5. This saves us
# approximately 2 seconds of listing the members of the "events"
# group in the S3 object.
h5file._events._features_list = self._features
return h5file

def is_available(self):
Expand Down
26 changes: 26 additions & 0 deletions tests/test_rtdc_feat_basin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,32 @@
from helper_methods import DCOR_AVAILABLE, retrieve_data


@pytest.mark.filterwarnings(
"ignore::dclab.rtdc_dataset.config.WrongConfigurationTypeWarning")
@pytest.mark.skipif(not DCOR_AVAILABLE, reason="DCOR is not available")
@pytest.mark.parametrize("filtered", [True, False])
def test_basin_feature_nested_image_exported_available(tmp_path, filtered):
epath = tmp_path / "exported.rtdc"
# Load data from DCOR and export basin-only dataset
with dclab.new_dataset("fb719fb2-bd9f-817a-7d70-f4002af916f0") as ds:
assert "image" in ds
ds.export.hdf5(path=epath,
features=[],
basins=True,
filtered=filtered,
)
# Open the exported dataset and attempt to access the image feature
with dclab.new_dataset(epath) as ds:
assert "image" in ds
assert np.any(ds["image"][0])
imcount = 0
for bn in ds.basins:
if "image" in bn.ds:
assert np.any(bn.ds["image"][0])
imcount += 1
assert imcount > 0, "image should be *some*-where"


def test_basin_hierarchy_trace():
h5path = retrieve_data("fmt-hdf5_fl_wide-channel_2023.zip")
h5path_small = h5path.with_name("smaller.rtdc")
Expand Down

0 comments on commit 8d55822

Please sign in to comment.