Skip to content

Split SpatialData objects via deconcatenate()#1124

Open
LucaMarconato wants to merge 6 commits into
mainfrom
feature/deconcatenate
Open

Split SpatialData objects via deconcatenate()#1124
LucaMarconato wants to merge 6 commits into
mainfrom
feature/deconcatenate

Conversation

@LucaMarconato
Copy link
Copy Markdown
Member

Follow up on the work from @gboscagli started here #1089.

gboscagli and others added 5 commits March 9, 2026 16:25
- Move deconcatenate() from deconcatenate.py into concatenate.py and
  delete the old module
- Rename full_sdata -> sdata, by -> split_by (now a column name, not a
  value); split_by defaults to region_key inferred from table attrs
- Remove region_key, instance_key, target_coordinate_system and
  sdatas_table_names parameters; infer region_key/instance_key from
  attrs via get_table_keys(); table_name auto-detected when sdata has
  exactly one table
- Replace match_sdata_to_table loop with direct join_spatialelement_table
  calls; use groupby to partition obs in one pass (O(n_obs)) instead of
  per-value boolean filtering (O(n_values * n_obs))
- Always return list[SpatialData] (no more single/list duality)
- Export deconcatenate from spatialdata.__init__
- Rewrite test to use 3 self-contained shape elements and cover the
  split_by non-default column path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@LucaMarconato
Copy link
Copy Markdown
Member Author

@gboscagli I started from your code and reworked a bit. I changed a bit the arguments and tried to infer more parameters by default. Could you try it out/comment please? 😊

@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

❌ Patch coverage is 91.30435% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.04%. Comparing base (835a035) to head (41e1024).

Files with missing lines Patch % Lines
src/spatialdata/_core/concatenate.py 91.30% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1124      +/-   ##
==========================================
- Coverage   92.04%   92.04%   -0.01%     
==========================================
  Files          51       51              
  Lines        7785     7807      +22     
==========================================
+ Hits         7166     7186      +20     
- Misses        619      621       +2     
Files with missing lines Coverage Δ
src/spatialdata/__init__.py 95.65% <ø> (ø)
src/spatialdata/_core/concatenate.py 92.30% <91.30%> (-0.23%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants