General purpose sq.tl.align() function with STAlign core logic#1162
Open
timtreis wants to merge 7 commits intoscverse:mainfrom
Open
General purpose sq.tl.align() function with STAlign core logic#1162timtreis wants to merge 7 commits intoscverse:mainfrom
sq.tl.align() function with STAlign core logic#1162timtreis wants to merge 7 commits intoscverse:mainfrom
Conversation
Introduces a backend-agnostic alignment API (align_obs, align_images, align_by_landmarks) with STalign and landmark backends, lazy JAX imports, and e2e tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
16c576b to
42d74ab
Compare
- Replace private `sdata._gen_elements()` with public `gen_elements()` - Replace dict-style `sdata[key]` lookup with explicit element-type search - Add subprocess timeout (30s) to lazy-import hygiene test - Document shallow X sharing in `materialise_obs` docstring - Document JAX array retention in stalign metadata comment - Document camelCase convention in STalignRegistrationConfig docstring - Broaden landmark type hints to accept Sequence and np.ndarray - Remove stale TODO comment from _stalign_helpers.py Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3258f6e to
837c258
Compare
- Resolve JAX_DTYPE lazily via jax_dtype() to respect runtime x64 config - Replace 14-line config field unpack with dataclasses.asdict(registration) - Remove unreachable ValueError in _writeback (already validated upstream) - Remove task-tracking comment from moscot stub - Clean up PR-line-number reference in stalign comment Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a hatch-test.py3.13-stable-jax environment that installs the [jax] optional extra so the STalign solver and e2e alignment tests run in CI. Excluded from macOS to avoid doubling runner cost. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
sq.tl.align() function with STAlign core logic
- align_obs: default output_mode="obs" (was "affine", which crashed with the default stalign backend). Auto-generate key_added from query name when not provided for SpatialData inputs. - align_by_landmarks: make cs_name_ref/query and landmarks_ref/query keyword-only required args (were Optional with None defaults that immediately errored). Remove unused scale_ref/scale_query params. Wire get_extent validation for landmark bounds checking against cs extent. Fix docstring (y, x) -> (x, y). - align_images: make img_ref/query_name keyword-only required. Remove from public __all__ (no backend implements it yet). - align_obs docstring: note that inplace only affects SpatialData. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
JAX selects the appropriate device based on its install (CPU/GPU) and runtime context managers. The explicit device arg added unnecessary complexity with no benefit over JAX's built-in device management. Removes device from: align_obs, align_images, AlignBackend protocol, StAlignBackend, MoscotBackend, and require_jax. Simplifies require_jax to a pure import guard. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Implements the following functions:
This registers a spatialdata Affine transformation on every element in cs_b, mapping it into cs_a. After the call, sdata is updated in-place, all elements in section_b now know how to transform into section_a's coordinate system.
output_mode controls what you get back:
Currently dead but will be implemente via STalign. Already in here to better align function internals