Exemple #1
0
    def main(self, img):
        """Create dialog and image inside it

        **Inputs**

          * img: 2d-array, containing the image data
          * roi: tuple of slices, contains two slice objects, one for each
                 image axis. The tuple can be used as a 2D slice object.
          * name: string, the name of the plugin

        **Notes**

        This function is called from Odysseus.

        """

        self.img = img
        transimg, odimg, com, n0, a, bprime = norm_and_guess(self.img,
                                                             norm=False)
        self.odimg = odimg
        self.com = com
        self.cpoint = com
        self.set_cpoint()
        self.defaultangles = self.anglesList.toPlainText()

        cpoint = self.get_cpoint()
        self.marker = self.imgView.ax.plot([cpoint[0]], [cpoint[1]], 'r+')[0]
        self.imgView.ax.imshow(self.img, cmap=mpl.cm.gray, vmin=0, vmax=1.35)
        self.imgView.ax.set_xticks([])
        self.imgView.ax.set_yticks([])

        self.compute_profile()
    def main(self, img):
        """Create dialog and image inside it

        **Inputs**

          * img: 2d-array, containing the image data
          * roi: tuple of slices, contains two slice objects, one for each
                 image axis. The tuple can be used as a 2D slice object.
          * name: string, the name of the plugin

        **Notes**

        This function is called from Odysseus.

        """

        self.img = img
        transimg, odimg, com, n0, a, bprime = norm_and_guess(self.img, norm=False)
        self.odimg = odimg
        self.com = com
        self.cpoint = com
        self.set_cpoint()
        self.defaultangles = self.anglesList.toPlainText()

        cpoint = self.get_cpoint()
        self.marker = self.imgView.ax.plot([cpoint[0]], [cpoint[1]], 'r+')[0]
        self.imgView.ax.imshow(self.img, cmap=mpl.cm.gray, vmin=0, vmax=1.35)
        self.imgView.ax.set_xticks([])
        self.imgView.ax.set_yticks([])

        self.compute_profile()
Exemple #3
0
 def main(self, img):
     """Integrate along one axis and display the resulting linear profile"""
     
     transimg, odimg, com, n0, a, bprime = norm_and_guess(img)
     #line_profile_x = np.sum(odimg, 0)
     #line_coord_x = range(len(line_profile_x))
     #N_count = np.sum(line_profile_x)
     #peak_x = np.argmax(line_profile_x)
     #ans = fit1dfunc(gaussian, line_coord_x, \
                     #line_profile_x, [n0, bprime, com[0]])
     #fit_profile_x = gaussian(line_coord_x, ans[0], ans[1], ans[2])
     
     line_profile_y = np.sum(odimg, 1)
     line_coord_y = range(len(line_profile_y))
     N_count = np.sum(line_profile_y)
     peak_y = np.argmax(line_profile_y)
     ans1 = fit1dfunc(gaussian, line_coord_y, \
                     line_profile_y, [n0, bprime, com[0]])
     fit_profile_y = gaussian(line_coord_y, ans1[0], ans1[1], ans1[2])
     
     #self.ax.plot(line_coord_x, line_profile_x)
     #self.ax.plot(line_coord_x, fit_profile_x, 'r-')
     #self.ax.set_xlabel(r'pix')
     #self.ax.set_ylabel(r'OD')
     #self.ax.set_title(r'X vs. Integrated OD')
     #self.ax.text(len(line_profile_x)*0.65, line_coord_x[peak_x], 'width = %1.2f'%(ans[1]/1.414))
     #self.ax.text(len(line_profile_x)*0.75, line_coord_x[peak_x]*0.9, 'N = %1.2f'%(N_count))
    
     self.ax.plot(line_coord_y, line_profile_y)
     self.ax.plot(line_coord_y, fit_profile_y, 'r-')
     self.ax.set_xlabel(r'pix')
     self.ax.set_ylabel(r'OD')
     self.ax.set_title(r'Y vs. Integrated OD')
     self.ax.text(len(line_profile_y)*0.65, line_coord_y[peak_y], 'width = %1.2f'%(ans1[1]/1.414))
     self.ax.text(len(line_profile_y)*0.75, line_coord_y[peak_y]*0.9, 'N = %1.2f'%(N_count))
Exemple #4
0
    def main(self, img):
        """Calculate and display the Fourier transform of img"""

        ##transimg, odimg, com, n0, a, bprime = norm_and_guess(img)
        ##rad_coord, rad_profile = radial_interpolate(odimg, com, 0.3)

        ##self.ax.plot(rad_coord, rad_profile)
        ##self.ax.set_xlabel(r'pix')
        ##self.ax.set_ylabel(r'OD')

        pixcal = 10e-6 # 10um / pix

        # normalized the image
        transimg, odimg, com, n0, q, bprime = norm_and_guess(img)

        # choose starting values for fit
        x, y, width_x, width_y = fitfuncs2D.gaussian_moments_2D(odimg)
        guess = np.zeros(9.)
        guess[0:4] = [com[0], com[1], width_x, width_y]
        guess[4] = n0
        guess[5:] = [q, 0., 0., 0.]

        # do the fit, and find temperature and number of atoms
        ans = fitfuncs2D.fit2dfunc(fitfuncs2D.idealfermi_2D, odimg, guess,
                                   tol=1e-10)
        ToverTF, N = fitfuncs2D.ideal_fermi_numbers_2D(ans, pixcal)

        #print ans
        #print 'T/TF = ', ToverTF[0]
        #print 'N = %1.2f million'%(N * 1e-6)

        self.ax.text(0.1, 0.8, str(ans))
        self.ax.text(0.1, 0.4, 'T/TF = %1.3f'%(ToverTF[0]))
        self.ax.text(0.1, 0.2, 'N = %1.2f million'%(N * 1e-6))
Exemple #5
0
    def main(self, img):
        """Calculate and display the Fourier transform of img"""

        transimg, odimg, com, n0, a, bprime = norm_and_guess(img)
        rad_coord, rad_profile = radial_interpolate(odimg, com, 0.3)

        self.ax.plot(rad_coord, rad_profile)
        self.ax.set_xlabel(r'pix')
        self.ax.set_ylabel(r'OD')
Exemple #6
0
    def main(self, img):
        """Calculate and display the Fourier transform of img"""

        transimg, odimg, com, n0, a, bprime = norm_and_guess(img)
        rad_coord, rad_profile = radial_interpolate(odimg, com, 0.3)

        self.ax.plot(rad_coord, rad_profile)
        self.ax.set_xlabel(r'pix')
        self.ax.set_ylabel(r'OD')
Exemple #7
0
    def main(self, rawimg, img, roi, name, path):
        """Calculate and display the Fourier transform of img"""

        pwa = rawimg[:,:,1]
        pwoa = rawimg[:,:,2]
        df = rawimg[:,:,3]

        pwa=pwa[roi]
        pwoa=pwoa[roi]
        df=df[roi]

        img=img[roi]

        ##transimg, odimg, com, n0, a, bprime = norm_and_guess(img)
        ##rad_coord, rad_profile = radial_interpolate(odimg, com, 0.3)

        ##self.ax.plot(rad_coord, rad_profile)
        ##self.ax.set_xlabel(r'pix')
        ##self.ax.set_ylabel(r'OD')

        pixcal = 10e-6 # 10um / pix

        # normalized the image
        transimg, odimg, com, n0, q, bprime = norm_and_guess(img)

        # choose starting values for fit
        x, y, width_x, width_y = fitfuncs2D.gaussian_moments_2D(odimg)
        guess = np.zeros(10.)
        guess[0:4] = [com[0], com[1], width_x, width_y]
        guess[4] = n0
        guess[5:] = [q, 0., 0., 0., 0.]

        ans1 = fitfuncs2D.fit2dfunc(fitfuncs2D.idealfermi_2D_angled, odimg, guess,
                                   tol=1e-10)

        # do the fit, and find temperature and number of atoms
        ans = fitfuncs2D.fit2dfuncraw(fitfuncs2D.idealfermi_2D_angled, pwa, pwoa, df, ans1, tol=1e-10)
        ToverTF, N = fitfuncs2D.ideal_fermi_numbers_2D_angled(ans, pixcal)

        print ans
        print 'T/TF = ', ToverTF[0]
        print 'N = %1.2f million'%(N * 1e-6)

        self.ax.text(0.1, 0.8, str(ans))
        self.ax.text(0.1, 0.4, 'T/TF = %1.3f'%(ToverTF[0]))
        self.ax.text(0.1, 0.2, 'N = %1.2f million'%(N * 1e-6))

        residuals = fitfuncs2D.residuals_2D(odimg, ans, func=fitfuncs2D.idealfermi_2D_angled, smooth=4, showfig=True)
Exemple #8
0
    def main(self, img):
        """Calculate and display the Fourier transform of img"""

        ##transimg, odimg, com, n0, a, bprime = norm_and_guess(img)
        ##rad_coord, rad_profile = radial_interpolate(odimg, com, 0.3)

        ##self.ax.plot(rad_coord, rad_profile)
        ##self.ax.set_xlabel(r'pix')
        ##self.ax.set_ylabel(r'OD')

        pixcal = 10e-6  # 10um / pix

        # normalized the image
        transimg, odimg, com, n0, q, bprime = norm_and_guess(img)

        # choose starting values for fit
        x, y, width_x, width_y = fitfuncs2D.gaussian_moments_2D(odimg)
        guess = np.zeros(9.)
        guess[0:4] = [com[0], com[1], width_x, width_y]
        guess[4] = n0
        guess[5:] = [q, 0., 0., 0.]

        # do the fit, and find temperature and number of atoms
        ans = fitfuncs2D.fit2dfunc(fitfuncs2D.idealfermi_2D,
                                   odimg,
                                   guess,
                                   tol=1e-10)
        ToverTF, N = fitfuncs2D.ideal_fermi_numbers_2D(ans, pixcal)

        #print ans
        #print 'T/TF = ', ToverTF[0]
        #print 'N = %1.2f million'%(N * 1e-6)

        self.ax.text(0.1, 0.8, str(ans))
        self.ax.text(0.1, 0.4, 'T/TF = %1.3f' % (ToverTF[0]))
        self.ax.text(0.1, 0.2, 'N = %1.2f million' % (N * 1e-6))