Repository navigation
spatiomic 0.10.1: map cluster colors by label, support unassigned pixels - #29
Merged
Merged
Conversation
- Show each cluster in the color with the same index in a ListedColormap in cluster_image, save_cluster_image, cluster_legend, cluster_selection, save_cluster_selection, som_clusters and the cluster_scatter and connectivity_graph colorbars, instead of scaling the colormap to the labels present in each image. Colormap names and continuous colormaps are still spread from label 0 to the highest label. - Support unassigned pixels (-1, no nearest SOM node under the cosine or correlation metric): transparent in cluster plots, skipped by cluster_location, vicinity_composition and autocorrelation, assigned to no cluster by local_heteroskedasticity, rejected by local_autocorrelation. vicinity_composition permutations keep them in place. - Accept integer labels of any dtype (int32 labels from Som.label were rejected) and raise TypeError/ValueError instead of AssertionError. - Run the mypy pre-commit hook in the project environment (uv run) instead of whichever mypy is on the PATH. - Rerun the full_example, scverse, segment and spatial tutorials. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #29 +/- ##
==========================================
+ Coverage 78.73% 78.94% +0.21%
==========================================
Files 54 55 +1
Lines 1876 1890 +14
==========================================
+ Hits 1477 1492 +15
+ Misses 399 398 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Release 0.10.1. Release notes:
docs/source/release-notes/0.10.1.md.Bug fixes
so.plot.cluster_image,save_cluster_image,cluster_legend,cluster_selection,save_cluster_selection,som_clustersand the colorbars ofcluster_scatterandconnectivity_graphnow show each cluster in the color with the same index in the colormap. Before, the colormap was scaled to the range of labels present in each image, so images that lacked the highest cluster labels, or that contained unassigned pixels, showed clusters in the colors of other clusters. Colormap names and continuous colormaps, e.g.,colormap="flag"for segmentation masks with many labels, are still spread from label 0 to the highest label.so.dimension.som().labelsince 0.10.0. They are now handled throughout:cluster_selection), andcluster_locationdoes not show them as a cluster.so.spatial.vicinity_compositioncounts them neither as a cluster nor as a neighbor, and its permutation test keeps them in place.so.spatial.autocorrelationdoes not analyse them as a cluster, andso.spatial.local_heteroskedasticityassigns them to no cluster.so.spatial.local_autocorrelation, which operates on the label values, raises aValueErrorfor them.vicinity_composition,autocorrelationandlocal_autocorrelationrejected theint32labels returned byso.dimension.som().labelsince 0.10.0. Invalid clustered images now raise aTypeErrororValueErrorinstead of anAssertionError.Docs
Reruns the
full_example,scverse,segmentandspatialtutorials with 0.10.x.Testing
ruff,ruff format,mypy -p spatiomic,bandit: cleantest/plot/test_cluster_image.pychecks the exact colors drawn and saved, including unassigned pixels, missing labels and continuous colormaps; spatial tests check that results with unassigned pixels equal those with an extra cluster that is then dropped.uv run mypy); before, it used whichever mypy was on the PATH.🤖 Generated with Claude Code