def METHOD_NAME(data, params, normalize=False):
  if (normalize):
    data.setup_binner(auto_binning=True)
    data = data.quasi_normalize_structure_factors()
  # XXX not sure what this does - see cctbx/regression/tst_miller.py
  #u_base = xray.calc_u_base(e.d_min(), params.resolution_factor)
  #d_star_sq = e.unit_cell().d_star_sq(e.indices())
  #dw = flex.exp(d_star_sq*2*(math.pi**2)*u_base)
  #eb = miller.array(miller_set=e, data=e.data()/dw)
  map = data.patterson_map(
    resolution_factor=params.resolution_factor,
    mandatory_factors=params.mandatory_factors,
    d_min=params.high_resolution,
    sharpening=params.sharpening,
    origin_peak_removal=params.remove_origin_peak)
  print("Map gridding: ",map.n_real())
  if (params.scaling == "sigma"):
    map.apply_sigma_scaling()
  else :
    map.apply_volume_scaling()
  return map