コード例 #1
0
ファイル: ImgToolGUI.py プロジェクト: NIUaard/ImageTool
    def update_figure(self):
        global ImageDisplayed

        self.ax0.cla()
        self.axx.cla()
        self.axy.cla()
        self.ax0.imshow(ImageDisplayed,
                        aspect='auto',
                        cmap=beam_map,
                        origin='lower')
        projx, projy = ImageDisplayed.sum(axis=0), ImageDisplayed.sum(axis=1)
        x = np.arange(len(projx))
        y = np.arange(len(projy))
        if FLAG_fit > 0:
            p2X = imgtl.FitProfile(projx, x)
            p2Y = imgtl.FitProfile(projy, y)


#        # top plot
        self.axx.plot(projx)
        if FLAG_fit > 0:
            self.axx.plot(x, imgtl.dg(x, p2X), 'r--', linewidth=3)
        self.axx.set_xlim(self.ax0.get_xlim())
        #        # Right plot
        self.axy.plot(projy, range(len(projy)))
        if FLAG_fit > 0:
            self.axy.plot(imgtl.dg(y, p2Y), y, 'r--', linewidth=3)
        self.axy.set_ylim(self.ax0.get_ylim())
        # Remove tick labels
        nullfmt = ticker.NullFormatter()
        self.axx.xaxis.set_major_formatter(nullfmt)
        self.axx.yaxis.set_major_formatter(nullfmt)
        self.axy.xaxis.set_major_formatter(nullfmt)
        self.axy.yaxis.set_major_formatter(nullfmt)

        self.draw()
コード例 #2
0
plt.plot (Wx0, stdy0,'go')
plt.subplot (2,2,3)
plt.plot (Wx0, correl0,'ro')
plt.subplot (2,2,4)
plt.plot (Wx0, norm0,'ro')

plt.figure()
plt.imshow(Xc)

print(np.shape(IMGf))

histx, histy, x, y = imgtl.GetImageProjection(IMGf,cal)  

x=x-x[np.argmax(histx)]
y=y-y[np.argmax(histy)]
p2X= imgtl.FitProfile(histx, x)
p2Y= imgtl.FitProfile(histy, y)

print('RMS_x=',np.mean(stdx0[len(stdx0)-2:len(stdx0)+2]))
print('RMS_y=',np.mean(stdy0[len(stdy0)-2:len(stdy0)+2]))
print("fitX: ", p2X)
print("fitY: ", p2Y)

plt.figure()
disp=filenameIm.split('/')
print(disp)
print(len(disp))


plt.subplot (2,2,1)
plt.title (disp[len(disp)-1])		      
コード例 #3
0
ファイル: testprofilefit.py プロジェクト: NIUaard/ImageTool
    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)
    plt.plot(axisXc, imgtl.dg(axisXc, p2X), '--b', linewidth=3)
    plt.plot(axisYc, histYc, 'or', alpha=0.1)
    plt.plot(axisYc, imgtl.dg(axisYc, p2Y), '--r', linewidth=3)
    plt.title("point number: " + str(i))

plt.show()