Skip to content

Fix Image.clip_to_dtype and Image.astype with Dask arrays#44

Merged
kostrykin merged 10 commits intomasterfrom
dev/dask_bug
Dec 30, 2025
Merged

Fix Image.clip_to_dtype and Image.astype with Dask arrays#44
kostrykin merged 10 commits intomasterfrom
dev/dask_bug

Conversation

@kostrykin
Copy link
Copy Markdown
Member

No description provided.

@kostrykin kostrykin changed the title Fix bug in Image.clip_to_dtype when using Dask arrays Fix bug in Image.clip_to_dtype and Image.astype when using Dask arrays Dec 30, 2025
@kostrykin kostrykin changed the title Fix bug in Image.clip_to_dtype and Image.astype when using Dask arrays Fix Image.clip_to_dtype and Image.astype when using Dask arrays Dec 30, 2025
@kostrykin kostrykin changed the title Fix Image.clip_to_dtype and Image.astype when using Dask arrays Fix Image.clip_to_dtype and Image.astype with Dask arrays Dec 30, 2025
@github-actions

This comment has been minimized.

@kostrykin kostrykin marked this pull request as ready for review December 30, 2025 00:25
@kostrykin kostrykin requested a review from Copilot December 30, 2025 00:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes compatibility issues with Dask arrays in the Image.clip_to_dtype and Image.astype methods by introducing helper functions that handle both NumPy and Dask array types appropriately.

  • Introduces _get_min_max_values() helper function to efficiently compute min/max values for both NumPy and Dask arrays
  • Introduces _unique() helper function to compute unique values for both NumPy and Dask arrays
  • Adds comprehensive test coverage for Dask arrays by creating new test classes that inherit from mixin classes

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
giatools/image.py Adds _get_min_max_values() and _unique() helper functions; updates astype() and clip_to_dtype() methods to use these helpers instead of calling array methods directly
tests/unit/test__image.py Adds mocks for new helper functions to ensure unit tests remain isolated
tests/module/test__image.py Refactors test structure with mixins to enable testing both NumPy and Dask arrays; adds ImageTestCase__dtype_mixin__dask class and separate test classes for Dask array testing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/module/test__image.py Outdated
Comment thread tests/module/test__image.py
Comment thread tests/module/test__image.py
@github-actions
Copy link
Copy Markdown

Test coverage results for ac17eb1:

  • 🧩 Unit tests: 74%
  • 📦 Module tests: 55%
  • 🔄 Integration tests: 87%
  • Total coverage: 98%

@kostrykin kostrykin merged commit 22cfce9 into master Dec 30, 2025
10 checks passed
@kostrykin kostrykin deleted the dev/dask_bug branch December 30, 2025 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants