コード例 #1
0
    def visualize(self, U, codim=2, **kwargs):
        """Visualize scalar data associated to the grid as a patch plot.

        Parameters
        ----------
        U
            |NumPy array| of the data to visualize. If `U.dim == 2 and len(U) > 1`, the
            data is visualized as a time series of plots. Alternatively, a tuple of
            |Numpy arrays| can be provided, in which case a subplot is created for
            each entry of the tuple. The lengths of all arrays have to agree.
        codim
            The codimension of the entities the data in `U` is attached to (either 0 or 2).
        kwargs
            See :func:`~pymor.gui.qt.visualize_patch`
        """
        from pymor.gui.qt import visualize_matplotlib_1d
        from pymor.vectorarrays.interfaces import VectorArrayInterface
        from pymor.vectorarrays.numpy import NumpyVectorSpace, NumpyVectorArray
        if isinstance(U, (np.ndarray, VectorArrayInterface)):
            U = (U, )
        assert all(
            isinstance(u, (np.ndarray, VectorArrayInterface)) for u in U)
        U = tuple(
            NumpyVectorSpace.make_array(u) if isinstance(u, np.ndarray) else
            u if isinstance(u, NumpyVectorArray
                            ) else NumpyVectorSpace.make_array(u.to_numpy())
            for u in U)
        visualize_matplotlib_1d(self, U, codim=codim, **kwargs)
コード例 #2
0
    def visualize(self,
                  U,
                  discretization,
                  title=None,
                  legend=None,
                  block=None):
        """Visualize the provided data.

        Parameters
        ----------
        U
            |VectorArray| of the data to visualize. If `len(U) > 1`, the data is visualized
            as a time series of plots. Alternatively, a tuple of |VectorArrays| can be
            provided, in which case several plots are made into the same axes. The
            lengths of all arrays have to agree.
        discretization
            Filled in by :meth:`pymor.discretizations.DiscretizationBase.visualize` (ignored).
        title
            Title of the plot.
        legend
            Description of the data that is plotted. Most useful if `U` is a tuple in which
            case `legend` has to be a tuple of strings of the same length.
        block
            If `True`, block execution until the plot window is closed. If `None`, use the
            default provided during instantiation.
        """
        block = self.block if block is None else block
        from pymor.gui.qt import visualize_matplotlib_1d
        visualize_matplotlib_1d(self.grid,
                                U,
                                codim=self.codim,
                                title=title,
                                legend=legend,
                                block=block)
コード例 #3
0
ファイル: oned.py プロジェクト: JuliaBru/pymor
    def visualize(self, U, codim=2, **kwargs):
        """Visualize scalar data associated to the grid as a patch plot.

        Parameters
        ----------
        U
            |NumPy array| of the data to visualize. If `U.dim == 2 and len(U) > 1`, the
            data is visualized as a time series of plots. Alternatively, a tuple of
            |Numpy arrays| can be provided, in which case a subplot is created for
            each entry of the tuple. The lengths of all arrays have to agree.
        codim
            The codimension of the entities the data in `U` is attached to (either 0 or 2).
        kwargs
            See :func:`~pymor.gui.qt.visualize_patch`
        """
        from pymor.gui.qt import visualize_matplotlib_1d
        from pymor.vectorarrays.interfaces import VectorArrayInterface
        from pymor.vectorarrays.numpy import NumpyVectorArray
        if isinstance(U, (np.ndarray, VectorArrayInterface)):
            U = (U,)
        assert all(isinstance(u, (np.ndarray, VectorArrayInterface)) for u in U)
        U = tuple(NumpyVectorArray(u) if isinstance(u, np.ndarray) else
                  u if isinstance(u, NumpyVectorArray) else
                  NumpyVectorArray(u.data)
                  for u in U)
        visualize_matplotlib_1d(self, U, codim=codim, **kwargs)
コード例 #4
0
ファイル: oned.py プロジェクト: lucas-ca/pymor
    def visualize(self, U, codim=2, **kwargs):
        """Visualize scalar data associated to the grid as a plot.

        Parameters
        ----------
        U
            |VectorArray| of the data to visualize. If `len(U) > 1`, the data is visualized
            as a time series of plots. Alternatively, a tuple of |VectorArrays| can be
            provided, in which case several plots are made into the same axes. The
            lengths of all arrays have to agree.
        codim
            The codimension of the entities the data in `U` is attached to (either 0 or 1).
        kwargs
            See :func:`~pymor.gui.qt.visualize_matplotlib_1d`
        """
        from pymor.gui.qt import visualize_matplotlib_1d
        from pymor.vectorarrays.numpy import NumpyVectorArray
        if not isinstance(U, NumpyVectorArray):
            U = NumpyVectorArray(U, copy=False)
        visualize_matplotlib_1d(self, U, codim=codim, **kwargs)
コード例 #5
0
    def visualize(self, U, codim=2, **kwargs):
        """Visualize scalar data associated to the grid as a plot.

        Parameters
        ----------
        U
            |VectorArray| of the data to visualize. If `len(U) > 1`, the data is visualized
            as a time series of plots. Alternatively, a tuple of |VectorArrays| can be
            provided, in which case several plots are made into the same axes. The
            lengths of all arrays have to agree.
        codim
            The codimension of the entities the data in `U` is attached to (either 0 or 1).
        kwargs
            See :func:`~pymor.gui.qt.visualize_matplotlib_1d`
        """
        from pymor.gui.qt import visualize_matplotlib_1d
        from pymor.la.numpyvectorarray import NumpyVectorArray
        if not isinstance(U, NumpyVectorArray):
            U = NumpyVectorArray(U, copy=False)
        visualize_matplotlib_1d(self, U, codim=codim, **kwargs)
コード例 #6
0
ファイル: visualizers.py プロジェクト: pymor/pymor
    def visualize(self, U, m, title=None, legend=None, block=None):
        """Visualize the provided data.

        Parameters
        ----------
        U
            |VectorArray| of the data to visualize. If `len(U) > 1`, the data is visualized
            as a time series of plots. Alternatively, a tuple of |VectorArrays| can be
            provided, in which case several plots are made into the same axes. The
            lengths of all arrays have to agree.
        m
            Filled in by :meth:`pymor.models.ModelBase.visualize` (ignored).
        title
            Title of the plot.
        legend
            Description of the data that is plotted. Most useful if `U` is a tuple in which
            case `legend` has to be a tuple of strings of the same length.
        block
            If `True`, block execution until the plot window is closed. If `None`, use the
            default provided during instantiation.
        """
        block = self.block if block is None else block
        from pymor.gui.qt import visualize_matplotlib_1d
        visualize_matplotlib_1d(self.grid, U, codim=self.codim, title=title, legend=legend, block=block)