Skip to content

fixes inconsist variance output between in-memory and dask for groups of size 1#4184

Draft
zboldyga wants to merge 2 commits into
scverse:mainfrom
zboldyga:zb/aggregate-singleton-dof
Draft

fixes inconsist variance output between in-memory and dask for groups of size 1#4184
zboldyga wants to merge 2 commits into
scverse:mainfrom
zboldyga:zb/aggregate-singleton-dof

Conversation

@zboldyga

Copy link
Copy Markdown
Contributor
  • Closes #
  • [ x] Tests included or not required because:

… of size 1 (in-memory: 0, dask:NaN). Both now produce NaN, as per numpy (and I think this was the former scanpy value as well? + it's sensible when dof=1 on a single sample).

Resolving also entailed adjusting the dask per-block moment computation to prevent NaN from corrupting the variance computation (e.g. if one or more blocks has 1 item).

Kind of a pedantic fix, but seemed like an inconsistency that would cause a little confusion / friction in the long run.
@zboldyga

Copy link
Copy Markdown
Contributor Author

@ilan-gold see commit message for clarity on what this addresses

@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.72%. Comparing base (68eeb6a) to head (5503bb2).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4184   +/-   ##
=======================================
  Coverage   79.72%   79.72%           
=======================================
  Files         120      120           
  Lines       12833    12834    +1     
=======================================
+ Hits        10231    10232    +1     
  Misses       2602     2602           
Flag Coverage Δ
hatch-test.low-vers 78.78% <60.00%> (-0.01%) ⬇️
hatch-test.pre 79.58% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/scanpy/get/_aggregated.py 93.43% <100.00%> (+0.02%) ⬆️

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.

1 participant