Exemplo n.º 1
0
    def main(self, img, roi):
        """Create dialog and image inside it"""

        self.img = img
        self.roi = roi
        transimg1, odimg1 = imageprocess.calc_absimage(np.dstack(
            [img[:, :, 1], img[:, :, 5], img[:, :, 3]]),
                                                       norm_edge=True)
        transimg2, odimg2 = imageprocess.calc_absimage(np.dstack(
            [img[:, :, 2], img[:, :, 6], img[:, :, 4]]),
                                                       norm_edge=True)
        odimg1 = imageprocess.normalize_edgestrip(odimg1)
        odimg2 = imageprocess.normalize_edgestrip(odimg2)
        balance = odimg1[roi].mean() / odimg2[roi].mean()

        self.ax1.imshow(transimg1, vmin=0, vmax=1.35, cmap=mpl.cm.gray)
        self.ax2.imshow(transimg2, vmin=0, vmax=1.35, cmap=mpl.cm.gray)
        self.balance_label.setText('The balance is %s' % balance)
Exemplo n.º 2
0
    def main(self, img, roi):
        """Create dialog and image inside it"""

        self.img = img
        self.roi = roi
        transimg1, odimg1 = imageprocess.calc_absimage(np.dstack([img[:, :, 1],
                                                                  img[:, :, 5],
                                                                  img[:, :, 3]]),
                                                       norm_edge=True)
        transimg2, odimg2 = imageprocess.calc_absimage(np.dstack([img[:, :, 2],
                                                                  img[:, :, 6],
                                                                  img[:, :, 4]]),
                                                       norm_edge=True)
        odimg1 = imageprocess.normalize_edgestrip(odimg1)
        odimg2 = imageprocess.normalize_edgestrip(odimg2)
        balance = odimg1[roi].mean() / odimg2[roi].mean()

        self.ax1.imshow(transimg1, vmin=0, vmax=1.35, cmap=mpl.cm.gray)
        self.ax2.imshow(transimg2, vmin=0, vmax=1.35, cmap=mpl.cm.gray)
        self.balance_label.setText('The balance is %s'%balance)
Exemplo n.º 3
0
    def main(self, img, roi):
        """Create dialog and image inside it"""

        self.img = img
        self.roi = roi

        pwa = img[:,:,0]
        pwoa = img[:,:,1]
        df = img[:,:,2]

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

        transimg1, odimg1 = imageprocess.calc_absimage(img,norm_edge=True)

        ##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(transimg1)

        # 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.]

        # do the fit, and find temperature and number of atoms
        ans = fitfuncs2D.fit2dfuncraw(fitfuncs2D.idealfermi_2D_angled, pwa, pwoa, df, guess, 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))

        ## show the fit residuals
        residuals = fitfuncs2D.residuals_2D(odimg, ans, func=fitfuncs2D.idealfermi_2D_angled, smooth=4, showfig=False)


        self.ax1.imshow(residuals, vmin=0, vmax=.1, cmap=mpl.cm.gray)
        self.ax2.imshow(odimg, vmin=0, vmax=1.35, cmap=mpl.cm.gray)
Exemplo n.º 4
0
    def create_window(self, img, roi, name):
        """A misnomer, but this is what the function Odysseus calls.

        **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

        """

        rawframes = imageio.import_rawframes(self.imgpath)
        transimg, odimg = imageprocess.calc_absimage(rawframes)
        # set the ROI
        transimg = transimg[roi]

        texreport.generate_report(rawframes, transimg, self.imgpath, showpdf=False)

        # no window, so return None
        return None
Exemplo n.º 5
0
def show_rawframes(rawdata, figname=None, showfig=False):
    """Plots the transmission image together with the 3 raw images

    **Inputs**

      * rawdata: 3D array, containing pwa, pwoa, df. Last dimension is frame
                 index
      * figname: str, if not None the figure is saved with this filename
      * showfig: bool, if True pop up a figure with pylab.show()

    **Outputs**

      * fig: matplotlib figure instance

    """

    transimg, odimg = calc_absimage(rawdata)
    aspect = transimg.shape[0]/float(transimg.shape[1])

    fig = pylab.figure(figsize=(8, 8*aspect))
    ax1 = fig.add_subplot(221)
    ax2 = fig.add_subplot(222)
    ax3 = fig.add_subplot(223)
    ax4 = fig.add_subplot(224)

    ax1.imshow(transimg, cmap=pylab.cm.gray, vmin=0, vmax=1.35)
    ax2.imshow(rawdata[:, :, 0], cmap=pylab.cm.gray)
    ax3.imshow(rawdata[:, :, 1], cmap=pylab.cm.gray)
    ax4.imshow(rawdata[:, :, 2], cmap=pylab.cm.gray)

    for ax in [ax1, ax2, ax3, ax4]:
        ax.set_xticks([])
        ax.set_yticks([])

    _save_or_show(figname=figname, showfig=showfig)

    return fig
Exemplo n.º 6
0
def show_rawframes(rawdata, figname=None, showfig=False):
    """Plots the transmission image together with the 3 raw images

    **Inputs**

      * rawdata: 3D array, containing pwa, pwoa, df. Last dimension is frame
                 index
      * figname: str, if not None the figure is saved with this filename
      * showfig: bool, if True pop up a figure with pylab.show()

    **Outputs**

      * fig: matplotlib figure instance

    """

    transimg, odimg = calc_absimage(rawdata)
    aspect = transimg.shape[0] / float(transimg.shape[1])

    fig = pylab.figure(figsize=(8, 8 * aspect))
    ax1 = fig.add_subplot(221)
    ax2 = fig.add_subplot(222)
    ax3 = fig.add_subplot(223)
    ax4 = fig.add_subplot(224)

    ax1.imshow(transimg, cmap=pylab.cm.gray, vmin=0, vmax=1.35)
    ax2.imshow(rawdata[:, :, 0], cmap=pylab.cm.gray)
    ax3.imshow(rawdata[:, :, 1], cmap=pylab.cm.gray)
    ax4.imshow(rawdata[:, :, 2], cmap=pylab.cm.gray)

    for ax in [ax1, ax2, ax3, ax4]:
        ax.set_xticks([])
        ax.set_yticks([])

    _save_or_show(figname=figname, showfig=showfig)

    return fig
Exemplo n.º 7
0
    def create_window(self, img, roi, name):
        """A misnomer, but this is what the function Odysseus calls.

        **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

        """

        rawframes = imageio.import_rawframes(self.imgpath)
        transimg, odimg = imageprocess.calc_absimage(rawframes)
        # set the ROI
        transimg = transimg[roi]

        texreport.generate_report(rawframes,
                                  transimg,
                                  self.imgpath,
                                  showpdf=False)

        # no window, so return None
        return None