def METHOD_NAME(args):
  assert args in [[], ["--verbose"]]
  verbose = "--verbose" in args
  exercise_least_squares_residual()
  exercise_core_LS(xray.targets_least_squares_residual, verbose)
  exercise_core_LS(xray.targets_least_squares_residual_for_intensity, verbose)
  crystal_symmetry = crystal.symmetry(
    unit_cell=(10,11,12,85,95,100),
    space_group_symbol="P 1")
  miller_set = miller.build_set(
    crystal_symmetry=crystal_symmetry,
    anomalous_flag=False,
    d_min=3)
  f_calc = miller_set.array(
    data=flex.polar(
      flex.random_double(miller_set.size())*10-5,
      flex.random_double(miller_set.size())*10-5))
  obs = miller_set.array(
    data=flex.abs(f_calc.data()) + (flex.random_double(miller_set.size())*2-1),
    sigmas=flex.random_double(miller_set.size()))
  obs.set_observation_type_xray_amplitude()
  weighting = xray.weighting_schemes.amplitude_unit_weighting()
  exercise_py_LS(obs, f_calc, weighting, verbose)
  obs = miller_set.array(
    data=flex.norm(f_calc.data()) + (flex.random_double(miller_set.size())*2-1),
    sigmas=flex.random_double(miller_set.size()))
  obs.set_observation_type_xray_intensity()
  weighting = xray.weighting_schemes.intensity_quasi_unit_weighting()
  exercise_py_LS(obs, f_calc, weighting, verbose)
  weighting = xray.weighting_schemes.simple_shelx_weighting(a=100, b=150)
  exercise_py_LS(obs, f_calc, weighting, verbose)
  weighting = xray.weighting_schemes.shelx_weighting(a=100, b=150)
  exercise_py_LS(obs, f_calc, weighting, verbose)
  print("OK")