コード例 #1
0
from pybimstab.slope import AnthropicSlope
from pybimstab.slipsurface import CircularSurface
from pybimstab.slices import MaterialParameters, Slices
slope = AnthropicSlope(slopeHeight=7.5,
                       slopeDip=[1, 1.5],
                       crownDist=5,
                       toeDist=5)
surface = CircularSurface(slopeCoords=slope.coords,
                          dist1=2,
                          dist2=10,
                          radius=9)
material = MaterialParameters(cohesion=15,
                              frictAngle=23,
                              unitWeight=17,
                              blocksUnitWeight=21,
                              wtUnitWeight=9.8)
slices = Slices(material=material,
                slipSurfCoords=surface.coords,
                slopeCoords=slope.coords,
                numSlices=10,
                watertabCoords=None,
                bim=None)
fig = slices.plot()
コード例 #2
0
# Example Case 5 (Fredlund & Krahn, 1977)
from numpy import array
from pybimstab.slope import AnthropicSlope
from pybimstab.slipsurface import CircularSurface
from pybimstab.watertable import WaterTable
from pybimstab.slices import MaterialParameters, Slices
from pybimstab.slopestabl import SlopeStabl
slope = AnthropicSlope(slopeHeight=40,
                       slopeDip=[2, 1],
                       crownDist=60,
                       toeDist=30,
                       depth=20)
surface = CircularSurface(slopeCoords=slope.coords,
                          dist1=45.838,
                          dist2=158.726,
                          radius=80)
material = MaterialParameters(cohesion=600,
                              frictAngle=20,
                              unitWeight=120,
                              wtUnitWeight=62.4)
watertable = WaterTable(slopeCoords=slope.coords,
                        watertabDepths=array([[0, 140], [20, 0]]))
slices = Slices(material=material,
                slipSurfCoords=surface.coords,
                slopeCoords=slope.coords,
                numSlices=50,
                watertabCoords=watertable.coords,
                bim=None)
stabAnalysis = SlopeStabl(slices, seedFS=1, Kh=0)
fig = stabAnalysis.plot()
コード例 #3
0
ファイル: slices.py プロジェクト: eamontoyaa/pybimstab
    def plot(self, plotFittedCirc=False):
        '''Method for generating a graphic of the slope stability model when is
        possible to watch the slices in the soil mass above the slip surface.

        Returns:
            (`matplotlib.figure.Figure`): object with the matplotlib structure\
                of the plot. You might use it to save the figure for example.

        Examples:
            >>> from numpy import array
            >>> from pybimstab.slope import AnthropicSlope
            >>> from pybimstab.slipsurface import CircularSurface
            >>> from pybimstab.slices import MaterialParameters, Slices
            >>> slope = AnthropicSlope(slopeHeight=7.5, slopeDip=[1, 1.5],
            >>>                        crownDist=5, toeDist=5)
            >>> surface = CircularSurface(slopeCoords=slope.coords,
            >>>                           dist1=2, dist2=10, radius=9)
            >>> material = MaterialParameters(
            >>>     cohesion=15, frictAngle=23, unitWeight=17,
            >>>     blocksUnitWeight=21, wtUnitWeight=9.8)
            >>> slices = Slices(
            >>>     material=material, slipSurfCoords=surface.coords,
            >>>     slopeCoords=slope.coords, numSlices=10,
            >>>     watertabCoords=None, bim=None)
            >>> fig = slices.plot()

            .. figure:: https://rawgit.com/eamontoyaa/pybimstab/master/examples/figures/slices_Slices_example1.svg
                :alt: slices_Slices_example1

            .. only:: html

                :download:`example script<../examples/figuresScripts/slices_Slices_example1.py>`.

            >>> from numpy import array
            >>> from pybimstab.slope import NaturalSlope
            >>> from pybimstab.watertable import WaterTable
            >>> from pybimstab.bim import BlocksInMatrix
            >>> from pybimstab.slipsurface import CircularSurface
            >>> from pybimstab.slipsurface import TortuousSurface
            >>> from pybimstab.slices import MaterialParameters, Slices
            >>> terrainCoords = array(
            >>>     [[-2.49, 0.1, 1.7, 3.89, 5.9, 8.12, 9.87, 13.29, 20.29,
            >>>       21.43, 22.28, 23.48, 24.65, 25.17],
            >>>      [18.16, 17.88, 17.28, 15.73, 14.31, 13.58, 13, 3.61, 3.61,
            >>>       3.32, 2.71, 2.23, 1.21, 0.25]])
            >>> slope = NaturalSlope(terrainCoords)
            >>> bim = BlocksInMatrix(slopeCoords=slope.coords, blockProp=0.3,
            >>>                      tileSize=0.35, seed=123)
            >>> watertabDepths = array([[0, 5, 10, 15],
            >>>                         [8, 7, 3, 0]])
            >>> watertable = WaterTable(slopeCoords=slope.coords,
            >>>                         watertabDepths=watertabDepths,
            >>>                         smoothFactor=3)
            >>> preferredPath = CircularSurface(
            >>>     slopeCoords=slope.coords, dist1=5, dist2=15.78, radius=20)
            >>> surface = TortuousSurface(
            >>>     bim, dist1=4, dist2=15.78, heuristic='euclidean',
            >>>     reverseLeft=False, reverseUp=False, smoothFactor=2,
            >>>     preferredPath=preferredPath.coords, prefPathFact=2)
            >>> material = MaterialParameters(
            >>>     cohesion=15, frictAngle=23, unitWeight=17,
            >>>     blocksUnitWeight=21, wtUnitWeight=9.8)
            >>> slices = Slices(
            >>>     material=material, slipSurfCoords=surface.coords,
            >>>     slopeCoords=slope.coords, numSlices=10,
            >>>     watertabCoords=watertable.coords, bim=bim)
            >>> fig = slices.plot()

            .. figure:: https://rawgit.com/eamontoyaa/pybimstab/master/examples/figures/slices_Slices_example2.svg
                :alt: slices_Slices_example2

            .. only:: html

                :download:`example script<../examples/figuresScripts/slices_Slices_example2.py>`.
        '''
        import numpy as np
        from matplotlib import pyplot as plt
        from matplotlib.colors import LinearSegmentedColormap as newcmap
        from pybimstab.slipsurface import CircularSurface

        # Variables to control the color map and its legend
        if self.bim is not None:
            if np.any(self.bim.grid == -1):
                cmap = newcmap.from_list('BIMcmap',
                                         ['white', 'lightgray', 'black'], 3)
                ticks = [-1 + 0.333, 0, 1 - 0.333]
                ticksLabels = ['None', 'Matrix', 'Blocks']
            else:
                cmap = newcmap.from_list('BIMcmap', ['lightgray', 'black'], 2)
                ticks = [0.25, 0.75]
                ticksLabels = ['Matrix', 'Blocks']
        # Plot body
        fig = plt.figure()
        ax = fig.add_subplot(111)
        if self.bim is not None:
            bar = ax.pcolormesh(self.bim.xCells,
                                self.bim.yCells,
                                self.bim.grid,
                                cmap=cmap)
            # Configuring the colorbar
            bar = plt.colorbar(bar,
                               ax=ax,
                               ticks=ticks,
                               pad=0.05,
                               shrink=0.15,
                               aspect=3)
            bar.ax.set_yticklabels(ticksLabels, fontsize='small')
        if plotFittedCirc:
            circSurf = CircularSurface(slopeCoords=self.slopeCoords,
                                       dist1=self.fittedCirc['dist1'],
                                       dist2=self.fittedCirc['dist2'],
                                       radius=self.fittedCirc['radius'])
            ax.plot(*circSurf.coords, ':r', label='Fitted cir. surf.')
        for slice_ in self.slices:
            ax.plot(slice_.coords[0], slice_.coords[1], ':r', lw=0.5)
        ax.plot(self.slipSurfCoords[0],
                self.slipSurfCoords[1],
                '-r',
                label='slip surface')
        ax.plot(self.slopeCoords[0], self.slopeCoords[1], '-k')
        if self.watertabCoords is not None:
            ax.plot(self.watertabCoords[0],
                    self.watertabCoords[1],
                    'deepskyblue',
                    lw=0.9,
                    label='watertable')
        # Plot settings
        ax.set_aspect(1)
        ax.legend(fontsize='small', bbox_to_anchor=(1.005, 1), loc=2)
        ax.grid(True, ls='--', lw=0.5)
        ax.set_xlim(
            (self.slopeCoords[0].min() - 0.02 * self.slopeCoords[0].max(),
             1.02 * self.slopeCoords[0].max()))
        ax.set_ylim(
            (self.slopeCoords[1].min() - 0.02 * self.slopeCoords[1].max(),
             1.02 * self.slopeCoords[1].max()))
        fig.tight_layout()
        return fig
コード例 #4
0
],
                       [
                           18.16, 17.88, 17.28, 15.73, 14.31, 13.58, 13, 3.61,
                           3.61, 3.32, 2.71, 2.23, 1.21, 0.25
                       ]])
slope = NaturalSlope(terrainCoords)
bim = BlocksInMatrix(slopeCoords=slope.coords,
                     blockProp=0.2,
                     tileSize=0.35,
                     seed=3210)
watertabDepths = array([[0, 5, 10, 15], [8, 7, 3, 0]])
watertable = WaterTable(slopeCoords=slope.coords,
                        watertabDepths=watertabDepths,
                        smoothFactor=3)
preferredPath = CircularSurface(slopeCoords=slope.coords,
                                dist1=5,
                                dist2=15.78,
                                radius=20)
surface = TortuousSurface(bim,
                          dist1=4,
                          dist2=15.78,
                          heuristic='euclidean',
                          reverseLeft=False,
                          reverseUp=False,
                          smoothFactor=2,
                          preferredPath=preferredPath.coords,
                          prefPathFact=2)
material = MaterialParameters(cohesion=15,
                              frictAngle=23,
                              unitWeight=17,
                              blocksUnitWeight=21,
                              wtUnitWeight=9.8)
コード例 #5
0
from numpy import array
from pybimstab.slope import NaturalSlope
from pybimstab.slipsurface import CircularSurface
terrainCoords = array([[
    -2.49, 0.1, 1.7, 3.89, 5.9, 8.12, 9.87, 13.29, 20.29, 21.43, 22.28, 23.48,
    24.65, 25.17
],
                       [
                           18.16, 17.88, 17.28, 15.73, 14.31, 13.58, 13, 3.61,
                           3.61, 3.32, 2.71, 2.23, 1.21, 0.25
                       ]])
slope = NaturalSlope(terrainCoords)
surface = CircularSurface(slopeCoords=slope.coords,
                          dist1=7,
                          dist2=20,
                          radius=13)
fig = surface.plot()