Exemplo n.º 1
0
    def _plotCurveAnisotropy(self, fnmd, title, xTitle, yTitle, mdLabelX,
                             mdLabelY1, mdLabelY2):
        """
        This function is called by _showAnisotropyCurve
        It shows the FSO curve in terms of the resolution
        The horizontal axis is linear in this plot.
        """
        md = xmippLib.MetaData(fnmd)
        xplotter = XmippPlotter(figure=None)
        xplotter.plot_title_fontsize = 11

        a = xplotter.createSubPlot(title, xTitle, yTitle, 1, 1)
        xplotter.plotMdFile(md, mdLabelX, mdLabelY1, 'g')

        xx, yy = self._prepareDataForPlot(md, mdLabelX, mdLabelY1)
        _, yyBingham = self._prepareDataForPlot(md, mdLabelX, mdLabelY2)

        from matplotlib.ticker import FuncFormatter
        a.axes.xaxis.set_major_formatter(FuncFormatter(self._formatFreq))
        a.axes.set_ylim([-0.1, 1.1])
        a.axes.plot(xx, yy, 'g')
        a.axes.set_xlabel('Resolution (A)')
        a.axes.set_ylabel('FSO (a.u)')
        hthresholds = [0.1, 0.5, 0.9]
        a.axes.hlines(hthresholds,
                      xx[0],
                      xx[-1],
                      colors='k',
                      linestyles='dashed')
        a.axes.grid(True)
        textstr = ''

        res_01, okToPlot_01 = self.interpolRes(0.1, xx, yy)
        res_05, okToPlot_05 = self.interpolRes(0.5, xx, yy)
        res_09, okToPlot_09 = self.interpolRes(0.9, xx, yy)

        a.axes.plot(xx, yyBingham, 'r--')

        if (okToPlot_01 and okToPlot_05 and okToPlot_09):
            textstr = str(0.9) + ' --> ' + str(
                "{:.2f}".format(res_09)) + 'A\n' + str(0.5) + ' --> ' + str(
                    "{:.2f}".format(res_05)) + 'A\n' + str(
                        0.1) + ' --> ' + str("{:.2f}".format(res_01)) + 'A'
            a.axes.axvspan(1.0 / res_09,
                           1.0 / res_01,
                           alpha=0.3,
                           color='green')

            props = dict(boxstyle='round', facecolor='white')
            a.axes.text(0.0,
                        0.0,
                        textstr,
                        fontsize=12,
                        ha="left",
                        va="bottom",
                        bbox=props)

        return plt.show()
Exemplo n.º 2
0
    def _plotCurveFSC(self, fnmd, title, xTitle, yTitle, mdLabelX, mdLabelY):
        """
        This function is called by _showFSCCurve.
        It shows the FSC curve in terms of the resolution
        That this is not the normal representation of the FSC
        """
        md = xmippLib.MetaData(fnmd)
        xplotter = XmippPlotter(figure=None)
        xplotter.plot_title_fontsize = 11

        a = xplotter.createSubPlot(title, xTitle, yTitle, 1, 1)
        xplotter.plotMdFile(md, mdLabelX, mdLabelY, 'g')

        a.xaxis.set_major_formatter(FuncFormatter(self._formatFreq))
        xx, yy = self._prepareDataForPlot(md, mdLabelX, mdLabelY)
        a.hlines(0.143, xx[0], xx[-1], colors='k', linestyles='dashed')
        a.grid(True)

        return plt.show()