Python bitarray.bitarray() Examples

The following are 30 code examples of bitarray.bitarray(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module bitarray , or try the search function .
Example #1
Source File: test_bitmatrix.py    From BIGSI with MIT License 6 votes vote down vote up
def test_get_insert_column():
    rows = [
        bitarray("001"),
        bitarray("001"),
        bitarray("111"),
        bitarray("001"),
        bitarray("111"),
    ] * 5
    for storage in get_storages():
        storage.delete_all()
        bm = BitMatrix.create(storage, rows, len(rows), len(rows[0]))
        assert bm.get_column(0) == bitarray("00101" * 5)
        bm.insert_column(bitarray("1" * 25), 0)
        assert bm.get_column(0) == bitarray("1" * 25)

        assert bm.get_row(1) == bitarray("101")
        bm.insert_column(bitarray("1" * 25), 3)
        assert bm.get_column(3) == bitarray("1" * 25)
        assert bm.get_row(1) == bitarray("1011") 
Example #2
Source File: lx9.py    From basil with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def program_global_reg(self):
        """
        Send the global register to the chip.

        Loads the values of self['GLOBAL_REG'] onto the chip.
        Includes enabling the clock, and loading the Control (CTR)
        and DAC shadow registers.

        """

        self._clear_strobes()

        gr_size = len(self['GLOBAL_REG'][:])  # get the size
        self['SEQ']['SHIFT_IN'][0:gr_size] = self['GLOBAL_REG'][:]  # this will be shifted out
        self['SEQ']['GLOBAL_SHIFT_EN'][0:gr_size] = bitarray(gr_size * '1')  # this is to enable clock
        self['SEQ']['GLOBAL_CTR_LD'][gr_size + 1:gr_size + 2] = bitarray("1")  # load signals
        self['SEQ']['GLOBAL_DAC_LD'][gr_size + 1:gr_size + 2] = bitarray("1")

        # Execute the program (write bits to output pins)
        # + 1 extra 0 bit so that everything ends on LOW instead of HIGH
        self._run_seq(gr_size + 3) 
Example #3
Source File: lx9.py    From basil with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def program_pixel_reg(self, enable_receiver=True):
        """
        Send the pixel register to the chip and store the output.

        Loads the values of self['PIXEL_REG'] onto the chip.
        Includes enabling the clock, and loading the Control (CTR)
        and DAC shadow registers.

        if(enable_receiver), stores the output (by byte) in
        self['DATA'], retrievable via `chip['DATA'].get_data()`.

        """

        self._clear_strobes()

        # enable receiver it work only if pixel register is enabled/clocked
        self['PIXEL_RX'].set_en(enable_receiver)

        px_size = len(self['PIXEL_REG'][:])  # get the size
        self['SEQ']['SHIFT_IN'][0:px_size] = self['PIXEL_REG'][:]  # this will be shifted out
        self['SEQ']['PIXEL_SHIFT_EN'][0:px_size] = bitarray(px_size * '1')  # this is to enable clock

        print('px_size = {}'.format(px_size))

        self._run_seq(px_size + 1)  # add 1 bit more so there is 0 at the end other way will stay high 
Example #4
Source File: transpose.py    From BIGSI with MIT License 6 votes vote down vote up
def transpose_low_mem(bitarrays):
    logger.info("Using slow, low memory transpose")
    # Takes a list of bitarrays and returns the transpose as a list of
    # bitarrays
    x = len(bitarrays)
    y = bitarrays[0].length()
    logger.info("BFM dims %i %i" % (x, y))

    tbitarrays = []
    for ii in range(y):
        ba = bitarray(x)
        ba.setall(False)
        tbitarrays.append(ba)
    for i in range(x):
        for j in range(y):
            tbitarrays[j][i] = bitarrays[i][j]
    return tbitarrays 
Example #5
Source File: pixel.py    From basil with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def program_global_reg(self):
        """
        Send the global register to the chip.

        Loads the values of self['GLOBAL_REG'] onto the chip.
        Includes enabling the clock, and loading the Control (CTR)
        and DAC shadow registers.

        """

        self._clear_strobes()

        gr_size = len(self['GLOBAL_REG'][:])  # get the size
        self['SEQ']['SHIFT_IN'][0:gr_size] = self['GLOBAL_REG'][:]  # this will be shifted out
        self['SEQ']['GLOBAL_SHIFT_EN'][0:gr_size] = bitarray(gr_size * '1')  # this is to enable clock
        self['SEQ']['GLOBAL_CTR_LD'][gr_size + 1:gr_size + 2] = bitarray("1")  # load signals
        self['SEQ']['GLOBAL_DAC_LD'][gr_size + 1:gr_size + 2] = bitarray("1")

        # Execute the program (write bits to output pins)
        # + 1 extra 0 bit so that everything ends on LOW instead of HIGH
        self._run_seq(gr_size + 3) 
Example #6
Source File: TrackRegister.py    From basil with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def write(self, size=-1):
        if size == -1:
            size = self._conf["seq_size"]

        bv = bitarray(self._conf["seq_width"] * size)
        for i in range(size):
            for track in self._conf['tracks']:
                bit = 0
                if self._conf["seq_width"] >= 8:
                    bit = i * self._conf["seq_width"] + self._conf["seq_width"] - 1 - track['position']
                elif self._conf["seq_width"] == 4:
                    if i % 2 == 0:
                        bit = (i + 1) * self._conf["seq_width"] + self._conf["seq_width"] - 1 - track['position']
                    else:
                        bit = (i - 1) * self._conf["seq_width"] + self._conf["seq_width"] - 1 - track['position']
                else:
                    raise NotImplementedError("To be implemented.")
                bv[bit] = self._tracks[track['name']][i]

        ba = utils.bitarray_to_byte_array(bv)
        ba = ba[::-1]
        # TODO: this probably has to be done different way
        self._drv.set_data(ba) 
Example #7
Source File: test_Sim.py    From basil with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def test_simple(self):
        input_arr = bitarray('10' * 64)

        self.chip['PIXEL_REG'][:] = input_arr
        self.chip['PIXEL_REG'][0] = 0
        self.chip.program_pixel_reg()

        ret = self.chip['DATA'].get_data()

        data0 = ret.astype(np.uint8)
        data1 = np.right_shift(ret, 8).astype(np.uint8)
        data = np.reshape(np.vstack((data1, data0)), -1, order='F')
        bdata = np.unpackbits(data)

        input_arr[0] = 0

        self.assertEqual(input_arr.tolist(), bdata.tolist()) 
Example #8
Source File: apiutils.py    From aurum-datadiscovery with MIT License 6 votes vote down vote up
def _compute_coverage_scores(self):
        # Get total number of ORIGIN elements FIXME: (not KW, etc)
        (leafs, _) = self._provenance.get_leafs_and_heads()
        total_number = len(leafs)

        i = 0
        for origin in leafs:
            # Assign index to original values
            self._origin_values_coverage[origin] = i
            i += 1

        for el in self.data:
            # initialize coverage set to False
            coverage_set = bitarray(len(leafs))
            coverage_set.setall(False)
            # Get covered elements
            elements = self.why(el)
            for element_covered in elements:
                idx = self._origin_values_coverage[element_covered]
                coverage_set[idx] = True
            coverage = float(len(elements)) / float(total_number)
            self._rank_data[el]['coverage_score'] = (coverage, coverage_set) 
Example #9
Source File: test_bitmatrix.py    From BIGSI with MIT License 6 votes vote down vote up
def test_get_set():
    rows = [
        bitarray("001"),
        bitarray("001"),
        bitarray("111"),
        bitarray("001"),
        bitarray("111"),
    ] * 5
    for storage in get_storages():
        storage.delete_all()
        bm = BitMatrix.create(storage, rows, len(rows), len(rows[0]))
        bm.set_rows(range(25), rows)
        assert list(bm.get_rows(range(3))) == rows[:3]
        assert bm.get_column(0) == bitarray("00101" * 5)
        assert bm.get_column(2) == bitarray("1" * 25)
        assert list(bm.get_columns([0, 2])) == [
            bitarray("00101" * 5),
            bitarray("1" * 25),
        ] 
Example #10
Source File: bptc.py    From dmr_utils with GNU General Public License v3.0 6 votes vote down vote up
def decode_emblc(_elc):
    
    _binlc = bitarray(endian='big')
    _binlc.extend([_elc[0],_elc[8], _elc[16],_elc[24],_elc[32],_elc[40],_elc[48],_elc[56],_elc[64],_elc[72] ,_elc[80]])
    _binlc.extend([_elc[1],_elc[9], _elc[17],_elc[25],_elc[33],_elc[41],_elc[49],_elc[57],_elc[65],_elc[73] ,_elc[81]])
    _binlc.extend([_elc[2],_elc[10],_elc[18],_elc[26],_elc[34],_elc[42],_elc[50],_elc[58],_elc[66],_elc[74]])
    _binlc.extend([_elc[3],_elc[11],_elc[19],_elc[27],_elc[35],_elc[43],_elc[51],_elc[59],_elc[67],_elc[75]])
    _binlc.extend([_elc[4],_elc[12],_elc[20],_elc[28],_elc[36],_elc[44],_elc[52],_elc[60],_elc[68],_elc[76]])
    _binlc.extend([_elc[5],_elc[13],_elc[21],_elc[29],_elc[37],_elc[45],_elc[53],_elc[61],_elc[69],_elc[77]])
    _binlc.extend([_elc[6],_elc[14],_elc[22],_elc[30],_elc[38],_elc[46],_elc[54],_elc[62],_elc[70],_elc[78]])
    
    return(_binlc.tobytes())

#------------------------------------------------------------------------------
# BPTC Embedded LC Encoding Routines
#------------------------------------------------------------------------------


# Accepts 12 byte LC header + 5-bit checksum, converts to binary and builts out the BPTC
# encoded result with hamming(16,11,4) and parity. 
Example #11
Source File: bptc.py    From dmr_utils with GNU General Public License v3.0 6 votes vote down vote up
def encode_19696(_data):
    # Create a bitarray from the 4 bytes of LC data (includes RS1293 ECC)
    _bdata = bitarray(endian='big')
    _bdata.frombytes(_data)
    
    # Insert R0-R3 bits
    for i in xrange(4):
        _bdata.insert(0, 0)
    
    # Get row hamming 15,11,3 and append. +1 is to account for R3 that makes an even 196bit string
    for index in xrange(9):
        spos = (index*15) + 1
        epos= spos + 11
        _rowp = hamming.enc_15113(_bdata[spos:epos])
        for pbit in xrange(4):
            _bdata.insert(epos+pbit,_rowp[pbit])
    
    # Get column hamming 13,9,3 and append. +1 is to account for R3 that makes an even 196bit string
    # Pad out the bitarray to a full 196 bits. Can't insert into 'columns'
    for i in xrange(60):
        _bdata.append(0)
    
    column = bitarray(9, endian='big')  # Temporary bitarray to hold column data
    for col in xrange(15):
        spos = col + 1
        for index in xrange(9):
            column[index] = _bdata[spos]
            spos += 15
        _colp = hamming.enc_1393(column)
        
        # Insert bits into matrix...
        cpar = 136 + col                # Starting location in the matrix for column bits
        for pbit in xrange(4):
            _bdata[cpar] =  _colp[pbit]
            cpar += 15

    return _bdata 
Example #12
Source File: bptc.py    From dmr_utils with GNU General Public License v3.0 6 votes vote down vote up
def decode_full_lc(_data):
    binlc = bitarray(endian='big')   
    binlc.extend([_data[136],_data[121],_data[106],_data[91], _data[76], _data[61], _data[46], _data[31]])
    binlc.extend([_data[152],_data[137],_data[122],_data[107],_data[92], _data[77], _data[62], _data[47], _data[32], _data[17], _data[2]  ])
    binlc.extend([_data[123],_data[108],_data[93], _data[78], _data[63], _data[48], _data[33], _data[18], _data[3],  _data[184],_data[169]])
    binlc.extend([_data[94], _data[79], _data[64], _data[49], _data[34], _data[19], _data[4],  _data[185],_data[170],_data[155],_data[140]])
    binlc.extend([_data[65], _data[50], _data[35], _data[20], _data[5],  _data[186],_data[171],_data[156],_data[141],_data[126],_data[111]])
    binlc.extend([_data[36], _data[21], _data[6],  _data[187],_data[172],_data[157],_data[142],_data[127],_data[112],_data[97], _data[82] ])
    binlc.extend([_data[7],  _data[188],_data[173],_data[158],_data[143],_data[128],_data[113],_data[98], _data[83]])
    '''
    This is the rest of the Full LC data -- the RS1293 FEC that we don't need
     _data[68],_data[53],_data[174],_data[159],_data[144],_data[129],_data[114],_data[99],_data[84],_data[69],_data[54],_data[39],
    _data[24],_data[145],_data[130],_data[115],_data[100],_data[85],_data[70],_data[55],_data[40],_data[25],_data[10],_data[191]
    '''
    return binlc

#------------------------------------------------------------------------------
# BPTC(196,96) Encoding Routings
#------------------------------------------------------------------------------ 
Example #13
Source File: test_cli.py    From BIGSI with MIT License 6 votes vote down vote up
def test_bloom_cmd():
    for config_file in CONFIG_FILES:
        f = "/tmp/test_kmers.bloom"
        response = hug.test.post(
            bigsi.__main__,
            "bloom",
            {
                "config": config_file,
                "ctx": "bigsi/tests/data/test_kmers.ctx",
                "outfile": f,
            },
        )
        a = bitarray()
        with open("/tmp/test_kmers.bloom", "rb") as inf:
            a.fromfile(inf)
        assert sum(a) > 0
        os.remove("/tmp/test_kmers.bloom") 
Example #14
Source File: nrf.py    From blueborne with GNU General Public License v3.0 6 votes vote down vote up
def parse_bredr(self, packet, pre=PROMISC_MAC, max_depth=(PAYLOAD_SIZE*8)-64):
        bits = bitarray.bitarray()
        bits.frombytes(pre + packet)
        bits_data = bytes(bits.tolist())

        offset = BTBB.btbb_find_ac(bits_data,
                                   max_depth,
                                   0xffffffff,
                                   0,
                                   byref(self._btbb_packet))
        if offset < 0:
            return
        bits_data = bits_data[offset:]

        lap = BTBB.btbb_packet_get_lap(self._btbb_packet)
        BTBB.btbb_packet_set_data(self._btbb_packet, bits_data, len(bits_data), 0, 0)

        # Bruteforce CLK1-6 values (5 bits)
        uap_candidates = set([BTBB.try_clock(i, self._btbb_packet)
                              for i in range(64)])
        return (lap, uap_candidates) 
Example #15
Source File: hid_wiimote.py    From PythonUSBIP with The Unlicense 6 votes vote down vote up
def __init__(self, container):
        USBDevice.__init__(self, container)
        self.data = bitarray(48, endian='little')
        self.data.setall(False)
        self.start_time = datetime.datetime.now()
        self.isNunchukCalibrated = False
        self.center_x = 1
        self.x_neg_range = 1
        self.x_pos_range = 1

        self.center_y = 1
        self.y_neg_range = 1
        self.y_pos_range = 1

        self.previousAccX = 0
        self.previousAccY = 0 
Example #16
Source File: ldscore.py    From ldsc with GNU General Public License v3.0 6 votes vote down vote up
def __read__(self, fname, m, n):
        if not fname.endswith('.bed'):
            raise ValueError('.bed filename must end in .bed')

        fh = open(fname, 'rb')
        magicNumber = ba.bitarray(endian="little")
        magicNumber.fromfile(fh, 2)
        bedMode = ba.bitarray(endian="little")
        bedMode.fromfile(fh, 1)
        e = (4 - n % 4) if n % 4 != 0 else 0
        nru = n + e
        self.nru = nru
        # check magic number
        if magicNumber != ba.bitarray('0011011011011000'):
            raise IOError("Magic number from Plink .bed file not recognized")

        if bedMode != ba.bitarray('10000000'):
            raise IOError("Plink .bed file must be in default SNP-major mode")

        # check file length
        self.geno = ba.bitarray(endian="little")
        self.geno.fromfile(fh)
        self.__test_length__(self.geno, self.m, self.nru)
        return (self.nru, self.geno) 
Example #17
Source File: ldscore.py    From mtag with GNU General Public License v3.0 6 votes vote down vote up
def __read__(self, fname, m, n):
        if not fname.endswith('.bed'):
            raise ValueError('.bed filename must end in .bed')

        fh = open(fname, 'rb')
        magicNumber = ba.bitarray(endian="little")
        magicNumber.fromfile(fh, 2)
        bedMode = ba.bitarray(endian="little")
        bedMode.fromfile(fh, 1)
        e = (4 - n % 4) if n % 4 != 0 else 0
        nru = n + e
        self.nru = nru
        # check magic number
        if magicNumber != ba.bitarray('0011011011011000'):
            raise IOError("Magic number from Plink .bed file not recognized")

        if bedMode != ba.bitarray('10000000'):
            raise IOError("Plink .bed file must be in default SNP-major mode")

        # check file length
        self.geno = ba.bitarray(endian="little")
        self.geno.fromfile(fh)
        self.__test_length__(self.geno, self.m, self.nru)
        return (self.nru, self.geno) 
Example #18
Source File: pixel.py    From basil with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def program_pixel_reg(self, enable_receiver=True):
        """
        Send the pixel register to the chip and store the output.

        Loads the values of self['PIXEL_REG'] onto the chip.
        Includes enabling the clock, and loading the Control (CTR)
        and DAC shadow registers.

        if(enable_receiver), stores the output (by byte) in
        self['DATA'], retrievable via `chip['DATA'].get_data()`.

        """

        self._clear_strobes()

        # enable receiver it work only if pixel register is enabled/clocked
        self['PIXEL_RX'].set_en(enable_receiver)

        px_size = len(self['PIXEL_REG'][:])  # get the size
        self['SEQ']['SHIFT_IN'][0:px_size] = self['PIXEL_REG'][:]  # this will be shifted out
        self['SEQ']['PIXEL_SHIFT_EN'][0:px_size] = bitarray(px_size * '1')  # this is to enable clock

        self._run_seq(px_size + 1)  # add 1 bit more so there is 0 at the end other way will stay high 
Example #19
Source File: encode.py    From nn-compression with MIT License 6 votes vote down vote up
def get_huffman_codebook(symb2freq):
    """
    Huffman encode the given dict mapping symbols to weights
    :param symb2freq: dict, {symbol: frequency}
    :return:
        dict, value(float/int) : code(bitarray)
    """
    heap = [[wt, [sym, ""]] for sym, wt in symb2freq.items()]
    heapify(heap)
    while len(heap) > 1:
        lo = heappop(heap)
        hi = heappop(heap)
        for pair in lo[1:]:
            pair[1] = '0' + pair[1]
        for pair in hi[1:]:
            pair[1] = '1' + pair[1]
        heappush(heap, [lo[0] + hi[0]] + lo[1:] + hi[1:])
    codebook = sorted(heappop(heap)[1:], key=lambda p: (len(p[-1]), p))
    return dict(map(lambda x: (x[0], bitarray(x[1])), codebook)) 
Example #20
Source File: build.py    From BIGSI with MIT License 5 votes vote down vote up
def load_bloomfilter(f):
    ff = bloom_file_name(f)
    logger.debug("Loading %s " % ff)
    bloomfilter = bitarray()
    with open(ff, "rb") as inf:
        bloomfilter.fromfile(inf)
    return bloomfilter 
Example #21
Source File: Bloom_Filter.py    From zhihu-girl with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, size, hash_count):
        self.size = size
        self.hash_count = hash_count
        self.bit_array = bitarray(size)
        self.bit_array.setall(0) 
Example #22
Source File: compress_bmp.py    From Python_Master-the-Art-of-Design-Patterns with MIT License 5 votes vote down vote up
def compress_image(in_filename, out_filename, executor=None):
    executor = executor if executor else ThreadPoolExecutor(4)
    with Image.open(in_filename) as image:
        bits = bitarray(image.convert('1').getdata())
        width, height = image.size

    compressed = compress_in_executor(executor, bits, width)

    with open(out_filename, 'wb') as file:
        file.write(width.to_bytes(2, 'little'))
        file.write(height.to_bytes(2, 'little'))
        file.write(compressed) 
Example #23
Source File: base.py    From BIGSI with MIT License 5 votes vote down vote up
def load_bitarray(self, _bytes):
        ba = bitarray()
        ba.frombytes(_bytes)
        return ba 
Example #24
Source File: base.py    From BIGSI with MIT License 5 votes vote down vote up
def set_bitarray(self, key, value):
        assert isinstance(value, bitarray)
        _key = self.convert_to_bitarray_key(key)
        self[_key] = value.tobytes() 
Example #25
Source File: base.py    From BIGSI with MIT License 5 votes vote down vote up
def convert_to_bitarray_key(self, key):
        return str(key) + ":bitarray" 
Example #26
Source File: score.py    From BIGSI with MIT License 5 votes vote down vote up
def remove_short_ones(s):
    ba = bitarray(s)
    if len(ba) < 3:
        return ba.to01()
    ba2 = ba[1:]
    ba2.append(1)
    ba3 = ba2[1:]
    ba3.append(1)
    ba_out = ba & ba2 & ba3
    return ba_out.to01() 
Example #27
Source File: test_BitLogic.py    From basil with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def test_from_bit_str(self):
        bl = BitLogic('10000101000101001111101100001000', endian='big')  # 2232744712
        self.assertEqual(bl, bitarray('10000101000101001111101100001000'[::-1])) 
Example #28
Source File: test_index.py    From BIGSI with MIT License 5 votes vote down vote up
def test_lookup3():
    bloomfilter_size = 250
    number_hash_functions = 1
    kmers1 = ["ATC", "ATG", "ATA", "ATT"]
    kmers2 = ["ATC", "ATG", "ATA", "TTT"]
    bloomfilter1 = BloomFilter(bloomfilter_size, number_hash_functions).update(
        convert_query_kmers(kmers1)
    )
    bloomfilter2 = BloomFilter(bloomfilter_size, number_hash_functions).update(
        convert_query_kmers(kmers2)
    )
    bloomfilters = [bloomfilter1, bloomfilter2]
    for storage in get_storages():
        storage.delete_all()
        ksi = KmerSignatureIndex.create(
            storage, bloomfilters, bloomfilter_size, number_hash_functions
        )

        assert ksi.lookup(["ATC"]) == {"ATC": bitarray("11")}
        assert ksi.lookup(["ATC", "ATC", "ATT"]) == {
            "ATC": bitarray("11"),
            "ATT": bitarray("10"),
        }
        assert ksi.lookup(["ATC", "ATC", "ATT", "TTT"]) == {
            "ATC": bitarray("11"),
            "ATT": bitarray("10"),
            "TTT": bitarray("01"),
        } 
Example #29
Source File: test_index.py    From BIGSI with MIT License 5 votes vote down vote up
def test_lookup2():
    bloomfilter_size = 2500
    number_hash_functions = 2
    kmers1 = ["ATC", "ATG", "ATA", "ATT"]
    kmers2 = ["ATC", "ATG", "ATA", "TTT"]
    bloomfilter1 = BloomFilter(bloomfilter_size, number_hash_functions).update(
        convert_query_kmers(kmers1)
    )
    bloomfilter2 = BloomFilter(bloomfilter_size, number_hash_functions).update(
        convert_query_kmers(kmers2)
    )
    bloomfilters = [bloomfilter1, bloomfilter2]
    for storage in get_storages():
        storage.delete_all()

        ksi = KmerSignatureIndex.create(
            storage, bloomfilters, bloomfilter_size, number_hash_functions
        )

        assert ksi.lookup(["ATC"]) == {"ATC": bitarray("11")}
        assert ksi.lookup(["ATC", "ATC", "ATT"]) == {
            "ATC": bitarray("11"),
            "ATT": bitarray("10"),
        }
        assert ksi.lookup(["ATC", "ATC", "ATT", "TTT"]) == {
            "ATC": bitarray("11"),
            "ATT": bitarray("10"),
            "TTT": bitarray("01"),
        } 
Example #30
Source File: test_index.py    From BIGSI with MIT License 5 votes vote down vote up
def test_lookup1():
    bloomfilter_size = 250
    number_hash_functions = 3
    kmers1 = ["ATC", "ATG", "ATA", "ATT"]
    kmers2 = ["ATC", "ATG", "ATA", "TTT"]
    bloomfilter1 = BloomFilter(bloomfilter_size, number_hash_functions).update(
        convert_query_kmers(kmers1)
    )  # canonical
    bloomfilter2 = BloomFilter(bloomfilter_size, number_hash_functions).update(
        convert_query_kmers(kmers2)
    )
    bloomfilters = [bloomfilter1.bitarray, bloomfilter2.bitarray]
    for storage in get_storages():
        storage.delete_all()

        KmerSignatureIndex.create(
            storage, bloomfilters, bloomfilter_size, number_hash_functions
        )
        ksi = KmerSignatureIndex(storage)

        assert ksi.lookup(["ATC"]) == {"ATC": bitarray("11")}
        print(ksi.lookup(["ATC", "ATC", "ATT"]))
        assert ksi.lookup(["ATC", "ATC", "ATT"]) == {
            "ATC": bitarray("11"),
            "ATT": bitarray("10"),
        }
        assert ksi.lookup(["ATC", "ATC", "ATT", "TTT"]) == {
            "ATC": bitarray("11"),
            "ATT": bitarray("10"),
            "TTT": bitarray("01"),
        }