def _plotHistogram(self, param=None):
        md = MetaData()
        md.read(self.protocol._getFileName(FN_METADATA_HISTOGRAM))
        x_axis = []
        y_axis = []

        i = 0
        for idx in md:
            x_axis_ = md.getValue(MDL_X, idx)
            if i == 0:
                x0 = x_axis_
            elif i == 1:
                x1 = x_axis_
            y_axis_ = md.getValue(MDL_COUNT, idx)

            i += 1
            x_axis.append(x_axis_)
            y_axis.append(y_axis_)
        delta = x1 - x0
        fig = plt.figure()
        plt.bar(x_axis, y_axis, width=delta)
        plt.title("Resolutions Histogram")
        plt.xlabel("Resolution (A)")
        plt.ylabel("Counts")

        return [Plotter(figure2=fig)]
Ejemplo n.º 2
0
    def _plotHistogram(self, fnhist, titlename, xname):
        md = MetaData()
        md.read(self.protocol._getPath('extra/' + fnhist))
        x_axis = []
        y_axis = []

        i = 0
        for idx in md:
            x_axis_ = md.getValue(MDL_X, idx)
            if i == 0:
                x0 = x_axis_
            elif i == 1:
                x1 = x_axis_
            y_axis_ = md.getValue(MDL_COUNT, idx)

            i += 1
            x_axis.append(x_axis_)
            y_axis.append(y_axis_)
        delta = x1 - x0
        plt.figure()
        plt.bar(x_axis, y_axis, width=delta)
        plt.title(titlename + "Histogram")
        plt.xlabel(xname + "(a.u.)")
        plt.ylabel("Counts")

        return plt.show()
    def _plotHistogram(self, param=None):
        md = MetaData()
        md.read(self.protocol._getPath('extra/hist.xmd'))
        x_axis = []
        y_axis = []

        i = 0
        for idx in md:
            x_axis_ = md.getValue(MDL_X, idx)
            if i==0:
                x0 = x_axis_
            elif i==1:
                x1 = x_axis_
            y_axis_ = md.getValue(MDL_COUNT, idx)

            i+=1
            x_axis.append(x_axis_)
            y_axis.append(y_axis_)
        delta = x1-x0
        plt.figure()
        plt.bar(x_axis, y_axis, width = delta)
        plt.title("Resolutions Histogram")
        plt.xlabel("Resolution (A)")
        plt.ylabel("Counts")
        
        return plt.show()
    def _plotHistogram(self, param=None):
        md = MetaData()
        md.read(self.protocol._getPath('extra/hist.xmd'))
        x_axis = []
        y_axis = []

        i = 0
        for idx in md:
            x_axis_ = md.getValue(MDL_X, idx)
            if i == 0:
                x0 = x_axis_
            elif i == 1:
                x1 = x_axis_
            y_axis_ = md.getValue(MDL_COUNT, idx)

            i += 1
            x_axis.append(x_axis_)
            y_axis.append(y_axis_)
        delta = x1 - x0
        plt.figure()
        plt.bar(x_axis, y_axis, width=delta)
        plt.title("Resolutions Histogram")
        plt.xlabel("Resolution (A)")
        plt.ylabel("Counts")

        return plt.show()
Ejemplo n.º 5
0
    def _plotHistogram(self, param=None):
        md = MetaData()
        md.read(self.protocol._getFileName(FN_METADATA_HISTOGRAM))
        x_axis = []
        y_axis = []

        for idx in md:
            x_axis_ = md.getValue(MDL_X, idx)
            y_axis_ = md.getValue(MDL_COUNT, idx)

            x_axis.append(x_axis_)
            y_axis.append(y_axis_)

        plotter = EmPlotter()
        plotter.createSubPlot("Resolutions Histogram", "Resolution (A)",
                              "# of Counts")
        barwidth = (x_axis[-1] - x_axis[0]) / len(x_axis)

        plotter.plotDataBar(x_axis, y_axis, barwidth)

        return [plotter]
Ejemplo n.º 6
0
    def _showColorSlices(self, fileName, setrangelimits, titleFigure, lowlim,
                         highlim):
        imageFile = self.protocol._getExtraPath(fileName)
        img = ImageHandler().read(imageFile)
        imgData = img.getData()
        imgData2 = np.ma.masked_where(imgData < 0.001, imgData, copy=True)
        if setrangelimits is True:
            fig, im = self._plotVolumeSlices(titleFigure,
                                             imgData2,
                                             lowlim,
                                             highlim,
                                             self.getColorMap(),
                                             dataAxis=self._getAxis())
        else:
            md = MetaData()
            md.read(self.protocol._getExtraPath(OUTPUT_THRESHOLDS_FILE))
            idx = 1
            val1 = md.getValue(MDL_RESOLUTION_FREQ, idx)
            val2 = md.getValue(MDL_RESOLUTION_FREQ2, idx)

            if val1 >= val2:
                max_Res = val1 + 0.01
            else:
                max_Res = val2

#             max_Res = np.nanmax(imgData2)
            min_Res = np.nanmin(imgData2)
            fig, im = self._plotVolumeSlices(titleFigure,
                                             imgData2,
                                             min_Res,
                                             max_Res,
                                             self.getColorMap(),
                                             dataAxis=self._getAxis())
        cax = fig.add_axes([0.9, 0.1, 0.03, 0.8])
        cbar = fig.colorbar(im, cax=cax)
        cbar.ax.invert_yaxis()

        return plt.show(fig)