erdzeichen / KiMoPack

GNU General Public License v3.0
11 stars 5 forks source link

t0 shift in ta.mod='exponential' not working #33

Closed thom-42 closed 1 month ago

thom-42 commented 1 month ago

Hi, I cannot get the t0 shift in ta.mod='exponential' to work. The monoexponential fit of the triplet decay does not yield a satisfying result, because t0 is not fitted properly:

ta.mod='exponential'

ta.par=lmfit.Parameters()
ta.par.add('k0',value=1/29.759, min=0, max=100, vary=True)
ta.par.add('t0',value=0  ,min=-10,max=10,vary=True)          
ta.par.add('resolution', value=1.6, min=0, max=10, vary=False)
ta.Fit_Global()

ta.Plot_fit_output(plotting=2, scale_type='lin')

exponential_fit_not_working

Setting t0=0 manually looks good:

ta.mod='exponential'

ta.par=lmfit.Parameters()
ta.par.add('k0',value=1/27.7, min=0, max=100, vary=False)
ta.par.add('t0',value=0  ,min=-10,max=10,vary=False)          
ta.par.add('resolution', value=1.6, min=0, max=10, vary=False)
ta.Fit_Global()

ta.Plot_fit_output(plotting=2,scale_type='lin')

t0=0

However, nothing changes when I set t0 to a negative value:

ta.mod='exponential'

ta.par=lmfit.Parameters()
ta.par.add('k0',value=1/27.7, min=0, max=100, vary=False)
ta.par.add('t0',value=-10  ,min=-10,max=10,vary=False)          #set to to -10
ta.par.add('resolution', value=1.6, min=0, max=10, vary=False)
ta.Fit_Global()

ta.Plot_fit_output(plotting=2,scale_type='lin')

t0=neg

And when I set t0 to a positive value the decay curve becomes strange.

ta.mod='exponential'

ta.par=lmfit.Parameters()
ta.par.add('k0',value=1/27.7, min=0, max=100, vary=False)
ta.par.add('t0',value=10  ,min=-10,max=10,vary=False)          #set to to 10
ta.par.add('resolution', value=1.6, min=0, max=10, vary=False)
ta.Fit_Global()

ta.Plot_fit_output(plotting=2,scale_type='lin')

t0=pos (The kink is at 10 ms)

What am I doing wrong or is this a bug? Your help is much appreciated.

I have attached the Example workbook and data: Example.zip

erdzeichen commented 1 month ago

Thank you for this detailed report. Yes I never handed the t0 to the rise function (that is only used for this). Fixed in 7.6.5.

erdzeichen commented 1 month ago

in your example I would suggest to replace baseunit='ms' with baseunit="time in ms"

erdzeichen commented 1 month ago

Btw the decay was shifted, so since many use ignore_time_region for ultrafast fitting i next noticed the missing shift in the rise. But again thanks for the careful documentation and sorry for this obvious miss