@@ -0,0 +1,1158 @@
+# -*- coding: utf-8 -*-%0A#%0A# Copyright (c) 2014-2015, Ghislain Antony Vaillant%0A# All rights reserved.%0A#%0A# This file is distributed under the BSD License, see the LICENSE file or%0A# checkout the license terms at http://opensource.org/licenses/BSD-2-Clause).%0A%0Afrom __future__ import absolute_import, division, print_function%0A%0Aimport bitstring%0Aimport numpy%0A%0A%0Aclass BitMaskWrapper(object):%0A    %0A    def __init__(self, array, *args, **kwargs):%0A        self._array = array%0A        self._bitmask = bitstring.BitArray(bytes=self._array.tostring())%0A        %0A    def clear(self, indices=None):%0A        if indices is not None:%0A            self._bitmask.set(False, indices)%0A        else:%0A            self._bitmask%5B:%5D = False%0A    %0A    def set(self, indices=None):%0A        if indices is not None:%0A            self._bitmask.set(True, indices)%0A        else:%0A            self._bitmask%5B:%5D = True%0A    %0A    def is_set(self, indice):%0A        return self._bitmask%5Bindice%5D%0A    %0A    def count(self):%0A        return self._bitmask.count(True)%0A        %0A    def _update(self):%0A        self._array.ravel()%5B:%5D = numpy.fromstring(self._bitmask.tobytes(),%0A            dtype=self._array.dtype)

add support module for bit mask like manipulation