################################################################################################### # Simple alignment example ################################################################################################### from mathutils import * from plotutils import * scan_range = 2.0 step_size = 0.1 r = lscan(motor,sinp,-scan_range,scan_range,[step_size,],relative=True) p=get_plots()[0] p.setLegendVisible(True) y = r[sinp] x = r[motor] fit_pars = (offset, normalization, mean_val, sigma) = fit_gaussian_offset(y, x) print fit_pars if (mean_val is not None): gaussian = GaussianOffset(*fit_pars) plot_function(p, gaussian, "Fit" , x) #Fitting error if mean_val is None or mean_valx[-1]: mean_val= x[y.index(max(y))] print "Fitting error - using max value" p.addMarker(mean_val, None, "Mean=" + str(round(mean_val,2)), Color.LIGHT_GRAY) motor.move(mean_val)