summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--stats.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/stats.py b/stats.py
index 3315968..9acf3f4 100644
--- a/stats.py
+++ b/stats.py
@@ -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):