################################################################################################### # Function fitting and peak search with mathutils.py ################################################################################################### from mathutils import fit_polynomial from mathutils import PolynomialFunction # Input parameters (example) #Slit = exit_slit #Slit_offset = exit_slit_offset #detector = keithley_1a #start = 30.0 #end = -20.0 #step_size = 1.0 #final_pos = 20.0 #run('beamline_init/with_x-rays/functions/SlitCalib.py',{"Slit":exit_slit, "Slit_offset":exit_slit_offset, "detector":detector, "start":30, "end":-20.0, "step_size":1.0, "final_pos":20.0}) # Execute the scan result=lscan(Slit, detector, start, end, float(step_size)) readable_ = result[detector] positions_ = result[Slit] print positions_ readable=[] positions=[] # execute the fit fit_threshold=readable_[0]*0.05 #filter the positions with analog values above the threshold for i in range(8,len(positions_),1): if(readable_[i]