You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
value_key is ignored in aggregate() for images #274
This whole message is AI-generated. The issue was automatically discovered and reported by an AI agent (Claude) during an autonomous bug hunt on the spatialdata code base. It has not been verified or triaged by a human yet; the needs: triage label is set so that a maintainer can confirm it. The reproduction script below was executed by the agent in an isolated environment (see Environment) and its output is pasted verbatim.
I re-attempted to reproduce this issue on the current main branch (commit ccf1ea048d054b6624214bf618008a9f9ae223e0) as part of a triage pass over open issues, and confirmed it reproduces.
Reproduction script (PEP 723 inline metadata; run with uv run repro.py, no other setup needed):
# /// script# requires-python = ">=3.12"# dependencies = [# "spatialdata @ git+https://github.com/scverse/spatialdata.git@ccf1ea048d054b6624214bf618008a9f9ae223e0",# ]# ///"""Issue #274: `value_key` is ignored in `aggregate()` when aggregating images by labels(all channels are used)."""importnumpyasnpfromspatialdataimportaggregatefromspatialdata.modelsimportImage2DModel, Labels2DModelimg=Image2DModel.parse(np.random.default_rng(0).random((3, 20, 20)), c_coords=["ch0", "ch1", "ch2"])
lab=np.zeros((20, 20), dtype=np.int32) # uint8 labels crash aggregate(), see #1229lab[2:8, 2:8] =1lab[10:18, 10:18] =2labels=Labels2DModel.parse(lab)
res_all=aggregate(values=img, by=labels, agg_func="mean")
print("no value_key -> var:", res_all["table"].var_names.tolist())
try:
res=aggregate(values=img, by=labels, value_key=["ch1"], agg_func="mean")
var=res["table"].var_names.tolist()
print("value_key=['ch1'] -> var:", var)
honoured=var== ["ch1"]
exceptExceptionase: # noqa: BLE001print("value_key=['ch1'] ->", type(e).__name__, str(e)[:150])
honoured=Noneifhonoured:
print("VERDICT: NOT REPRODUCED (value_key selects the channels)")
elifhonouredisFalse:
print("VERDICT: REPRODUCED (value_key silently ignored for images)")
else:
print("VERDICT: REPRODUCED (value_key not supported for images: raises instead of selecting channels)")
Environment:uv run --no-project --python 3.13, which resolves spatialdata from git+https://github.com/scverse/spatialdata.git@ccf1ea048d054b6624214bf618008a9f9ae223e0 (extra dependencies, if any, are pinned in the script's inline metadata above).
Output (verbatim, only uv package-resolution/install log lines removed):
Activity
LucaMarconato commentedon Sep 13, 2026
I re-attempted to reproduce this issue on the current
mainbranch (commitccf1ea048d054b6624214bf618008a9f9ae223e0) as part of a triage pass over open issues, and confirmed it reproduces.Reproduction script (PEP 723 inline metadata; run with
uv run repro.py, no other setup needed):Environment:
uv run --no-project --python 3.13, which resolvesspatialdatafromgit+https://github.com/scverse/spatialdata.git@ccf1ea048d054b6624214bf618008a9f9ae223e0(extra dependencies, if any, are pinned in the script's inline metadata above).Output (verbatim, only
uvpackage-resolution/install log lines removed):Agent's severity assessment: medium (see the
priority: *label added to this issue).Automatically generated; discovered by an AI agent (Claude) and not yet reviewed by a human.