for i in range(NPoints): filenameX = UpperDir + "/" + SubDir + "/" + rootname + "_" + str(i) + "_x" filenameY = UpperDir + "/" + SubDir + "/" + rootname + "_" + str(i) + "_y" # load the save histograms histX = np.loadtxt(filenameX) histY = np.loadtxt(filenameY) # create the horizontal coordinate axisX = np.arange(len(histX)) axisY = np.arange(len(histY)) # center the histogram and select a region of interest (ROI) around the peak window = 1000. histXc, axisXc = imgtl.center_and_ROI(histX, axisX, window) histYc, axisYc = imgtl.center_and_ROI(histY, axisY, window) # remove background (there are many way of doing this) window = 10 histXc, axisXc = imgtl.removebackground(histXc, axisXc, window) histYc, axisYc = imgtl.removebackground(histYc, axisYc, window) p2X = imgtl.FitProfile(histXc, axisXc) p2Y = imgtl.FitProfile(histYc, axisYc) print("fitX: ", p2X) print("fitY: ", p2Y) plt.figure() plt.plot(axisXc, histXc, 'ob', alpha=0.1)
for i in range (NPoints): filenameX= UpperDir+"/"+SubDir+"/"+rootname+"_"+str(i)+"_x" filenameY= UpperDir+"/"+SubDir+"/"+rootname+"_"+str(i)+"_y" # load the save histograms histX=np.loadtxt(filenameX) histY=np.loadtxt(filenameY) # create the horizontal coordinate axisX=np.arange(len(histX)) axisY=np.arange(len(histY)) # center the histogram and select a region of interest (ROI) around the peak window=1000. histXc, axisXc = imgtl.center_and_ROI(histX, axisX, window) histYc, axisYc = imgtl.center_and_ROI(histY, axisY, window) # remove background (there are many way of doing this) window = 10 histXc, axisXc = imgtl.removebackground(histXc, axisXc, window) histYc, axisYc = imgtl.removebackground(histYc, axisYc, window) p2X= imgtl.FitProfile(histXc, axisXc) p2Y= imgtl.FitProfile(histYc, axisYc) print "fitX: ", p2X print "fitY: ", p2Y