refactor: add StainReference transform methods (2/4) - #1280
Draft
selmanozleyen wants to merge 3 commits into
Draft
refactor: add StainReference transform methods (2/4)#1280selmanozleyen wants to merge 3 commits into
selmanozleyen wants to merge 3 commits into
Conversation
selmanozleyen
force-pushed
the
feat/stain-reference-methods
branch
2 times, most recently
from
August 28, 2026 08:07
9e266b1 to
00a2a85
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feat/experimental-params-typeddicts #1280 +/- ##
======================================================================
Coverage ? 79.21%
======================================================================
Files ? 64
Lines ? 9362
Branches ? 1527
======================================================================
Hits ? 7416
Misses ? 1396
Partials ? 550
🚀 New features to boost your workflow:
|
selmanozleyen
force-pushed
the
feat/stain-reference-methods
branch
4 times, most recently
from
August 30, 2026 19:02
1aa949f to
cc0c9ef
Compare
selmanozleyen
added a commit
to selmanozleyen/squidpy
that referenced
this pull request
Aug 30, 2026
Brings in scverse#1279 (params as TypedDicts with their defaults declared on the key), scverse#1280 (StainFit and its methods), the enum-to-Literal pass, and the API page restructuring, so the align work sits on the shape those settle rather than carrying its own copy of it. Conflicts resolved toward the stack for everything it owns: the params, the defaults machinery, the enum conversion and the docs templates all come from there, and the three copies this branch had made of them are dropped. The alignment surface is what this branch adds on top -- the `stalign_align_*` entry points, the fit classes they return, and `rasterize_points`/`sample_volume`. `Stalign*Params` move into `squidpy.types` with the rest. Re-exporting them from `_align._stalign` deadlocked at import: `types` would have imported the implementation package whose `__init__` imports `types`. They are declared there now, like every other params class, and `_stalign` reads them back. `_matches` in the params test grew a tolerant union arm. It walks a key's declared type to check the default against it, and `npt.ArrayLike` unions in protocols that are not `runtime_checkable`, so `isinstance` raised before reaching the `None` arm that actually matched.
selmanozleyen
force-pushed
the
feat/stain-reference-methods
branch
from
August 30, 2026 19:46
44f757b to
2827fc0
Compare
selmanozleyen
force-pushed
the
feat/stain-reference-methods
branch
3 times, most recently
from
August 30, 2026 22:09
4aa0278 to
a60e049
Compare
Public classes in `experimental` declare their kind in the suffix: `*Fit` is an output carrying the operations that apply it, `*Params` is inert input the caller fills in. With `transform` and `decompose` on it, this is a fit by that definition -- and it was the only output class left without the marker, so the index read as if it were a third kind of thing. Deliberately not renamed before this commit: without behaviour it was arguably just a parameter bundle, and the methods are what make `*Fit` honest. `fit_stain_reference() -> StainFit` leaves the verb naming the operation and the noun naming what comes back. The function keeps its name: it fits a stain *reference*, which is what the object is; the suffix says what kind of thing it is, not what it models. No deprecation alias: the module is experimental and says so.
`eq=False` and the explicit `__eq__`/`__hash__` went out with the commit that added the
methods, which left `==` and `hash()` raising on a class that shipped in v1.8.3:
a == b ValueError: truth value of an array ... is ambiguous
hash(a) TypeError: unhashable type: 'numpy.ndarray'
a in [b] ValueError
The dataclass-generated `__eq__` compares field tuples, and comparing array fields is what
raises. `a == a` still answers True by identity short-circuit, so a smoke test passes while
`fit in cohort_fits` blows up on the first non-identical element.
The test that replaced the old one asserted the raising as intended, on the grounds that the
deleted code "silently answered by identity". It did not: it compared `method` plus
element-wise arrays, and the test it replaced asserted exactly that two distinct fits with
equal arrays compare equal. Identity was only ever the *hash*, deliberately, because array
fields cannot produce a value-based one.
selmanozleyen
force-pushed
the
feat/stain-reference-methods
branch
from
August 30, 2026 22:27
a60e049 to
1ba759b
Compare
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.
todo