## Warning: uncertainties could not be estimated:
The code I am running goes as follows:
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
matData = pd.read_csv('materialNoCav.txt',sep=" ")
matData.rename(columns={'kpar (rad/m)': 'kPar','freq (Hz)':'freq','omega (rad/s)':'omega','Power outflow, time average (W/m), Boundary Probe 1':'power'}, inplace=True)
matPowerVals = matData.pivot(index='freq',columns='kPar',values='power')
matPowerArray = ((np.asarray(matData['power'])).reshape(21,51))
matKList = uniqueList(matData['kPar']) # extracts the kParallel values for our 21 value parameter sweep
matKParDict = {}
for kval in matKList:
df = matData[matData.kPar==kval]
matKParDict[kval] = df
from lmfit import Parameters
from lmfit.models import ConstantModel, LorentzianModel
matResF = []
for i in matKList:
kParTemp = pd.DataFrame(matKParDict[i]).reset_index(drop=True) # temporary DF of our dictionary section
x=kParTemp['freq']
y=kParTemp['power']
const = ConstantModel(prefix='c_')
pars = const.make_params()
pars['c_c'].set(value=1,min=0.99,max=1)
lor = LorentzianModel(prefix='l_')
pars.update(lor.make_params())
pars['l_amplitude'].set(value=1,min=0,max=1)
pars['l_center'].set(value=5.6e14,min=5.2e14,max=6.6e14)
model = const - lor
out = model.fit(y, pars, x=x)
print(out.fit_report(min_correl=0.5))
comps = out.eval_components(x=x)
plt.plot(x, y, comps['c_'], label='Constant')
plt.plot(x, y, comps['l_'], label='Lorentzian')
plt.legend(loc='best')
plt.show()
Dear all,I am attempting to get information about the center of a trough of a gaussian that is subtracting from a constant value. I have, as you see below, attempted to create a model where the Lorentzian is subtracting from the constant and tried to run .fit to get more accurate results, but all lmfit does is return the initialized values and a graph that does not make much sense (I believe it's plotting something tiny at 0,0).The error I am getting when I run this code is not a Python error, but an lmfit error. Along the printout it includes a statement which I believe to be relevant;## Warning: uncertainties could not be estimated:
The code I am running goes as follows:
Please let me know if there's a better way to fit an inverse function.
--
You received this message because you are subscribed to the Google Groups "lmfit-py" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lmfit-py+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lmfit-py/a69fe708-22b7-4e87-bce6-3dc67adedb22o%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lmfit-py/CA%2B7ESbohiZs9%3D0zjT4YSpiZ%3DeoFZbUgSNoJ%2BTs%2BFt7%2BkQJAO0w%40mail.gmail.com.