lmfit

Different constraints for fit parameter in lmfit model

[亡魂溺海] 提交于 2020-06-29 05:06:37
问题 I am trying to create a multible voigt/Gaussian/Lorentizan-peak fit function with lmfit. Therefore, I wrote the following Function: def apply_fit_mix_multy(data,modelPeak,peakPos,amplitud,**kwargs): peakPos=np.array(peakPos) Start=kwargs.get('Start',data[0,0]) length_data=len(data)-1 End=kwargs.get('End',data[length_data,0]) StartPeak=kwargs.get('StartPeak',data[0,0]) EndPeak=kwargs.get('EndPeak',data[length_data,0]) BackFunc=kwargs.get('BackFunc',False) BackCut=kwargs.get('BackCut',False)

ValueError: The input contains nan values - from lmfit model despite the input not containing NaNs

旧时模样 提交于 2020-02-20 07:54:05
问题 I'm trying to build a model using lmfit (link to docs) and I can't seems to find out why I keep getting a ValueError: The input contains nan values when I try to fit the model. from lmfit import minimize, Minimizer, Parameters, Parameter, report_fit, Model import numpy as np def cde(t, Qi, at, vw, R, rhob_cb, al, d, r): # t (time), is the independent variable return Qi / (8 * np.pi * ((at * vw)/R) * t * rhob_cb * (np.sqrt(np.pi * ((al * vw)/R * t)))) * \ np.exp(- (R * (d - (t * vw)/ R)**2) /

lmfit - minimizer does not accept scipy minimizer keyword arguments

走远了吗. 提交于 2020-01-25 06:48:54
问题 I am trying to fit some model to my data with lmfit . See the MWE below: import lmfit import numpy as np def lm(params, x): slope = params['slope'] interc = params['interc'] return interc + slope * x def lm_min(params, x, data): y = lm(params, x) return data - y x = np.linspace(0,100,1000) y = lm({'slope':1, 'interc':0.5}, x) ydata = y + np.random.randn(1000) params = lmfit.Parameters() params.add('slope', 2) params.add('interc', 1) fitter = lmfit.Minimizer(lm_min, params, fcn_args=(x, ydata)

How to fit multiple datasets which have a combination of shared and non-shared parameters

陌路散爱 提交于 2020-01-23 03:36:07
问题 I'm trying to fit multiple dataset which should have some variables which are shared by between datasets and others which are not. However I'm unsure of the steps I need to take to do this. Below I've shown the approach that I'm trying to use (from 'Issues begin here' doesn't work, and it just for illustrative purposes). In this answer somebody is able to share parameters arcoss datasets is there some way that this could be adapted so that I can also have some non-shared parameters? Does

Python - Clipping out data to fit profiles

喜欢而已 提交于 2020-01-17 07:53:34
问题 I have several sets of data to which I'm trying to fit different profiles. In the centre of one of the minima there is contamination that prevents me from doing a good fit as you can see in this image: How can I clip out those spikes in the bottom of my data taking into account that the spike is not always in the same position? Or how would you deal with data like this? I'm using lmfit to fit the profiles, in this case a Lorentzian and a Gaussian. Here is a minimal working example where I

lmfit package ImportError: cannot import name differential_evolution

邮差的信 提交于 2020-01-06 05:42:06
问题 As the title I'm duelling just with the import of the package lmfit which does not want to load. I just called the interpreter and then typed import lmfit but the import does not seem to go in the right direction, and I get this message of error Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Python/2.7/site-packages/lmfit/__init__.py", line 42, in <module> from .confidence import conf_interval, conf_interval2d File "/Library/Python/2.7/site-packages