Pna 2446 compute layouts on the fly in pixelator - #453
Open
elhb wants to merge 10 commits into
Open
Conversation
Keep coarsened_pmds_3d as the default so a later change is one constant. Co-authored-by: Cursor <cursoragent@cursor.com>
Compute coordinates from Component graphs at analysis time so callers can choose the algorithm without a stored layouts table. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep both Unreleased changelog entries: on-the-fly Layouts and summarize_proximity_scores. Co-authored-by: Cursor <cursoragent@cursor.com>
elhb
marked this pull request as ready for review
August 24, 2026 07:01
2D algorithms only emit x and y, so hard-coding z crashed layouts() when add_spherical_norm was enabled. Co-authored-by: Cursor <cursoragent@cursor.com>
diagonal_relaxed concat left markers absent from a Component as null, which broke numeric/plotting use compared with precomputed_layouts(). Co-authored-by: Cursor <cursoragent@cursor.com>
…arsened_pmds_3d pivot count. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 730f607. Configure here.
…mmunities. The fallback reused the coarse-level pivot count on the full graph, so a valid low pivots could still fail pmds_layout's 0.2 * n bound. Co-authored-by: Cursor <cursoragent@cursor.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.

Description
Layouts are now computed on the fly from each Component graph, instead of only being read from a stored
layoutstable (845fa6a3).Before:
pxl_dataset.precomputed_layouts().to_df()After:
pxl_dataset.layouts(...).to_df()PNAPixelDataset.layouts()always computes coordinates from the active Component graphs.It never reads the PXL
layoutstable.Callers choose the Layout algorithm with
algorithm=(defaultcoarsened_pmds_3d, viaDEFAULT_LAYOUT_ALGORITHM), optionalrandom_seed, and other algorithm kwargs.Results export through
.first(),.iterator(),.to_df(), and.to_polars()with the same column shape as stored layouts (including optional spherical norm and marker counts).precomputed_layouts()left as is and still reads the stored table when it exists,precomputed_layouts()is is deprecated and will emitDeprecationWarning.pixelator single-cell-pna layoutremains an opt-in writer of Precomputed layouts.Layout algorithm defaults for
layouts(),layout_coordinates, and the layout CLI all go throughDEFAULT_LAYOUT_ALGORITHM(41c79182).Also in this PR, but not specific to on-the-fly computation (cursor bug bot):
general robustness in
coarsened_pmds_layout/layout_coordinatesthat we hit becauselayouts()now runs the default algorithm on typical Components instead of reading a stored table. These also affect the layout CLI and any othercoarsened_pmds_layout/layout_coordinatescaller:pivots(default 200) fall back to normalized PMDS on the full graph, instead of raising (00dd7c06).pivotsdoes not failpmds_layout's0.2 * nbound (3b7d4f43).layout_coordinates/layouts()acceptseed=as an alias forrandom_seed=(previouslyseed=TypeError'd because algorithms already takeseed=) (730f607b).Fixes: PNA-2446
Type of change
How Has This Been Tested?
tests/pna/pixeldataset/test_layouts.py: default algorithm constant,.layouts()/.first()/.iterator()/.to_df()/.to_polars(), column shape vs precomputed layouts, always-compute (does not read thelayoutstable), kwargs forwarding,seed=vsrandom_seed=, spherical norms (3D and 2D), missing marker counts filled with 0,DeprecationWarningonprecomputed_layouts(), defaultcoarsened_pmds_3don Components smaller than the default pivot count.tests/pna/layout/test_coarsened_pmds_layout.py: graphs smaller than default pivots, Leiden too-few-communities fallback with a valid lowpivots, determinism / validity / neighborhood preservation.tests/common/graph/test_layout_coordinates.py:seed=seeds the default algorithm the same way asrandom_seed=.To reproduce the new tests:
PR checklist:
pyproject.tomland cited it properly