title: How can i combine a function of a arguments with one of b arguments to a function of a+b arguments?
body: <p>I try to create functions to fit them on data with <code>scipy.optimize.curve_fit</code> .
  If i want to take account of the background noise in the data with e.g. a linear function I combine my fitting function with this linear function like:</p>
  
  <pre><code>return (lambda x, *connected_parameters: self.function(x, *connected_parameters[1:self.param_count]) +
     function(x, *connected_parameters[self.param_count:-1]))
  </code></pre>
  
  <p>where self.function is my fitting function and function can be (lambda x, m, b: m*x + b) and x represents the set I want to fit on. The returned function is not working for optimize.curve_fit because using the asterisc symbol curve_fit now thinks there are only two arguments.</p>
  
  <p>Is there a way to define the exact number of arguments depending on the noise function i want to use?</p>
  
  <p>This is my first question, so sorry if I made some mistakes.
  Best regards</p>
  
  <p><strong>I get the following error message:</strong> </p>
  
  <blockquote>
    <p>File "C:\Users\Hans\source\repos\pyQTGraph\pyQTGraph\venv\lib\site-packages\scipy\optimize\minpack.py", line 683, in curve_fit
        raise ValueError("Unable to determine number of fit parameters.")
    ValueError: Unable to determine number of fit parameters.</p>
  </blockquote>