To make this a little clearer, here is what you get with the default 'dho' function.
>>> from lmfit.lineshapes import dho, tiny
>>> import numpy as np
>>> x=np.linspace(-3,3,61,dtype=float)
>>> plt.plot(x, dho(x, center=1, sigma=0.5))
If I make the smallest change (make 'bose' 'np.abs(bose)'), I get the blue curve in the plot below, which is still not ideal when x=0. To improve on that, you would have to make 'bose=gamma' when x=0 (orange curve).
I got the orange curve with the following function:
def newer_dho(x, amplitude=1., center=0., sigma=1., gamma=1.0):
tiny = 1.0e-15
bose = (1.0 - np.exp(-x/max(tiny, gamma)))
if isinstance(bose, (int, float)):
bose = max(tiny, bose)
else:
bose[np.where(np.isnan(bose))] = tiny
bose[np.where(np.isclose(x, 0.0))] = gamma
lm = 1.0/((x-center)**2 + sigma**2)
lp = 1.0/((x+center)**2 + sigma**2)
return np.where(np.isclose(x, 0.0), amplitude*lm*sigma/gamma, amplitude*sigma/np.pi*(lm - lp)/bose)
That would be my preferred solution.
I will wait for comments before submitting a PR.
Ray