[SciPy-User] Asymmetric peak fitting

Evgeni Burovski evgeny.burovskiy at gmail.com
Fri Mar 20 06:03:16 EDT 2015


FWIW, this distribution has been implemented in scipy a couple of
weeks ago as `exponnorm` --- it's only available in the dev version at
the moment. So `exponnorm.fit` may work --- if it doesn't, a patch
would be welcome :-)

On Fri, Mar 20, 2015 at 8:43 AM, Paweł Kwaśniewski <pawel.kw at gmail.com> wrote:
> Hi Matt, Jonathan,
>
>
>
>
>
> 2015-03-20 4:15 GMT+01:00 Matt Newville <newville at cars.uchicago.edu>:
>>
>> Hi Jonathon,
>>
>> On Thu, Mar 19, 2015 at 8:30 PM, jkhilmer at chemistry.montana.edu
>> <jkhilmer at chemistry.montana.edu> wrote:
>>>>
>>>>
>>>> Ah, sorry the very poor memory.  There was a fix to the expgaussian()
>>>> function a month ago, after the 0.8.3 release (and thanks to Tim Spillane
>>>> for the fix!).    That explains the problem you're seeing, and might explain
>>>> why Pawel was having trouble too.   The fix is fairly simple (change `arg2`
>>>> to have `/(s2*sigma)` instead of `/s`,  see
>>>> https://github.com/lmfit/lmfit-py/blob/master/lmfit/lineshapes.py#L116), and
>>>> should be orthogonal to any other changes in the current branch.
>>>>
>
> That was the problem! Thanks! I'm sorry, I should also attach the fit result
> figure to my post. But now it works like a charm.
>
> Thanks!
>
> Pawel
>
>>>
>>>
>>> Thanks for checking into this.  Do you have any thoughts on the analysis
>>> by Kalambet and Tikhonov in the paper I linked previously?  Specifically, in
>>> the code:
>>>
>>> gss = gamma*sigma*sigma
>>> arg1 = gamma*(center +gss/2.0 - x)
>>> arg2 = (center + gss - x)/(s2*sigma)
>>> return amplitude*(gamma/2) * exp(arg1) * erfc(arg2)
>>>
>>> The exp(arg1) factor is much too large and erfc(arg2) is much too small,
>>> when x<1/gamma ?
>>>
>>>
>>> Jonathan
>>
>>
>> I haven't looked at the paper in great detail, and wasn't aware of (and/or
>> never experienced myself) the potential instability -- but I haven't used
>> this function much myself.   If I understand correctly,  the recommendation
>> is that a version of the exponentially modified Gaussian that used Eq. 6
>> from the Kalambet, et al article (and scipy.special.erfcx()) would be better
>> behaved.   Is that correct, and the whole story?
>>
>>  A Pull Request or a patch for candidate replacement function based on
>> this would be greatly appreciated.
>>
>> --Matt
>>
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>



More information about the SciPy-User mailing list