def estimate_optimal_with_K_and_M(num_kmers, mem_cap):
 n_tables = (math.log(2) * (mem_cap / float(num_kmers)))
 int_n_tables = int(n_tables)
 if (int_n_tables == 0):
  int_n_tables = 1
 ht_size = int((mem_cap / int_n_tables))
 mem_cap = (ht_size * int_n_tables)
 fp_rate = ((1 - math.exp(((- num_kmers) / float(ht_size)))) ** int_n_tables)
 res = namedtuple(u'result', [u'num_htables', u'htable_size', u'mem_use', u'fp_rate'])
 return res(int_n_tables, ht_size, mem_cap, fp_rate)

def estimate_optimal_with_K_and_M ( num_kmers , mem_cap ) : n_tables = ( math . log ( 2 ) * ( mem_cap / float ( num_kmers ) ) ) int_n_tables = int ( n_tables ) if ( int_n_tables == 0 ) : int_n_tables = 1 ht_size = int ( ( mem_cap / int_n_tables ) ) mem_cap = ( ht_size * int_n_tables ) fp_rate = ( ( 1 - math . exp ( ( ( - num_kmers ) / float ( ht_size ) ) ) ) ** int_n_tables ) res = namedtuple ( u'result' , [ u'num_htables' , u'htable_size' , u'mem_use' , u'fp_rate' ] ) return res ( int_n_tables , ht_size , mem_cap , fp_rate )
estimate optimal countgraph args .