Clear errors at the edges, and one read that should not happen - #106
Merged
Merged
Conversation
n_components=1 fitted one component and then read embedding[:, 1], so the caller saw an IndexError from inside matplotlib's argument rather than the parameter that was wrong. Closes #54.
pl.transport read levels[-1] off an empty table. Its siblings pl.subpopulation_hits and pl.pathway_coherence both raise a ValueError naming what produced nothing, and an empty table is a plausible result when no pair of settings is comparable. Closes #55.
numpy's nan-functions raise theirs through warnings.warn, not through the floating-point error state, so np.errstate never reached them: a feature that failed on every cell left three RuntimeWarnings in the caller's output. The catch_warnings idiom here is the one pp/_qc.py already uses. Closes #57.
np.empty_like(get_matrix(adata, layer)) read every row to learn a shape and a dtype it then threw away, which on a backed object is a full read on top of the per-group reads the streaming path was written to do. Closes #67.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #106 +/- ##
=======================================
Coverage 89.05% 89.06%
=======================================
Files 80 80
Lines 5884 5887 +3
=======================================
+ Hits 5240 5243 +3
Misses 644 644
🚀 New features to boost your workflow:
|
Three plots repeated the same two lines after _table handed them a frame, with only the trailing reason differing, so pl._common.table takes it as when_empty and both halves of the contract live beside each other.
pp.filter_features and feature_select's variance_threshold state the same rule, and _qc's comment says they must agree, so the wrapper belongs in _core._stats rather than in both. np.errstate is not part of it: numpy delivers a floating point invalid through warnings.warn as a RuntimeWarning, which the filter already ignores.
…ogether adata.shape is the shape. The two read-counting tests differed only in which function they called, so they are one parametrized test, without the dtype and shape assertions test_reduce already makes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four review findings, one commit each, all independent.
pl.control_driftatn_components=1fitted one component and then readembedding[:, 1]; it now raises aValueErrornaming the parameter and the two it draws. Closes pl.control_drift raises a bare IndexError at n_components=1 #54.pl.transporton an empty table readlevels[-1]; it now raises aValueErrorsaying the table is empty, aspl.subpopulation_hitsandpl.pathway_coherencedo. Closes pl.transport raises IndexError on an empty transport table #55.pp/_select.pyguarded three nan-functions withnp.errstate, which does not reach warnings numpy raises throughwarnings.warn, so an all-NaN feature leaked threeRuntimeWarnings. They now use thecatch_warningsidiom frompp/_qc.py. Closes np.errstate does not suppress numpy's all-NaN RuntimeWarnings in pp/_select.py #57.transform_groupedsized its output withnp.empty_like(get_matrix(adata, layer)), reading the whole matrix to learn a shape; on a backed object that is a full read discarded before the streaming path starts. Closes transform_grouped reads the whole matrix to size its output, defeating the backed path #67.A test per fix, each verified to fail on
mainand pass here.test_backed.py's read-counting setup is now areadsfixture, shared by the existing test and the new one.