def read_model_params(model, diploid_coverage=30.0):
  """

  :param model
  :param diploid_coverage: Coverage we expect from a diploid genome
  :return: dict of params,
           passes -> how many times we should call generate reads for each region
  """
  rlen = model['mean_rlen']
  # coverage = read count * read len / genome len
  # coverage = P * read len P = expected number of reads per base
  # P = p * passes    p = probability of read per pass
  # One template for two reads
  # p = P / (2 * passes)
  # p = coverage / (2 * rlen * passes)
  p = 1.0
  passes = 1
  while p > 0.1:
    passes *= 2
    p = 0.5 * diploid_coverage / (rlen * passes)

  return {
    'diploid_coverage': diploid_coverage,
    'p': p,
    'passes': passes,
    'rlen': rlen,
    'cum_tlen': model['cum_tlen'],
    'cum_bq_mat': model['cum_bq_mat'],
    'unpaired': model.get('unpaired', False)
  }