Skip to content

Commit d528071

Browse files
m-albertjakirkham
andauthored
Fix CI test failures (#393)
* Use np.ptp function instead of method * Replace deprecated tifffile.TiffWriter.save by tifffile.TiffWriter.write * Avoid converting dataframes to string type in find_objects * Stop using deprecated mambaforge in CI * ndinterp.rotate: convert list to np array Co-authored-by: jakirkham <[email protected]> --------- Co-authored-by: jakirkham <[email protected]>
1 parent cb1360a commit d528071

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

Diff for: .github/workflows/test_and_deploy.yml

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ jobs:
2525
- name: Setup Conda Environment
2626
uses: conda-incubator/setup-miniconda@v3
2727
with:
28-
miniforge-variant: Mambaforge
29-
use-mamba: true
3028
python-version: ${{ matrix.python-version }}
3129
environment-file: continuous_integration/environment-${{ matrix.python-version }}.yml
3230
activate-environment: dask-image-testenv

Diff for: dask_image/ndinterp/__init__.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,11 @@ def rotate(
367367
if reshape:
368368
# Compute transformed input bounds
369369
iy, ix = in_plane_shape
370-
out_bounds = rot_matrix @ [[0, 0, iy, iy],
371-
[0, ix, 0, ix]]
370+
in_bounds = np.array([[0, 0, iy, iy],
371+
[0, ix, 0, ix]])
372+
out_bounds = rot_matrix @ in_bounds
372373
# Compute the shape of the transformed input plane
373-
out_plane_shape = (out_bounds.ptp(axis=1) + 0.5).astype(int)
374+
out_plane_shape = (np.ptp(out_bounds, axis=1) + 0.5).astype(int)
374375
else:
375376
out_plane_shape = img_shape[axes]
376377

Diff for: dask_image/ndmeasure/__init__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import operator
66
import warnings
77
from dask import compute, delayed
8+
import dask.config as dask_config
89

910
import dask.array as da
1011
import dask.bag as db
@@ -244,7 +245,9 @@ def find_objects(label_image):
244245
result = bag.fold(functools.partial(_find_objects, label_image.ndim), split_every=2).to_delayed()
245246
meta = dd.utils.make_meta([(i, object) for i in range(label_image.ndim)])
246247
result = delayed(compute)(result)[0] # avoid the user having to call compute twice on result
247-
result = dd.from_delayed(result, meta=meta, prefix="find-objects-", verify_meta=False)
248+
249+
with dask_config.set({'dataframe.convert-string': False}):
250+
result = dd.from_delayed(result, meta=meta, prefix="find-objects-", verify_meta=False)
248251

249252
return result
250253

Diff for: dask_image/ndmeasure/_utils/_find_objects.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pandas as pd
33
from dask.delayed import Delayed
44
import dask.dataframe as dd
5+
import dask.config as dask_config
56

67

78
def _array_chunk_location(block_id, chunks):
@@ -67,9 +68,11 @@ def _find_objects(ndim, df1, df2):
6768
"""Main utility function for find_objects."""
6869
meta = dd.utils.make_meta([(i, object) for i in range(ndim)])
6970
if isinstance(df1, Delayed):
70-
df1 = dd.from_delayed(df1, meta=meta)
71+
with dask_config.set({'dataframe.convert-string': False}):
72+
df1 = dd.from_delayed(df1, meta=meta)
7173
if isinstance(df2, Delayed):
72-
df2 = dd.from_delayed(df2, meta=meta)
74+
with dask_config.set({'dataframe.convert-string': False}):
75+
df2 = dd.from_delayed(df2, meta=meta)
7376
ddf = dd.merge(df1, df2, how="outer", left_index=True, right_index=True)
7477
result = ddf.apply(_merge_bounding_boxes, ndim=ndim, axis=1, meta=meta)
7578
return result

Diff for: tests/test_dask_image/test_imread/test_core.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def test_tiff_imread(tmpdir, seed, nframes, shape, dtype, is_pathlib_Path): # n
7676
fn = str(dirpth.join("test.tiff"))
7777
with tifffile.TiffWriter(fn) as fh:
7878
for i in range(len(a)):
79-
fh.save(a[i], contiguous=True)
79+
fh.write(a[i], contiguous=True)
80+
8081
if is_pathlib_Path:
8182
fn = pathlib.Path(fn)
8283
d = dask_image.imread.imread(fn, nframes=nframes)

0 commit comments

Comments
 (0)