code: def test_custom_independentvar():
      """Tests using a non-trivial object as an independent variable."""
      npts = 501
      xmin = 1
      xmax = 21
      cen = 8
      obj = Stepper(xmin, xmax, npts)
      y = gaussian(obj.get_x(), amplitude=3.0, center=cen, sigma=2.5)
      y += np.random.normal(scale=0.2, size=npts)
  
      gmod = Model(gaussian_mod)
  
      params = gmod.make_params(amplitude=2, center=5, sigma=8)
      out = gmod.fit(y, params, obj=obj)
  
      assert out.nvarys == 3
      assert out.nfev > 10
      assert out.chisqr > 1
      assert out.chisqr < 100
      assert out.params["sigma"].value < 3
      assert out.params["sigma"].value > 2
      assert out.params["center"].value > xmin
      assert out.params["center"].value < xmax
      assert out.params["amplitude"].value > 1
      assert out.params["amplitude"].value < 5
  
file_path: lmfit-py/tests/test_custom_independentvar.py
imports: import numpy
  from lmfit.lineshapes import gaussian
  from lmfit.models import Model
label_desc: Use image node_id 2 for calling a global function with example usage: test_custom_independentvar() without return types