docs: def estimate(args, **kwargs):
      """
      Return a point estimate of the model parameters theta given the data.
      """
  
      expected_output_files = kwargs.pop("expected_output_files", None)
      if not expected_output_files:
          expected_output_files = ["estimate.pkl"]
          if args.plotting:
              expected_output_files.extend(
                  ["projection-estimate.{}".format(args.plot_format)])
          
      model, data, metadata = _pre_solving(args, expected_output_files)
  
      try:
          theta, chisq, dof, model_fluxes = model.estimate(data, full_output=True,
              debug=args.debug)
  
      except:
          logger.exception("Failed to estimate model parameters")
          raise
  
      logger.info("Estimated model parameters are:")
      _announce_theta(theta)
      logger.info("With a chi-sq value of {0:.1f} (reduced {1:.1f}; DOF {2:.1f})"\
          .format(chisq, chisq/dof, dof))
  
      metadata["estimated"] = {
          "theta": theta,
          "chi_sq": chisq,
          "dof": dof,
          "r_chi_sq": chisq/dof
      }
  
      if args.plotting:
          fig = sick.plot.spectrum(data, model_flux=model_fluxes)
          filename = _prefix(args, "projection-estimate.{}".format(
              args.plot_format))
          fig.savefig(filename)
          logger.info("Created figure {}".format(filename))
  
      if kwargs.pop("__return_result", False):
          return (model, data, metadata, theta)
  
      # Write the result to file.
      _write_output(_prefix(args, "estimate.pkl"), metadata)
      return None