-
Notifications
You must be signed in to change notification settings - Fork 0
Add stats.is_constant #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #21 +/- ##
==========================================
+ Coverage 95.53% 96.95% +1.41%
==========================================
Files 9 11 +2
Lines 112 164 +52
==========================================
+ Hits 107 159 +52
Misses 5 5 ☔ View full report in Codecov by Sentry. |
CodSpeed Performance ReportMerging #21 will not alter performanceComparing Summary
Benchmarks breakdown
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good TODO
I can look into why the above works |
tests/test_stats.py
Outdated
@pytest.mark.array_type(Flags.Dask) | ||
def test_is_constant_dask( | ||
dask_viz: Callable[[object], None], array_type: ArrayType[types.DaskArray, Any] | ||
) -> None: | ||
"""Tests if is_constant works if each chunk is individually constant.""" | ||
x_np = np.repeat(np.repeat(np.arange(4).reshape(2, 2), 2, axis=0), 2, axis=1) | ||
x = array_type(x_np) | ||
assert x.blocks.shape == (2, 2) | ||
assert all(stats.is_constant(block).compute() for block in x.blocks.ravel()) | ||
|
||
result = stats.is_constant(x, axis=None) | ||
dask_viz(result) | ||
assert result.compute() is False # type: ignore[no-untyped-call] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this test be renamed to something maybe more informative (test_dask_constant_blocks
?), and then the other test be updated to use dask? Am I missing something or does the test_is_constant
one skip dask?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it doesn’t, this one just tests a specific possible failure in dask, so I should definitely rename it.
Fixes #28
I don‘t actually understand why the dask tests pass, but they do.
@ilan-gold @Intron7 can you help me understand why this works?
fast-array-utils/tests/test_stats.py
Lines 123 to 133 in 19a4187
TODO: