code: def minimizer():
      """Return the Minimizer object."""
  
      def residual(pars, x, sigma=None, data=None):
          """Define objective function."""
          yg = gaussian(x, pars["amp_g"], pars["cen_g"], pars["wid_g"])
          yl = lorentzian(
              x, pars["amp_l"], pars["cen_l"], pars["wid_l"]
          )
  
          model = yg + yl + pars["line_off"] + x * pars["line_slope"]
  
          if data is None:
              return model
          if sigma is None:
              return model - data
          return (model - data) / sigma
  
      # generate synthetic data
      n = 601
      xmin = 0.0
      xmax = 20.0
      x = np.linspace(xmin, xmax, n)
  
      data = (
          gaussian(x, 21, 8.1, 1.2)
          + lorentzian(x, 10, 9.6, 2.4)
          + np.random.normal(scale=0.23, size=n)
          + x * 0.5
      )
  
      # create initial Parameters
      pars = Parameters()
      pars.add(name="amp_g", value=10)
      pars.add(name="cen_g", value=9)
      pars.add(name="wid_g", value=1)
      pars.add(name="amp_tot", value=20)
      pars.add(name="amp_l", expr="amp_tot - amp_g")
      pars.add(name="cen_l", expr="1.5+cen_g")
      pars.add(name="wid_l", expr="2*wid_g")
      pars.add(name="line_slope", value=0.0)
      pars.add(name="line_off", value=0.0)
  
      sigma = 0.021  # estimate of data error (for all data points)
  
      mini = Minimizer(
          residual,
          pars,
          fcn_args=(x,),
          fcn_kws={"sigma": sigma, "data": data},
      )
  
      return mini
  
file_path: lmfit-py/tests/test_algebraic_constraint.py
imports: import numpy
  import pytest
  from lmfit import Minimizer, Model, Parameters
  from lmfit.lineshapes import gaussian, lorentzian
label_desc: Use image node_id 1 for calling a global function with example usage: minimizer() and returns: mini, unknown, model, unknown