Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion numcodecs/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ def encode(self, buf):

# compute differences
# using np.subtract for in-place operations
np.subtract(arr[1:], arr[0:-1], out=enc[1:])
if self.dtype == np.dtype("bool"):
np.not_equal(arr[1:], arr[0:-1], out=enc[1:])
else:
np.subtract(arr[1:], arr[0:-1], out=enc[1:])

return enc

Expand Down
1 change: 1 addition & 0 deletions numcodecs/tests/test_delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# mix of shapes: 1D, 2D, 3D
# mix of orders: C, F
arrays = [
np.random.randint(0, 1, size=110, dtype='?').reshape(10, 11),
np.arange(1000, dtype='<i4'),
np.linspace(1000, 1001, 1000, dtype='<f4').reshape(100, 10),
np.random.normal(loc=1000, scale=1, size=(10, 10, 10)).astype('<f8'),
Expand Down
Loading