diff options
-rw-r--r-- | stats.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -149,7 +149,10 @@ def fittodata_exp(tx,ty,p0,err=None,floor=1.,ret_all=False): def fittodata_lorentz(tx,ty,p0,err=None,floor=1.,ret_all=False): """runs fittodata for a lorentzian (first param is gamma, second param is mean)""" - lorentz_func = lambda a,b: a[0]/(2.*pi*((a[1]-b)**2+(a[0]/2.)**2. )) + bigsum = scipy.integrate.simps(ty,x=tx) + if type(p0) == type(0.1): + p0 = [p0,] + lorentz_func = lambda a,b: bigsum * a[0]/(2.*pi*((a[1]-b)**2+(a[0]/2.)**2. )) return fittodata(tx,ty,p0,lorentz_func,err=err,floor=floor,ret_all=ret_all); def plotfit(indict,newfig=True): |