Esempio n. 1
0
    def setUp(self):
        TestCaseQt.setUp(self)
        self.plot = Plot1D()
        self.plot.show()
        x = range(20)
        y = range(20)
        self.plot.addCurve(x, y, legend='curve0')
        y = range(12, 32)
        self.plot.addCurve(x, y, legend='curve1')
        y = range(-2, 18)
        self.plot.addCurve(x, y, legend='curve2')
        self.widget = StatsWidget.StatsTable(plot=self.plot)

        mystats = statshandler.StatsHandler((
            stats.StatMin(),
            (stats.StatCoordMin(), statshandler.StatFormatter(None, qt.QTableWidgetItem)),
            stats.StatMax(),
            (stats.StatCoordMax(), statshandler.StatFormatter(None, qt.QTableWidgetItem)),
            stats.StatDelta(),
            ('std', numpy.std),
            ('mean', numpy.mean),
            stats.StatCOM()
        ))

        self.widget.setStats(mystats)
Esempio n. 2
0
    def testDisplayActiveItemsSyncOptions(self):
        """
        Test that the several option of the sync options are well
        synchronized between the different object"""
        widget = StatsWidget.StatsWidget(plot=self.plot)
        table = StatsWidget.StatsTable(plot=self.plot)

        def check_display_only_active_item(only_active):
            # check internal value
            self.assertIs(widget._statsTable._displayOnlyActItem, only_active)
            # self.assertTrue(table._displayOnlyActItem is only_active)
            # check gui display
            self.assertEqual(widget._options.isActiveItemMode(), only_active)

        for displayOnlyActiveItems in (True, False):
            with self.subTest(displayOnlyActiveItems=displayOnlyActiveItems):
                widget.setDisplayOnlyActiveItem(displayOnlyActiveItems)
                # table.setDisplayOnlyActiveItem(displayOnlyActiveItems)
                check_display_only_active_item(displayOnlyActiveItems)

        check_display_only_active_item(only_active=False)
        widget.setAttribute(qt.Qt.WA_DeleteOnClose)
        table.setAttribute(qt.Qt.WA_DeleteOnClose)
        widget.close()
        table.close()
    def setUp(self):
        TestCaseQt.setUp(self)
        self.scatterPlot = Plot2D()
        self.scatterPlot.addScatter([0, 1, 2, 20, 50, 60],
                                    [2, 3, 4, 26, 69, 6],
                                    [5, 6, 7, 10, 90, 20],
                                    legend=self.SCATTER_LEGEND)
        self.widget = StatsWidget.StatsTable(plot=self.scatterPlot)

        mystats = statshandler.StatsHandler(
            (stats.StatMin(),
             (stats.StatCoordMin(),
              statshandler.StatFormatter(None, qt.QTableWidgetItem)),
             stats.StatMax(),
             (stats.StatCoordMax(),
              statshandler.StatFormatter(None, qt.QTableWidgetItem)),
             stats.StatDelta(), ('std', numpy.std), ('mean', numpy.mean),
             stats.StatCOM()))

        self.widget.setStats(mystats)
Esempio n. 4
0
    def setUp(self):
        TestCaseQt.setUp(self)
        self.plot = Plot2D()

        self.plot.addImage(data=numpy.arange(128*128).reshape(128, 128),
                           legend='test image', replace=False)

        self.widget = StatsWidget.StatsTable(plot=self.plot)

        mystats = statshandler.StatsHandler((
            (stats.StatMin(), statshandler.StatFormatter()),
            (stats.StatCoordMin(), statshandler.StatFormatter(None, qt.QTableWidgetItem)),
            (stats.StatMax(), statshandler.StatFormatter()),
            (stats.StatCoordMax(), statshandler.StatFormatter(None, qt.QTableWidgetItem)),
            (stats.StatDelta(), statshandler.StatFormatter()),
            ('std', numpy.std),
            ('mean', numpy.mean),
            (stats.StatCOM(), statshandler.StatFormatter(None))
        ))

        self.widget.setStats(mystats)