Scale transform changes aggregate results
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 68/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
从提供的 Python 示例开始,查看涵盖坐标系、变换和聚合的教程。确认 Scale 如何改变 sum 和 mean 的聚合结果,然后更新相关教程,明确说明目标坐标系的影响,并验证示例仍然易于理解。
由索引模型根据 Issue 内容生成。
描述
Hey everyone,
as mentioned on Zulip I am using macsima data, where the macsima reader by default adds the Scale transformation to the coordinate system. I noticed that when I remove this my aggregation results are slightly different. This is most prominent for small signals, for larger signals it is not so pronounced. My original use case was for the mean intensity. For sum its very obvious that the absolute values change due to the transform, but the ratios stay similar.
Of course I understand that it makes sense to apply the transform before doing the aggregation, since they are intended for example for aligning my labels with the image. Still it was a bit unintuitive for me that this happens as a new user. Maybe this could be highlighted also a bit more in the tutorials. As requested below is a small example.
import spatialdata as sd
from spatialdata.datasets import blobs
from spatialdata.transformations import set_transformation, Scale
sdata = blobs()
# set scale transformation to new coordinate system. global coord system has Identity transform
scale_transform = Scale([0.1, 0.1], ("x", "y"))
set_transformation(sdata["blobs_image"], transformation=scale_transform, to_coordinate_system="scaled")
set_transformation(sdata["blobs_labels"], transformation=scale_transform, to_coordinate_system="scaled")
global_sum = sdata.aggregate(values="blobs_image", by="blobs_labels", target_coordinate_system="global")
print(global_sum["table"].X[:1])
#<Compressed Sparse Row sparse matrix of dtype 'float64'
# with 3 stored elements and shape (1, 3)>
# Coords Values
# (0, 0) 1309.3692551660652
# (0, 1) 1587.8641823936478
# (0, 2) 3125.1190857645483
scaled_sum = sdata.aggregate(values="blobs_image", by="blobs_labels", target_coordinate_system="scaled")
print(scaled_sum["table"].X[:1])
#<Compressed Sparse Row sparse matrix of dtype 'float64'
# with 3 stored elements and shape (1, 3)>
# Coords Values
# (0, 0) 12.758250581405642
# (0, 1) 15.427204091295
# (0, 2) 31.23271691509622
global_mean = sdata.aggregate(values="blobs_image", by="blobs_labels", agg_func="mean", target_coordinate_system="global")
print(global_mean["table"].X[:1])
#<Compressed Sparse Row sparse matrix of dtype 'float64'
# with 3 stored elements and shape (1, 3)>
# Coords Values
# (0, 0) 0.08696083251418378
# (0, 1) 0.10545687603066001
# (0, 2) 0.20755257260839133
scaled_mean = sdata.aggregate(values="blobs_image", by="blobs_labels", agg_func="mean", target_coordinate_system="scaled")
print(scaled_mean["table"].X[:1])
#<Compressed Sparse Row sparse matrix of dtype 'float64'
# with 3 stored elements and shape (1, 3)>
# Coords Values
# (0, 0) 0.08449172570467313
# (0, 1) 0.10216691451188742
# (0, 2) 0.2068391848681869
- 主要语言
- Python
- 星标
- 394
- 派生
- 95
- 平均合并
- 5 天 9 小时
- 30 天内合并 PR
- 3
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
scverse/spatialdata 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
scverse/spatialdata#1256 ·
维护者通常 2 天内回复
-
bug 🚨 element: labels 🏷️ method: aggregation 🔢 needs: triage priority: medium
难度 2/5 1-3 小时 新手友好度 68/100
scverse/spatialdata#1249 ·
维护者通常 2 天内回复
-
bug 🚨 element: images 🌌 element: labels 🏷️ needs: triage
难度 2/5 1-3 小时 新手友好度 78/100
scverse/spatialdata#1239 ·
维护者通常 2 天内回复
-
bug 🚨 element: shapes ▲ models needs: triage priority: medium
难度 2/5 1-3 小时 新手友好度 78/100
scverse/spatialdata#1234 ·
维护者通常 2 天内回复
-
bug 🚨 element: labels 🏷️ method: aggregation 🔢 needs: triage priority: medium
难度 2/5 1-3 小时 新手友好度 78/100
scverse/spatialdata#1230 ·
维护者通常 2 天内回复
查看 scverse/spatialdata 的全部 Issue
相似的 Issue
-
namespace operations
难度 1/5 1 小时以内 新手友好度 82/100
EclipseFdn/open-vsx.org#13573 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
collective/icalendar#1854 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
rancher/rancher-ai-agent#412 ·
维护者通常 6 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
TUDelftGeodesy/DePSI#134 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
HenriquesLab/rxiv-maker#335 ·