Skip to content
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

Update optimized Delta codec for bool #595

Merged
merged 3 commits into from
Oct 12, 2024

Conversation

jakirkham
Copy link
Member

Previously bool just worked with Delta. However this was not actually tested. The optimized version switched to np.subtract for in-place computation, which works for other types. Though bool needs special handling. Fortunately this can be done with np.not_equal, which has the same behavior.

Also include a test for bool data to make sure this is handled correctly going forward.

TODO:

  • Unit tests and/or doctests in docstrings
  • Tests pass locally
  • Docstrings and API docs for any new/modified user-facing classes and functions
  • Changes documented in docs/release.rst
  • Docs build locally
  • GitHub Actions CI passes
  • Test coverage to 100% (Codecov passes)

Previously `bool` just worked with `Delta`. However this was not
actually tested. The optimized version switched to `np.subtract` for
in-place computation, which works for other types. Though `bool` needs
special handling. Fortunately this can be done with `np.not_equal`,
which has the same behavior.

Also include a test for `bool` data to make sure this is handled
correctly going forward.
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.91%. Comparing base (9518e0b) to head (cf6fde0).
Report is 62 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #595   +/-   ##
=======================================
  Coverage   99.91%   99.91%           
=======================================
  Files          59       59           
  Lines        2332     2334    +2     
=======================================
+ Hits         2330     2332    +2     
  Misses          2        2           
Files with missing lines Coverage Δ
numcodecs/delta.py 100.00% <100.00%> (ø)
numcodecs/tests/test_delta.py 100.00% <ø> (ø)

@jakirkham
Copy link
Member Author

Closing and reopening to retry RTD (as it didn't run)

@jakirkham jakirkham closed this Oct 10, 2024
@jakirkham jakirkham reopened this Oct 10, 2024
@jakirkham
Copy link
Member Author

Closing and reopening as AppVeyor came up (we don't use that any more)

@jakirkham jakirkham closed this Oct 10, 2024
@jakirkham jakirkham reopened this Oct 10, 2024
This is a bit more succinct and gets to the core point. Namely
`arr.dtype` determines this code path.

Also comparing directly to `bool` works here. It is a bit faster as well
since we need not construct an `np.dtype` object.
@jakirkham
Copy link
Member Author

Sorry for the CI related noise

This is now ready! 😀

@dstansby dstansby merged commit c283106 into zarr-developers:main Oct 12, 2024
30 checks passed
@jakirkham jakirkham deleted the fix_delta_bool branch October 12, 2024 11:19
@ehgus ehgus mentioned this pull request Dec 3, 2024
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.

3 participants