[Numpy-discussion] Adding count parameter to unpackbits (PR-10855)
sebastian at sipsolutions.net
Thu Feb 21 16:37:52 EST 2019
I was about to merge it, but was noot sure it was really discussed
before (and it would be a long time ago). The pull requests:
Proposes to add a count parameter to unpackbits:
``count`` allows subsetting the number of bits that will be unpacked up-front,
rather than reshaping and subsetting later, making the ``packbits`` operation
invertible, and the unpacking less wasteful. Counts larger than the number of
available bits add zero padding. Negative counts trim bits off the end instead
of counting from the beginning. None counts implement the existing behavior of
This seems like a pretty small API addition, but I thought I would ping
the list again before merging in case anyone objects to it or feels it
should be modified.
In other words, the count parameter is much the same as indexing the
although it will zero pad if count is out of bounds. Which is necessary
if it is to invert a `np.packbits` when less than 8 bits are packed.
If no one speaks up, I plan to merge it soon.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 833 bytes
Desc: This is a digitally signed message part
More information about the NumPy-Discussion