title: Fitting multiple data sets using lmfit without writting an objective function
body: <p>This topic describes how to fit multiple data-sets using lmfit:
  <a href="https://stackoverflow.com/questions/20339234/python-and-lmfit-how-to-fit-multiple-datasets-with-shared-parameters">Python and lmfit: How to fit multiple datasets with shared parameters?</a></p>
  
  <p>However it uses a fitting/objective function written by the user. </p>
  
  <p>I was wondering if it's possible to fit multiple data-sets using lmfit without writing an objective function and using model.fit() method of the model class. </p>
  
  <p>As an example: Lets say we have multiple data sets of (x,y) coordinates that we want to fit using the same model function in order to find the set of parameters that on average fit all the data best.</p>
  
  <pre><code>import numpy as np 
  from lmfit import Model, Parameters
  from lmfit.models import GaussianModel
  
  def gauss(x, amp, cen, sigma):
      return amp*np.exp(-(x-cen)**2/(2.*sigma**2))
  
  x1= np.arange(0.,100.,0.1)
  x2= np.arange(0.,100.,0.09)
  y1= gauss(x1, 1.,50.,5.)+ np.random.normal(size=len(x1), scale=0.1)
  y2= gauss(x2, 0.8,48.4.,4.5)+ np.random.normal(size=len(x2), scale=0.1)
  
  mod= GaussianModel()
  params= mod.make_params()
  
  mod.fit([y1,y2], params, x= [x1, x2])
  </code></pre>
  
  <p>I guess if this is possible the data has to be passed to mod.fit in the right type. The documentation only says that mod.fit takes an array-like data input. </p>
  
  <p>I tried to give it lists and arrays. If I pass the different data sets as a list I get a ValueError: setting an array element with a sequence</p>
  
  <p>If I pass an array I get an AttributeError: 'numpy.ndarray' has no atribute 'exp'</p>
  
  <p>So am I just trying to do something that isn't possible or am I doing something wrong? </p>