# curve-fitting

## Multiple gaussian fit issue

Multiple gaussian fit issue Question: I have this code that aims to fit the data in here https://drive.google.com/file/d/1uBrHxuftALiQTcTeBl-s6AHGiC8DGBWV/view?usp=sharing. Where the function read_file is used to stract the information in a proper way. I do not what i am doing wrong that the gaussian fit is not right as you can see in the image (Gaussian …

## Fitting Variable Number of Lorentzian Peaks to a glob of data in text files

Fitting Variable Number of Lorentzian Peaks to a glob of data in text files Question: So I’ve gotten the code to work, but it’s extremely slow and doesn’t give the proper full width at half maxima. Is there something I can do to get the FWHM values and speed up the processing without losing post-processing …

## Curve fitting in python compared to excel (variance in results)

Curve fitting in python compared to excel (variance in results) Question: I am fairly new to python, while I have used matlab quite a bit before. Currently I am trying to do an exponential curve fit to a semi logarithmic plot. Down below is the code I’ve currently got. import numpy as np import matplotlib.pyplot …

## Possible unbalanced tuple unpacking with sequence in scipy optimization curve_fit

Possible unbalanced tuple unpacking with sequence in scipy optimization curve_fit Question: I got error from pylint from my code. I don’t know how to fix that. can you please help me? The code is here: import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit # Define the two points x1, y1 = …

## Curve.fit optimization error: 'Covariance of the parameters could not be estimated

Curve.fit optimization error: 'Covariance of the parameters could not be estimated Question: I’m trying to fit some data into a function, but scipy curve_fit gives me the following message: "OptimizeWarning: Covariance of the parameters could not be estimated" and won’t plot or print the parameters of the fit. I believe the power inside the exp …

## Curve fitting with three unknowns Python

Curve fitting with three unknowns Python Question: I have a data set where from one x I can obtain the exponential function f(x) = a*np.exp(-b*(x-c)) , defined in Python like this: def func(x, a, b, c): return a*np.exp(-b*(x-c)) f = func(x, a, b, c) a = 1.6 b = 0.02 a, b, c are all …

## Sine Curve fitting in Python

Sine Curve fitting in Python Question: I want to fit in a one bump of sine cure in this sets of data xData = np.array([1.7, 8.8, 15, 25, 35, 45, 54.8, 60, 64.7, 70]) yData = np.array([30, 20, 13.2, 6.2, 3.9, 5.2, 10, 14.8, 20, 27.5]) I have successfully fitted in a parabola using scipy.optimize.curve_fit …

## How to fix gaussian fit not behaving like expected?

How to fix gaussian fit not behaving like expected? Question: I have a set of data showing radition not being absorbed as a function of velocity. The data shows a very clear dip or if we plot the inverse of the data the absorbtion, we get a clear peak instead. I have no reason not …