Esempio n. 1
0
    def test_plot_config(self):
        ps = PlotSettings( )
        plot_config = PlotConfig(ps , "Golden Sample", x_label="x", y_label="y")

        limits = PlotLimits()
        limits.count_limits = 1, 2
        limits.depth_limits = 3, 4
        limits.density_limits = 5, 6
        limits.date_limits = datetime.date(2005, 2, 5), datetime.date(2006, 2, 6)
        limits.index_limits = 7, 8
        limits.value_limits = 9.0, 10.0

        plot_config.limits = limits
        self.assertEqual(plot_config.limits, limits)

        plot_config.setDistributionLineEnabled(True)
        plot_config.setLegendEnabled(False)
        plot_config.setGridEnabled(False)
        plot_config.setRefcaseEnabled(False)
        plot_config.setObservationsEnabled(False)

        style = PlotStyle("test_style", line_style=".", marker="g", width=2.5, size=7.5)

        plot_config.setDefaultStyle(style)
        plot_config.setRefcaseStyle(style)
        plot_config.setStatisticsStyle("mean", style)
        plot_config.setStatisticsStyle("min-max", style)
        plot_config.setStatisticsStyle("p50", style)
        plot_config.setStatisticsStyle("p10-p90", style)
        plot_config.setStatisticsStyle("p33-p67", style)
        plot_config.setStatisticsStyle("std", style)

        copy_of_plot_config = PlotConfig(ps , "Copy of Golden Sample")
        copy_of_plot_config.copyConfigFrom(plot_config)

        self.assertEqual(plot_config.isLegendEnabled(), copy_of_plot_config.isLegendEnabled())
        self.assertEqual(plot_config.isGridEnabled(), copy_of_plot_config.isGridEnabled())
        self.assertEqual(plot_config.isObservationsEnabled(), copy_of_plot_config.isObservationsEnabled())
        self.assertEqual(plot_config.isDistributionLineEnabled(), copy_of_plot_config.isDistributionLineEnabled())

        self.assertEqual(plot_config.refcaseStyle(), copy_of_plot_config.refcaseStyle())
        self.assertEqual(plot_config.observationsStyle(), copy_of_plot_config.observationsStyle())

        self.assertEqual(plot_config.histogramStyle(), copy_of_plot_config.histogramStyle())
        self.assertEqual(plot_config.defaultStyle(), copy_of_plot_config.defaultStyle())
        self.assertEqual(plot_config.currentColor(), copy_of_plot_config.currentColor())

        self.assertEqual(plot_config.getStatisticsStyle("mean"), copy_of_plot_config.getStatisticsStyle("mean"))
        self.assertEqual(plot_config.getStatisticsStyle("min-max"), copy_of_plot_config.getStatisticsStyle("min-max"))
        self.assertEqual(plot_config.getStatisticsStyle("p50"), copy_of_plot_config.getStatisticsStyle("p50"))
        self.assertEqual(plot_config.getStatisticsStyle("p10-p90"), copy_of_plot_config.getStatisticsStyle("p10-p90"))
        self.assertEqual(plot_config.getStatisticsStyle("p33-p67"), copy_of_plot_config.getStatisticsStyle("p33-p67"))
        self.assertEqual(plot_config.getStatisticsStyle("std"), copy_of_plot_config.getStatisticsStyle("std"))

        self.assertEqual(plot_config.title(), copy_of_plot_config.title())

        self.assertEqual(plot_config.limits, copy_of_plot_config.limits)


        plot_config.currentColor()  # cycle state will not be copied
        plot_config.nextColor()

        copy_of_plot_config = PlotConfig(ps, "Another Copy of Golden Sample")
        copy_of_plot_config.copyConfigFrom(plot_config)

        self.assertEqual(plot_config.refcaseStyle(), copy_of_plot_config.refcaseStyle())
        self.assertEqual(plot_config.observationsStyle(), copy_of_plot_config.observationsStyle())

        self.assertNotEqual(plot_config.histogramStyle(), copy_of_plot_config.histogramStyle())
        self.assertNotEqual(plot_config.defaultStyle(), copy_of_plot_config.defaultStyle())
        self.assertNotEqual(plot_config.currentColor(), copy_of_plot_config.currentColor())

        self.assertNotEqual(plot_config.getStatisticsStyle("mean"), copy_of_plot_config.getStatisticsStyle("mean"))
        self.assertNotEqual(plot_config.getStatisticsStyle("min-max"), copy_of_plot_config.getStatisticsStyle("min-max"))
        self.assertNotEqual(plot_config.getStatisticsStyle("p50"), copy_of_plot_config.getStatisticsStyle("p50"))
        self.assertNotEqual(plot_config.getStatisticsStyle("p10-p90"), copy_of_plot_config.getStatisticsStyle("p10-p90"))
        self.assertNotEqual(plot_config.getStatisticsStyle("p33-p67"), copy_of_plot_config.getStatisticsStyle("p33-p67"))
        self.assertNotEqual(plot_config.getStatisticsStyle("std"), copy_of_plot_config.getStatisticsStyle("std"))
Esempio n. 2
0
    def test_plot_config(self):
        ps = PlotSettings()
        plot_config = PlotConfig(ps, "Golden Sample", x_label="x", y_label="y")

        limits = PlotLimits()
        limits.count_limits = 1, 2
        limits.depth_limits = 3, 4
        limits.density_limits = 5, 6
        limits.date_limits = datetime.date(2005, 2,
                                           5), datetime.date(2006, 2, 6)
        limits.index_limits = 7, 8
        limits.value_limits = 9.0, 10.0

        plot_config.limits = limits
        self.assertEqual(plot_config.limits, limits)

        plot_config.setDistributionLineEnabled(True)
        plot_config.setLegendEnabled(False)
        plot_config.setGridEnabled(False)
        plot_config.setRefcaseEnabled(False)
        plot_config.setObservationsEnabled(False)

        style = PlotStyle("test_style",
                          line_style=".",
                          marker="g",
                          width=2.5,
                          size=7.5)

        plot_config.setDefaultStyle(style)
        plot_config.setRefcaseStyle(style)
        plot_config.setStatisticsStyle("mean", style)
        plot_config.setStatisticsStyle("min-max", style)
        plot_config.setStatisticsStyle("p50", style)
        plot_config.setStatisticsStyle("p10-p90", style)
        plot_config.setStatisticsStyle("p33-p67", style)
        plot_config.setStatisticsStyle("std", style)

        copy_of_plot_config = PlotConfig(ps, "Copy of Golden Sample")
        copy_of_plot_config.copyConfigFrom(plot_config)

        self.assertEqual(plot_config.isLegendEnabled(),
                         copy_of_plot_config.isLegendEnabled())
        self.assertEqual(plot_config.isGridEnabled(),
                         copy_of_plot_config.isGridEnabled())
        self.assertEqual(plot_config.isObservationsEnabled(),
                         copy_of_plot_config.isObservationsEnabled())
        self.assertEqual(plot_config.isDistributionLineEnabled(),
                         copy_of_plot_config.isDistributionLineEnabled())

        self.assertEqual(plot_config.refcaseStyle(),
                         copy_of_plot_config.refcaseStyle())
        self.assertEqual(plot_config.observationsStyle(),
                         copy_of_plot_config.observationsStyle())

        self.assertEqual(plot_config.histogramStyle(),
                         copy_of_plot_config.histogramStyle())
        self.assertEqual(plot_config.defaultStyle(),
                         copy_of_plot_config.defaultStyle())
        self.assertEqual(plot_config.currentColor(),
                         copy_of_plot_config.currentColor())

        self.assertEqual(plot_config.getStatisticsStyle("mean"),
                         copy_of_plot_config.getStatisticsStyle("mean"))
        self.assertEqual(plot_config.getStatisticsStyle("min-max"),
                         copy_of_plot_config.getStatisticsStyle("min-max"))
        self.assertEqual(plot_config.getStatisticsStyle("p50"),
                         copy_of_plot_config.getStatisticsStyle("p50"))
        self.assertEqual(plot_config.getStatisticsStyle("p10-p90"),
                         copy_of_plot_config.getStatisticsStyle("p10-p90"))
        self.assertEqual(plot_config.getStatisticsStyle("p33-p67"),
                         copy_of_plot_config.getStatisticsStyle("p33-p67"))
        self.assertEqual(plot_config.getStatisticsStyle("std"),
                         copy_of_plot_config.getStatisticsStyle("std"))

        self.assertEqual(plot_config.title(), copy_of_plot_config.title())

        self.assertEqual(plot_config.limits, copy_of_plot_config.limits)

        plot_config.currentColor()  # cycle state will not be copied
        plot_config.nextColor()

        copy_of_plot_config = PlotConfig(ps, "Another Copy of Golden Sample")
        copy_of_plot_config.copyConfigFrom(plot_config)

        self.assertEqual(plot_config.refcaseStyle(),
                         copy_of_plot_config.refcaseStyle())
        self.assertEqual(plot_config.observationsStyle(),
                         copy_of_plot_config.observationsStyle())

        self.assertNotEqual(plot_config.histogramStyle(),
                            copy_of_plot_config.histogramStyle())
        self.assertNotEqual(plot_config.defaultStyle(),
                            copy_of_plot_config.defaultStyle())
        self.assertNotEqual(plot_config.currentColor(),
                            copy_of_plot_config.currentColor())

        self.assertNotEqual(plot_config.getStatisticsStyle("mean"),
                            copy_of_plot_config.getStatisticsStyle("mean"))
        self.assertNotEqual(plot_config.getStatisticsStyle("min-max"),
                            copy_of_plot_config.getStatisticsStyle("min-max"))
        self.assertNotEqual(plot_config.getStatisticsStyle("p50"),
                            copy_of_plot_config.getStatisticsStyle("p50"))
        self.assertNotEqual(plot_config.getStatisticsStyle("p10-p90"),
                            copy_of_plot_config.getStatisticsStyle("p10-p90"))
        self.assertNotEqual(plot_config.getStatisticsStyle("p33-p67"),
                            copy_of_plot_config.getStatisticsStyle("p33-p67"))
        self.assertNotEqual(plot_config.getStatisticsStyle("std"),
                            copy_of_plot_config.getStatisticsStyle("std"))
Esempio n. 3
0
    def test_plot_config(self):
        plot_config = PlotConfig("Golden Sample", x_label="x", y_label="y")

        plot_config.setDistributionLineEnabled(True)
        plot_config.setLegendEnabled(False)
        plot_config.setGridEnabled(False)
        plot_config.setRefcaseEnabled(False)
        plot_config.setObservationsEnabled(False)
        plot_config.deactivateDateSupport()

        plot_config.setDefaultStyle(".", "g")
        plot_config.setRefcaseStyle(".", "g")
        plot_config.setStatisticsStyle("mean", ".", "g")
        plot_config.setStatisticsStyle("min-max", ".", "g")
        plot_config.setStatisticsStyle("p50", ".", "g")
        plot_config.setStatisticsStyle("p10-p90", ".", "g")
        plot_config.setStatisticsStyle("p33-p67", ".", "g")

        copy_of_plot_config = PlotConfig("Copy of Golden Sample")
        copy_of_plot_config.copyConfigFrom(plot_config)

        self.assertEqual(plot_config.isLegendEnabled(), copy_of_plot_config.isLegendEnabled())
        self.assertEqual(plot_config.isGridEnabled(), copy_of_plot_config.isGridEnabled())
        self.assertEqual(plot_config.isObservationsEnabled(), copy_of_plot_config.isObservationsEnabled())
        self.assertEqual(plot_config.isDistributionLineEnabled(), copy_of_plot_config.isDistributionLineEnabled())
        self.assertEqual(plot_config.isDateSupportActive(), copy_of_plot_config.isDateSupportActive())

        self.assertEqual(plot_config.refcaseStyle(), copy_of_plot_config.refcaseStyle())
        self.assertEqual(plot_config.observationsStyle(), copy_of_plot_config.observationsStyle())

        self.assertEqual(plot_config.histogramStyle(), copy_of_plot_config.histogramStyle())
        self.assertEqual(plot_config.defaultStyle(), copy_of_plot_config.defaultStyle())
        self.assertEqual(plot_config.currentColor(), copy_of_plot_config.currentColor())

        self.assertEqual(plot_config.getStatisticsStyle("mean"), copy_of_plot_config.getStatisticsStyle("mean"))
        self.assertEqual(plot_config.getStatisticsStyle("min-max"), copy_of_plot_config.getStatisticsStyle("min-max"))
        self.assertEqual(plot_config.getStatisticsStyle("p50"), copy_of_plot_config.getStatisticsStyle("p50"))
        self.assertEqual(plot_config.getStatisticsStyle("p10-p90"), copy_of_plot_config.getStatisticsStyle("p10-p90"))
        self.assertEqual(plot_config.getStatisticsStyle("p33-p67"), copy_of_plot_config.getStatisticsStyle("p33-p67"))

        self.assertEqual(plot_config.title(), copy_of_plot_config.title())


        plot_config.currentColor()  # cycle state will not be copied
        plot_config.nextColor()

        copy_of_plot_config = PlotConfig("Another Copy of Golden Sample")
        copy_of_plot_config.copyConfigFrom(plot_config)

        self.assertEqual(plot_config.refcaseStyle(), copy_of_plot_config.refcaseStyle())
        self.assertEqual(plot_config.observationsStyle(), copy_of_plot_config.observationsStyle())

        self.assertNotEqual(plot_config.histogramStyle(), copy_of_plot_config.histogramStyle())
        self.assertNotEqual(plot_config.defaultStyle(), copy_of_plot_config.defaultStyle())
        self.assertNotEqual(plot_config.currentColor(), copy_of_plot_config.currentColor())

        self.assertNotEqual(plot_config.getStatisticsStyle("mean"), copy_of_plot_config.getStatisticsStyle("mean"))
        self.assertNotEqual(plot_config.getStatisticsStyle("min-max"), copy_of_plot_config.getStatisticsStyle("min-max"))
        self.assertNotEqual(plot_config.getStatisticsStyle("p50"), copy_of_plot_config.getStatisticsStyle("p50"))
        self.assertNotEqual(plot_config.getStatisticsStyle("p10-p90"), copy_of_plot_config.getStatisticsStyle("p10-p90"))
        self.assertNotEqual(plot_config.getStatisticsStyle("p33-p67"), copy_of_plot_config.getStatisticsStyle("p33-p67"))