Script execution
This commit is contained in:
@@ -14,15 +14,19 @@ def fit(ydata, xdata = None, draw_plot = True):
|
||||
print " x:" + str(max_x),
|
||||
print " y:" + str(max_y)
|
||||
|
||||
if draw_plot:
|
||||
plots = plot([ydata],["data"],[xdata], title="Fit" )
|
||||
p = None if plots is None else plots[0]
|
||||
|
||||
gaussians = fit_gaussians(ydata, xdata, [index_max,])
|
||||
if gaussians[0] is None:
|
||||
if draw_plot and (p is not None):
|
||||
p.addMarker(max_x, None, "Max="+str(round(max_x,4)), Color.GRAY)
|
||||
print "Fitting error - returning maximum: " + str(max_x)
|
||||
return (None, max_x, None)
|
||||
|
||||
(norm, mean, sigma) = gaussians[0]
|
||||
if draw_plot:
|
||||
plots = plot([ydata],["data"],[xdata], title="Fit" )
|
||||
p = None if plots is None else plots[0]
|
||||
fitted_gaussian_function = Gaussian(norm, mean, sigma)
|
||||
scale_x = [float(min(xdata)), float(max(xdata)) ]
|
||||
points = max((len(xdata)+1), 100)
|
||||
|
||||
Reference in New Issue
Block a user