Example #1
0
    def showResult(self, val=None, ax=None, cMin=None, cMax=None,
                   logScale=False, name='result', **kwargs):
        """show resulting velocity vector"""
        mesh = self.paraDomain()
        if val is None:
            val = self.velocity
        if cMin is None or cMax is None:
            cMin, cMax = interperc(val, 3)
        if ax is None:
            fig, ax = plt.subplots()
            self.figs[name] = fig
            ax, cbar = pg.show(mesh, val, logScale=logScale, axes=ax,
                               colorBar=True, cMin=cMin, cMax=cMax,
                               coverage=self.standardizedCoverage(), **kwargs)
            self.figs[name] = plt.gcf()
        else:
            gci = drawModel(ax, mesh, val, logScale=logScale,
                            colorBar=True, cMin=cMin, cMax=cMax,
                            coverage=self.standardizedCoverage(), **kwargs)
            labels = ['cMin', 'cMax', 'nLevs', 'orientation', 'label']
            subkwargs = {key: kwargs[key] for key in labels if key in kwargs}
            cbar = createColorbar(gci, **subkwargs)
        browser = CellBrowser(self.mesh, val, ax)
        browser.connect()

        self.axs[name] = ax
        if 'lines' in kwargs:
            plotLines(ax, kwargs['lines'])
        return ax, cbar
Example #2
0
    def showResult(self,
                   val=None,
                   ax=None,
                   cMin=None,
                   cMax=None,
                   logScale=False,
                   name='result',
                   **kwargs):
        """show resulting velocity vector"""
        mesh = self.paraDomain()
        if val is None:
            val = self.velocity
        if cMin is None or cMax is None:
            cMin, cMax = interperc(val, 3)
        if ax is None:
            fig, ax = plt.subplots()
            self.figs[name] = fig
            ax, cbar = pg.show(mesh,
                               val,
                               logScale=logScale,
                               ax=ax,
                               colorBar=True,
                               cMin=cMin,
                               cMax=cMax,
                               coverage=self.standardizedCoverage(),
                               **kwargs)
            self.figs[name] = plt.gcf()
        else:
            gci = drawModel(ax,
                            mesh,
                            val,
                            logScale=logScale,
                            colorBar=True,
                            cMin=cMin,
                            cMax=cMax,
                            coverage=self.standardizedCoverage(),
                            **kwargs)
            labels = ['cMin', 'cMax', 'nLevs', 'orientation', 'label']
            subkwargs = {key: kwargs[key] for key in labels if key in kwargs}
            cbar = createColorbar(gci, **subkwargs)
        browser = CellBrowser(self.mesh, val, ax)
        browser.connect()

        self.axs[name] = ax
        if 'lines' in kwargs:
            plotLines(ax, kwargs['lines'])
        return ax, cbar
Example #3
0
    def showResult(self, ax=None, cMin=None, cMax=None, logScale=False,
                   **kwargs):
        """show resulting velocity vector"""
        if cMin is None or cMax is None:
            cMin, cMax = interperc(self.velocity, 3)
        if ax is None:
            ax, cbar = pg.show(self.mesh, self.velocity, logScale=logScale,
                               colorBar=True, cMin=cMin, cMax=cMax, **kwargs)
            self.figs['result'] = plt.gcf()
        else:
            gci = drawModel(ax, self.mesh, self.velocity, logScale=logScale,
                            colorBar=True, cMin=cMin, cMax=cMax, **kwargs)
            createColorbar(gci, **kwargs)
        browser = CellBrowser(self.mesh, self.velocity, ax)
        browser.connect()

        self.axs['result'] = ax
        if 'lines' in kwargs:
            plotLines(ax, kwargs['lines'])
Example #4
0
    def showResult(self, ax=None, cMin=None, cMax=None, logScale=False, **kwargs):
        """show resulting velocity vector"""
        if cMin is None or cMax is None:
            cMin, cMax = interperc(self.velocity, 3)
        if ax is None:
            ax, cbar = pg.show(
                self.mesh, self.velocity, logScale=logScale, colorBar=True, cMin=cMin, cMax=cMax, **kwargs
            )
            fig, ax = plt.subplots()
            self.figs["result"] = fig
        else:
            gci = drawModel(
                ax, self.mesh, self.velocity, logScale=logScale, colorBar=True, cMin=cMin, cMax=cMax, **kwargs
            )
            cbar = createColorbar(gci, **kwargs)
            browser = CellBrowser(self.mesh, self.velocity, ax)
            browser.connect()
            plt.show()  # block=False)

        self.axs["result"] = ax
        if "lines" in kwargs:
            plotLines(ax, kwargs["lines"])
Example #5
0
    def showResult(self,
                   val=None,
                   ax=None,
                   cMin=None,
                   cMax=None,
                   logScale=False,
                   rays=False,
                   name='result',
                   **kwargs):
        """Show resulting velocity vector.

        Parameters
        ----------
        val : result array [self.velocity]
            field to show, usually the velocity vector
        ax : matplotlib.axes
            axes to plot into, if not give a new one-axis figure is created
        cMin/cMax : float
            minimum and maximum values for ranging colorbar
        logScale : bool [False]
            use logarithmic scale
        rays : bool [False]
            Show ray paths as well.

        Other parameters
        ----------------
        useCoverage : bool [True]
            use standardized (0 or 1) ray coverage as alpha-shading
        label : str
            label to write on colorbar
        orientaton : str
            color bar orientation
        nLevs : int [7]
            number of level values for color bar
        **kwargs : keyword arguments passed to the show function

        Returns
        -------
        ax : maxplotlib axes

        cb : matplotlib color bar object
        """
        mesh = self.paraDomain()
        if val is None:
            val = self.velocity
        if cMin is None or cMax is None:
            cMin, cMax = interperc(val, 3)
        coverage = 1
        if kwargs.pop('useCoverage', True):
            coverage = self.standardizedCoverage()
        label = kwargs.pop("label", "Velocity (m/s)")
        if ax is None:
            fig, ax = plt.subplots()
            self.figs[name] = fig
            ax, cbar = pg.show(mesh,
                               val,
                               logScale=logScale,
                               ax=ax,
                               colorBar=True,
                               cMin=cMin,
                               cMax=cMax,
                               coverage=coverage,
                               label=label,
                               hold=True,
                               **kwargs)
            self.figs[name] = plt.gcf()
        else:
            gci = drawModel(ax,
                            mesh,
                            val,
                            logScale=logScale,
                            colorBar=True,
                            cMin=cMin,
                            cMax=cMax,
                            coverage=coverage,
                            **kwargs)
            labels = ['cMin', 'cMax', 'nLevs', 'orientation']
            subkwargs = {key: kwargs[key] for key in labels if key in kwargs}
            cbar = createColorBar(gci, label=label, **subkwargs)
        if rays:
            self.showRayPaths(ax=ax, alpha=0.5, color="w", linewidths=.8)

        browser = CellBrowser(self.mesh, val, ax)
        browser.connect()

        self.axs[name] = ax
        if 'lines' in kwargs:
            plotLines(ax, kwargs['lines'])
        return ax, cbar
Example #6
0
    def showResult(self, val=None, ax=None, cMin=None, cMax=None,
                   logScale=False, rays=False, name='result', **kwargs):
        """Show resulting velocity vector.

        Parameters
        ----------
        val : result array [self.velocity]
            field to show, usually the velocity vector
        ax : matplotlib.axes
            axes to plot into, if not give a new one-axis figure is created
        cMin/cMax : float
            minimum and maximum values for ranging colorbar
        logScale : bool [False]
            use logarithmic scale
        rays : bool [False]
            Show ray paths as well.

        Other parameters
        ----------------
        useCoverage : bool [True]
            use standardized (0 or 1) ray coverage as alpha-shading
        label : str
            label to write on colorbar
        orientaton : str
            color bar orientation
        nLevs : int [7]
            number of level values for color bar
        **kwargs : keyword arguments passed to the show function

        Returns
        -------
        ax : maxplotlib axes

        cb : matplotlib color bar object
        """
        mesh = self.paraDomain()
        if val is None:
            val = self.velocity
        if cMin is None or cMax is None:
            cMin, cMax = interperc(val, 3)
        coverage = 1
        if kwargs.pop('useCoverage', True):
            coverage = self.standardizedCoverage()
        label = kwargs.pop("label", "Velocity (m/s)")
        if ax is None:
            fig, ax = plt.subplots()
            self.figs[name] = fig
            ax, cbar = pg.show(mesh, val, logScale=logScale, ax=ax,
                               colorBar=True, cMin=cMin, cMax=cMax,
                               coverage=coverage, label=label, hold=True,
                               **kwargs)
            self.figs[name] = plt.gcf()
        else:
            gci = drawModel(ax, mesh, val, logScale=logScale,
                            colorBar=True, cMin=cMin, cMax=cMax,
                            coverage=coverage, **kwargs)
            labels = ['cMin', 'cMax', 'nLevs', 'orientation']
            subkwargs = {key: kwargs[key] for key in labels if key in kwargs}
            cbar = createColorBar(gci, label=label, **subkwargs)
        if rays:
            self.showRayPaths(ax=ax, alpha=0.5, color="w", linewidths=.8)

        browser = CellBrowser(self.mesh, val, ax)
        browser.connect()

        self.axs[name] = ax
        if 'lines' in kwargs:
            plotLines(ax, kwargs['lines'])
        return ax, cbar