コード例 #1
0
    def compute(self):
        spec_params = self.get_input("spec_file_params")
        spec_file_root = spec_params.spec_file_root
        data_folder_path = spec_params.data_folder_path
        scan_no = spec_params.scan_number

        print spec_file_root
        print data_folder_path
        sf = SpecDataFile(spec_file_root, ccdpath=data_folder_path)
        scan = sf[scan_no]

        fp = FileProcessor(spec=scan)

        fp.process()
        arr_2d_stack = fp.getImage()

        self.set_output("spec_img_stack", arr_2d_stack)
        self.set_output("spec_file", self)
        self.fp = fp
        self.sf = sf
        self.scan = scan
コード例 #2
0
ファイル: spec.py プロジェクト: JackRBlack/pyspec
    def show(self,
             imagen=None,
             size=(4, 3),
             dark=True,
             log=False,
             limits=None):
        """Plot out CCD images.

        imagen : numbers of images (data points) to plot as a list.
        size   : grid to show images on"""

        if imagen is None:
            imagen = range(self.scan.data.shape[0])

        images = FileProcessor(spec=self.scan)
        images.process(dark)

        if len(imagen) == 1:
            f = figure()
            ax1 = axes([0.35, 0.35, 0.6, 0.6])
            ax2 = axes([0.35, 0.1, 0.6, 0.1])
            ax3 = axes([0.1, 0.35, 0.1, 0.6])

            data = images.getImage(imagen[0])
            if log:
                data = numpy.ma.array(data, mask=data <= 0)
                data = log10(data)

            if limits is not None:
                dmin, dmax = setImageRange(data, limits)
            else:
                dmin = data.min()
                dmax = data.max()

            ims = ax1.imshow(data, vmin=dmin, vmax=dmax, cmap=cm.jet)
            print ims.figbox
            ax1.set_aspect(1. / ax1.get_data_ratio())
            ax2.plot(arange(data.shape[1]), data.sum(0))
            ax2.set_xlim([0, data.shape[1]])
            ax3.plot(data.sum(1), arange(data.shape[0]))
            ax3.set_ylim([0, data.shape[0]])
            #ax3.plot(arange(data.shape[0]),data.sum(1))
            #ax2.set_ylim([dmin, dmax])
        else:

            x = 0
            for i in imagen:
                if x == 0:
                    f = figure()
                subplot(size[0], size[1], x)

                data = images.getImage(i)
                if log:
                    data = numpy.ma.array(data, mask=data <= 0)
                    data = log10(data)

                if limits is not None:
                    dmin, dmax = setImageRange(data, limits)
                else:
                    dmin = data.min()
                    dmax = data.max()

                imshow(data, vmin=dmin, vmax=dmax, cmap=cm.jet)
                title("%d.%d" % (self.scan.scan, i))
                x += 1
                if x == (size[0] * size[1]):
                    x = 0
コード例 #3
0
ファイル: spec.py プロジェクト: bodschut/pyspec
    def show(self, imagen = None, size = (4, 3), dark = True,
             log = False, limits = None):
        """Plot out CCD images.

        imagen : numbers of images (data points) to plot as a list.
        size   : grid to show images on"""

        if imagen is None:
            imagen = range(self.scan.data.shape[0])

        images = FileProcessor(spec = self.scan)
        images.process(dark)

        if len(imagen) == 1:
            f = figure()
            ax1 = axes([0.35, 0.35, 0.6, 0.6])
            ax2 = axes([0.35, 0.1, 0.6, 0.1])
            ax3 = axes([0.1, 0.35, 0.1, 0.6])

            data = images.getImage(imagen[0])
            if log:
                data = numpy.ma.array(data, mask = data <= 0)
                data = log10(data)
            
            if limits is not None:
                dmin, dmax = setImageRange(data, limits)
            else:
                dmin = data.min()
                dmax = data.max()

            ims = ax1.imshow(data, vmin = dmin, vmax = dmax, cmap = cm.jet)
            print ims.figbox
            ax1.set_aspect(1./ax1.get_data_ratio())
            ax2.plot(arange(data.shape[1]), data.sum(0))
            ax2.set_xlim([0, data.shape[1]])
            ax3.plot(data.sum(1), arange(data.shape[0]))
            ax3.set_ylim([0, data.shape[0]])
            #ax3.plot(arange(data.shape[0]),data.sum(1))
            #ax2.set_ylim([dmin, dmax])
        else:

            x = 0
            for i in imagen:
                if x == 0:
                    f = figure()
                subplot(size[0], size[1], x)

                data = images.getImage(i)
                if log:
                    data = numpy.ma.array(data, mask = data <= 0)
                    data = log10(data)
            
                if limits is not None:
                    dmin, dmax = setImageRange(data, limits)
                else:
                    dmin = data.min()
                    dmax = data.max()

                imshow(data, vmin = dmin, vmax = dmax, cmap = cm.jet)
                title("%d.%d" % (self.scan.scan,i))
                x += 1
                if x == (size[0] * size[1]):
                    x = 0