Linked Questions
11 questions linked to/from Using scipy curve_fit for a variable number of parameters
50 votes
7 answers
51k views
Fitting only one parameter of a function with many parameters in python
In python I have a function which has many parameters. I want to fit this function to a data set, but using only one parameter, the rest of the parameters I want to supply on on my own. Here is an ...
38 votes
3 answers
45k views
varargs in lambda functions in Python
Is it possible a lambda function to have variable number of arguments? For example, I want to write a metaclass, which creates a method for every method of some other class and this newly created ...
1 vote
3 answers
11k views
Fixing fit parameters in curve_fit
I have a function Imaginary which describes a physics process and I want to fit this to a dataset x_interpolate, y_interpolate. The function is a form of a Lorentzian peak function and I have some ...
3 votes
2 answers
3k views
curve_fit with polynomials of variable length
I'm new to python (and programming in general) and want to make a polynomial fit using curve_fit, where the order of the polynomials (or the number of fit parameters) is variable. I made this code ...
1 vote
3 answers
6k views
How to use scipy.optimize.curve_fit to use lists of variable
I have time varying data trace which I want to fit a function to. The inputs to the functions are lists and I want the curve_fit to optimize all values in the list to fit the curve. I have gotten so ...
5 votes
1 answer
2k views
using undetermined number of parameters in scipy function curve_fit
First question: I'm trying to fit experimental datas with function of the following form: f(x) = m_o*(1-exp(-t_o*x)) + ... + m_j*(1-exp(-t_j*x)) Currently, I don't find a way to have an undetermined ...
1 vote
1 answer
2k views
Fitting a sum of functions with fixed parameter in python
The signal I want to fit is a superposition of multiple sine-functions (and noise) and I want to fit for all frequencies simultaneously. Here an example data file, generated with two frequencies of ...
1 vote
0 answers
574 views
Using Scipy curve_fit with variable number of parameters to optimize
Assuming we have the below function to optimize for 4 parameters, we have to write the function as below, but if we want the same function with more number of parameters, we have to rewrite the ...
1 vote
1 answer
431 views
Scipy curve_fit with a parameters matrix of unknown shape
I am trying to use either scipy.curve_fit or scipy.least_squares for a function like def f(x, C): r = 0 for i in range( len(C) ) : for j in range( len(C[i]) ): r+= x[0]**j * ...
1 vote
0 answers
181 views
Curve_fit python with many parameters
I want to fit a data with sum of exponentials. The problem is the number of the exponentials is not constant. def func(t, a, taus): # plus more exponential functions return sum(a*np.exp(-t*taus))...
0 votes
1 answer
26 views
Pass variable to seperate file and then have it be "global"
I noticed that the following questions were related: Variable Parameters Curve Fit 0, Variable Parameters Curve Fit 1, Hold Parameter Curve Fit 0. It creates an array of guess parameters and array ...