I have been strugling with getting my fitting model to work and I'm not sure if it has to do with how I'm convoluting functions, or if maybe it has something to do with my dataset. Basically the function I have to use the fit most of the peaks in my spectrum is a convolution of a certain lineshape function and the resolution function of the detector. The latter has all of its parameters fixed, so it has only the variable 'x' as its argument.
The way I implemented the convolution is just like in the example given for the CompositeModel (
https://lmfit.github.io/lmfit-py/examples/documentation/model_composite.html) , but the fit doesn't work at all. I created a dummy dataset using the estimated initial parameters, which coincides pretty welll with the measured data, and there the fit works. I never get an error message, but the fit for the actual dataset is complete nonsense.
Attached you can find a txt file with the script. I would really appreciate if someone could help me understand what's going on here.
Thanks and advance and cheers
Mark