From 041333328fd649bece76532573600f330d5c6e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20M=C3=BCller?= Date: Mon, 27 May 2024 14:53:25 +0200 Subject: [PATCH] setup: migrate to dcnum 0.20.0 and fix minor glitch --- CHANGELOG | 3 +++ chipstream/cli/cli_proc.py | 9 +++++---- tests/test_cli.py | 9 +++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1bdb659..7c33428 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +0.4.0 + - fix: show correct data PPID in CLI + - setup: bump dcnum from 0.19.1 to 0.20.0 0.3.1 - ref: migrate from QTableView to QTableWidget (issues with Windows 11) 0.3.0 diff --git a/chipstream/cli/cli_proc.py b/chipstream/cli/cli_proc.py index f311c8d..41992c6 100644 --- a/chipstream/cli/cli_proc.py +++ b/chipstream/cli/cli_proc.py @@ -40,7 +40,9 @@ def process_dataset( path_out.parent.mkdir(parents=True, exist_ok=True) # data keyword arguments - with dcnum.read.HDF5Data(path_in, pixel_size=pixel_size) as data: + data_kwargs = {"pixel_size": pixel_size, + "index_mapping": index_mapping} + with dcnum.read.HDF5Data(path_in, **data_kwargs) as data: dat_id = data.get_ppid() click.echo(f"Data ID:\t{dat_id}") @@ -88,8 +90,7 @@ def process_dataset( path_in=path_in, path_out=path_out, data_code="hdf", - data_kwargs={"pixel_size": pixel_size, - "index_mapping": index_mapping}, + data_kwargs=data_kwargs, background_code=bg_cls.get_ppid_code(), background_kwargs=bg_kwargs, segmenter_code=seg_cls.get_ppid_code(), @@ -98,7 +99,7 @@ def process_dataset( feature_kwargs=feat_kwargs, gate_code=gate_cls.get_ppid_code(), gate_kwargs=gate_kwargs, - no_basins_in_output=True, + basin_strategy="drain", num_procs=num_cpus, debug=debug, ) diff --git a/tests/test_cli.py b/tests/test_cli.py index 1fbff4e..1a34ba4 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,5 +1,6 @@ import dcnum.read import h5py +import numpy as np import pytest @@ -32,8 +33,12 @@ def test_cli_limit_events(cli_runner, limit_events, dcnum_yield, # sanity check with h5py.File(path) as h5: - assert h5["events/frame"][0] == 1 - assert h5["events/frame"][1] == 2 + assert np.all(h5["events/frame"][:] + == np.array([1, 2, 2, 4, 4, 5, 5, 5, 6, 6, + 6, 7, 8, 8, 10, 10, 11, 11, 11, 12, + 12, 12, 13, 14, 14, 16, 16, 17, 17, 17, + 18, 18, 18])) + assert "basinmap0" not in h5 path_out = path.with_name("limited_events.rtdc") result = cli_runner.invoke(cli_main.chipstream_cli,