예제 #1
0
파일: test_plot.py 프로젝트: cwinpy/cwinpy
    def test_plot_nd(self):
        """
        Test multiple dimension plots.
        """

        # corner
        plot = Plot(
            self.allresults,
            parameters=["h0", "cosiota", "psi", "phi0"],
            plottype="corner",
        )
        assert len(plot.results) == len(self.allresults)
        assert plot.plottype == "corner"

        fig = plot.plot()  # create plot
        assert isinstance(fig, Figure) and isinstance(plot.fig, Figure)
        assert len(plot.fig.axes) == 16

        plot.save("nd_corner.png", dpi=150)
        fig.clf()
        fig.close()
        del plot
예제 #2
0
파일: test_plot.py 프로젝트: cwinpy/cwinpy
    def test_plot_1d(self):
        """
        Test 1D plots.
        """

        # histogram
        plot = Plot(self.allresults, parameters="h0", plottype="hist")
        assert len(plot.results) == len(self.allresults)
        assert plot.plottype == "hist"

        fig = plot.plot()  # create plot
        assert isinstance(fig, Figure) and isinstance(plot.fig, Figure)

        plot.save("oned_hist.png", dpi=150)
        fig.clf()
        fig.close()
        del plot

        # histogram with KDE
        plot = Plot(self.allresults,
                    parameters="h0",
                    plottype="hist",
                    kde=True)
        assert len(plot.results) == len(self.allresults)
        assert plot.plottype == "hist"

        fig = plot.plot()  # create plot
        assert isinstance(fig, Figure) and isinstance(plot.fig, Figure)

        plot.save("oned_hist_with_kde.png", dpi=150)
        fig.clf()
        fig.close()
        del plot

        # KDE
        plot = Plot(self.allresults, parameters="h0", plottype="kde")
        assert len(plot.results) == len(self.allresults)
        assert plot.plottype == "kde"

        fig = plot.plot()  # create plot
        assert isinstance(fig, Figure) and isinstance(plot.fig, Figure)

        plot.save("oned_kde.png", dpi=150)
        fig.clf()
        fig.close()
        del plot
예제 #3
0
파일: test_plot.py 프로젝트: cwinpy/cwinpy
    def test_plot_2d(self):
        """
        Test 2D plots.
        """

        # corner
        plot = Plot(self.allresults,
                    parameters=["h0", "cosiota"],
                    plottype="corner")
        assert len(plot.results) == len(self.allresults)
        assert plot.plottype == "corner"

        fig = plot.plot()  # create plot
        assert isinstance(fig, Figure) and isinstance(plot.fig, Figure)
        assert len(plot.fig.axes) == 4

        plot.save("twod_corner.png", dpi=150)
        fig.clf()
        fig.close()
        del plot

        # triangle
        plot = Plot(self.allresults,
                    parameters=["h0", "cosiota"],
                    plottype="triangle")
        assert len(plot.results) == len(self.allresults)
        assert plot.plottype == "triangle"

        fig = plot.plot()  # create plot
        assert isinstance(fig, Figure) and isinstance(plot.fig, Figure)
        assert len(plot.fig.axes) == 4

        plot.save("twod_triangle.png", dpi=150)
        fig.clf()
        fig.close()
        del plot

        # reverse triangle
        plot = Plot(self.allresults,
                    parameters=["h0", "cosiota"],
                    plottype="reverse_triangle")
        assert len(plot.results) == len(self.allresults)
        assert plot.plottype == "reverse_triangle"

        fig = plot.plot()  # create plot
        assert isinstance(fig, Figure) and isinstance(plot.fig, Figure)
        assert len(plot.fig.axes) == 4

        plot.save("twod_reverse_triangle.png", dpi=150)
        fig.clf()
        fig.close()
        del plot

        # contour
        plot = Plot(self.allresults,
                    parameters=["h0", "cosiota"],
                    plottype="contour")
        assert len(plot.results) == len(self.allresults)
        assert plot.plottype == "contour"

        fig = plot.plot()  # create plot
        assert isinstance(fig, Figure) and isinstance(plot.fig, Figure)
        assert len(plot.fig.axes) == 1

        plot.save("twod_contour.png", dpi=150)
        fig.clf()
        fig.close()
        del plot