Skip to content

Reject float-dtype labels with clear error in render_labels#650

Merged
timtreis merged 1 commit intomainfrom
fix/issue-606-float-labels-error
May 8, 2026
Merged

Reject float-dtype labels with clear error in render_labels#650
timtreis merged 1 commit intomainfrom
fix/issue-606-float-labels-error

Conversation

@timtreis
Copy link
Copy Markdown
Member

@timtreis timtreis commented May 8, 2026

Summary

  • render_labels previously passed float-dtype label arrays straight into skimage's map_array, which raised a cryptic TypeError: The dtype of an array to be remapped should be integer. with no spatialdata-plot frame, no element name, and no hint to cast.
  • Adds an early ValueError in _render_labels (after multiscale resolution, before rasterize) that names the element, reports the dtype, and shows a cast example.

Closes #606

Previously render_labels passed float-dtype label arrays straight into
skimage's map_array, which raised a cryptic
"TypeError: The dtype of an array to be remapped should be integer."
with no spatialdata-plot frame, no element name, and no hint to cast.

Add an early ValueError in _render_labels (after multiscale resolution)
that names the element, reports the dtype, and shows a cast example.

Closes #606
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.89%. Comparing base (5e6f3a9) to head (21ba219).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #650      +/-   ##
==========================================
+ Coverage   76.85%   76.89%   +0.04%     
==========================================
  Files          11       11              
  Lines        3275     3277       +2     
  Branches      773      774       +1     
==========================================
+ Hits         2517     2520       +3     
  Misses        457      457              
+ Partials      301      300       -1     
Files with missing lines Coverage Δ
src/spatialdata_plot/pl/render.py 86.84% <100.00%> (+0.03%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@timtreis timtreis merged commit 27728a1 into main May 8, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

render_labels crashes with cryptic skimage TypeError when label array has float dtype

2 participants