Пример #1
0
    def test_plot(self):
        """Test plot function"""
        from silx import sx  # Lazy loading to avoid it to create QApplication

        y = numpy.random.random(100)
        x = numpy.arange(len(y)) * 0.5

        # Nothing
        plt = sx.plot()
        self._expose_and_close(plt)

        # y
        plt = sx.plot(y, title='y')
        self._expose_and_close(plt)

        # y, style
        plt = sx.plot(y, 'blued ', title='y, "blued "')
        self._expose_and_close(plt)

        # x, y
        plt = sx.plot(x, y, title='x, y')
        self._expose_and_close(plt)

        # x, y, style
        plt = sx.plot(x, y, 'ro-', xlabel='x', title='x, y, "ro-"')
        self._expose_and_close(plt)

        # x, y, style, y
        plt = sx.plot(x,
                      y,
                      'ro-',
                      y**2,
                      xlabel='x',
                      ylabel='y',
                      title='x, y, "ro-", y ** 2')
        self._expose_and_close(plt)

        # x, y, style, y, style
        plt = sx.plot(x,
                      y,
                      'ro-',
                      y**2,
                      'b--',
                      title='x, y, "ro-", y ** 2, "b--"')
        self._expose_and_close(plt)

        # x, y, style, x, y, style
        plt = sx.plot(x,
                      y,
                      'ro-',
                      x,
                      y**2,
                      'b--',
                      title='x, y, "ro-", x, y ** 2, "b--"')
        self._expose_and_close(plt)

        # x, y, x, y
        plt = sx.plot(x, y, x, y**2, title='x, y, x, y ** 2')
        self._expose_and_close(plt)
Пример #2
0
        def test_plot(self):
            """Test plot function"""
            y = numpy.random.random(100)
            x = numpy.arange(len(y)) * 0.5

            # Nothing
            plt = sx.plot()
            self._expose_and_close(plt)

            # y
            plt = sx.plot(y, title='y')
            self._expose_and_close(plt)

            # y, style
            plt = sx.plot(y, 'blued ', title='y, "blued "')
            self._expose_and_close(plt)

            # x, y
            plt = sx.plot(x, y, title='x, y')
            self._expose_and_close(plt)

            # x, y, style
            plt = sx.plot(x, y, 'ro-', xlabel='x', title='x, y, "ro-"')
            self._expose_and_close(plt)

            # x, y, style, y
            plt = sx.plot(x,
                          y,
                          'ro-',
                          y**2,
                          xlabel='x',
                          ylabel='y',
                          title='x, y, "ro-", y ** 2')
            self._expose_and_close(plt)

            # x, y, style, y, style
            plt = sx.plot(x,
                          y,
                          'ro-',
                          y**2,
                          'b--',
                          title='x, y, "ro-", y ** 2, "b--"')
            self._expose_and_close(plt)

            # x, y, style, x, y, style
            plt = sx.plot(x,
                          y,
                          'ro-',
                          x,
                          y**2,
                          'b--',
                          title='x, y, "ro-", x, y ** 2, "b--"')
            self._expose_and_close(plt)

            # x, y, x, y
            plt = sx.plot(x, y, x, y**2, title='x, y, x, y ** 2')
            self._expose_and_close(plt)
Пример #3
0
        def test_plot(self):
            """Test plot function"""
            y = numpy.random.random(100)
            x = numpy.arange(len(y)) * 0.5

            # Nothing
            plt = sx.plot()
            self._expose_and_close(plt)

            # y
            plt = sx.plot(y, title='y')
            self._expose_and_close(plt)

            # y, style
            plt = sx.plot(y, 'blued ', title='y, "blued "')
            self._expose_and_close(plt)

            # x, y
            plt = sx.plot(x, y, title='x, y')
            self._expose_and_close(plt)

            # x, y, style
            plt = sx.plot(x, y, 'ro-', xlabel='x', title='x, y, "ro-"')
            self._expose_and_close(plt)

            # x, y, style, y
            plt = sx.plot(x, y, 'ro-', y ** 2, xlabel='x', ylabel='y',
                          title='x, y, "ro-", y ** 2')
            self._expose_and_close(plt)

            # x, y, style, y, style
            plt = sx.plot(x, y, 'ro-', y ** 2, 'b--',
                          title='x, y, "ro-", y ** 2, "b--"')
            self._expose_and_close(plt)

            # x, y, style, x, y, style
            plt = sx.plot(x, y, 'ro-', x, y ** 2, 'b--',
                          title='x, y, "ro-", x, y ** 2, "b--"')
            self._expose_and_close(plt)

            # x, y, x, y
            plt = sx.plot(x, y, x, y ** 2, title='x, y, x, y ** 2')
            self._expose_and_close(plt)
Пример #4
0
        def test_ginput(self):
            """Test ginput function

            This does NOT perform interactive tests
            """

            plt = sx.plot()
            self.qWaitForWindowExposed(plt)
            self.qapp.processEvents()

            result = sx.ginput(1, timeout=0.1)
            self.assertEqual(len(result), 0)

            plt.setAttribute(qt.Qt.WA_DeleteOnClose)
            plt.close()