[1/3] Bundle TilingQCParams; add resolve_labels_array helper#1188
Merged
Conversation
added 2 commits
May 27, 2026 23:25
Collapse three tuning kwargs (distance_tol, min_area, max_contour_points) on calculate_tiling_qc into a single tiling_qc_params bundle backed by a TilingQCParams dataclass with validation and numpy-scalar coercion. adata.uns["tiling_qc"] nests them under "tiling_qc_params" instead of storing them flat. Introduce experimental/utils/_labels.py with resolve_labels_array as a private helper for the QC's multi-scale branch (and future labels pipelines). Breaking: drops the three flat kwargs and changes the uns schema; parent feature scverse#1157 merged unreleased so no deprecation shim.
- Freeze TilingQCParams so post-construction mutation cannot bypass __post_init__ validation - Return the _QC_DEFAULTS singleton from _resolve_qc_params(None) instead of allocating a fresh instance; hoist the field-name set to module scope - Move the "scale ignored for single-scale" warning into resolve_labels_array so the QC caller no longer duplicates the isinstance(xr.DataTree) dispatch - Note in the helper docstring why we have a strict variant alongside the existing get_element_data - Use backtick-quoted parameter names in validation error messages to match calculate_tiling_qc's own error style - Add a regression test locking the multi-scale-without-scale ValueError
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1188 +/- ##
==========================================
+ Coverage 74.52% 74.68% +0.15%
==========================================
Files 51 52 +1
Lines 7581 7619 +38
Branches 1270 1277 +7
==========================================
+ Hits 5650 5690 +40
+ Misses 1422 1420 -2
Partials 509 509
🚀 New features to boost your workflow:
|
Sphinx builds with -W (warnings as errors); the :meth: role tried to resolve __post_init__ as a documented method and failed, breaking the Read the Docs build. Use a plain literal instead -- renders identically, no target to resolve. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
selmanozleyen
approved these changes
May 29, 2026
Member
selmanozleyen
left a comment
There was a problem hiding this comment.
Looks like a nice refactor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 1/3 of the #1170 split.
adata.uns["tiling_qc"]no longer carries flatdistance_tol/min_area/max_contour_points; they live under["tiling_qc_params"].Also adds a private
resolve_labels_arrayhelper inexperimental/utils/_labels.py(consumed here, reused by PR-B/PR-C). A strict variant of the existingget_element_data— fail-loud rather than fall-back, so downstream label pipelines can't silently pick the wrong scale.PR-B will add
stitch_tile_cuts+StitchParamsand the QC-side warning hook. PR-C will addmake_stitched_labels.