def decode_bits(received_bitvec):
 rec = received_bitvec
 syn = (numpy.dot(DEFAULT_H, rec) % 2)
 try:
  err = numpy.array(DEFAULT_SYNDROME_LUT[tuple(syn)])
 except KeyError:
  return (None, 4)
 corrected = ((rec + err) % 2)
 return (corrected, numpy.sum(err))

def decode_bits ( received_bitvec ) : rec = received_bitvec syn = ( numpy . dot ( DEFAULT_H , rec ) % 2 ) try : err = numpy . array ( DEFAULT_SYNDROME_LUT [ tuple ( syn ) ] ) except KeyError : return ( None , 4 ) corrected = ( ( rec + err ) % 2 ) return ( corrected , numpy . sum ( err ) )
decode a recieved 24 bit vector to a corrected 24 bit vector uses golay defaults input: received bitvec is 24 bits long .