I am trying to use lmfit for a global fit problem (schild analysis). I have some shared parameters and some that are calculated based on these shared. At one point the function encounters log for a negative number and throws a [nan] list causing it to fail. How do I prevent that? Thank you.
def g1(params,xdata,ydata):
hillSlope = params['hillSlope'].value
schildSlope = params['SchildSlope'].value
top = params['top'].value
bottom = params['bottom'].value
pA2 = params['pA2'].value
EC50_1 = params['ec50_2'].value
B_1 = params['B_2'].value
Antag_1 = 1+(B_1/(10**(-1*pA2)))**schildSlope
LogEC_1=np.log10(EC50_1*Antag_1)
y_model_1 = y_model_1 = bottom + (top-bottom)/(1+10**((LogEC_1-xdata)*hillSlope))
You can set the nan_policy in the lmfit to 'omit'! More info here https://lmfit.github.io/lmfit-py/model.html