I am trying to fit a progression of Gaussian peaks to a spectral lineshape. The progression is a summation of N evenly spaced Gaussian peaks. When coded as a function, the formula for N=1 looks like this: where A, e0, hf, S and fwhm are to be determined from the fit with some good initial guesses. Importantly, the parameter i
Tag: curve-fitting
How to subtract baseline from spectrum with rising tail in python?
I have a spectrum that I want to subtract a baseline from. The spectrum data are: I’ve taken only every 20th data point from the actual data file, but the general shape is preserved. Original_spectrum There is a clear tail in around the high x values. Assume the tail is an artifact and needs to be removed. I’ve tried solutions
fitting closed curve to a set of noisy points
This is my set of data, where I would like to fit a closed curve to, just like this post here is the visualized dataset: However, these are the results I got no matter how I sort my array. I pinned a few problems about my dataset but don’t know how to deal with them: Many x and y values
Can you continue to run code post Runtime Error?
My code scans through folders and for every folder plots a graph. However at the moment when using my curve fitting code for one of the graphs it produces a runtime error code as: This is annoying because it stops the code and stops the scanning of subsequent folders. Is there any way for the code once the runtime error
Polynomial fitting with equal number of data points and coefficients
I am currently experimenting with polynomial fitting using jupyter. The function below returns the least-square polynomial of degree m given the data points in xs with corresponding ys. Suppose I have the following six data points and fit a polynomial of degree 5: From my understanding, the resulting curve should pass through every single data point exactly (in fact, the
Curve Fitting using Numpy Polyfit, estimate constant on function with Square Root
First of All, Sorry for my poor English and Thanks for clicking this Question. I already have x and y data sets, so I want to do curve fitting with my data sets. and estimated Model is then How can I estimate constants of this Model by polyfit? I know means Linear Equation Estimating. (1 means Linear) but How can
Is there a way to get the error in fitting parameters from scipy.stats.norm.fit?
I have some data which I have fitted a normal distribution to using the scipy.stats.normal objects fit function like so: I would now like to extract the uncertainty/error in the fitted mu and sigma values. How can I go about this? Answer You can use scipy.optimize.curve_fit: This method does not only return the estimated optimal values of the parameters, but
Difference between Levenberg-Marquardt-Algorithm and ODR
I was able to fit curves to a x/y dataset using peak-o-mat, as shown below. Thats a linear background and 10 lorentzian curves. Since I need to fit many similar curves I wrote a scripted fitting routine, using mpfit.py, which is a Levenberg-Marquardt-Algorithm. However the fit takes longer and, in my opinion, is less accurate than the peak-o-mat result: Starting