コード例 #1
0
def deco_part(mt, mt_type='full', view='top'):
    assert view in ('top', 'north', 'south', 'east', 'west'),\
        'Allowed views are top, north, south, east and west'
    mt = mtm.as_mt(mt)

    if view == 'top':
        pass
    elif view == 'north':
        mt = mt.rotated(_view_north)
    elif view == 'south':
        mt = mt.rotated(_view_south)
    elif view == 'east':
        mt = mt.rotated(_view_east)
    elif view == 'west':
        mt = mt.rotated(_view_west)

    if mt_type == 'full':
        return mt

    res = mt.standard_decomposition()
    m = dict(
        dc=res[1][2],
        deviatoric=res[3][2])[mt_type]

    return mtm.MomentTensor(m=m)
コード例 #2
0
ファイル: beachball.py プロジェクト: shineusn/pyrocko
def deco_part(mt, mt_type='full'):
    mt = mtm.as_mt(mt)
    if mt_type == 'full':
        return mt

    res = mt.standard_decomposition()
    m = dict(dc=res[1][2], deviatoric=res[3][2])[mt_type]

    return mtm.MomentTensor(m=m)
コード例 #3
0
def deco_part(mt, mt_type='full'):
    mt = mtm.as_mt(mt)
    if mt_type == 'full':
        return mt

    res = mt.standard_decomposition()
    m = dict(
        dc=res[1][2],
        deviatoric=res[3][2])[mt_type]

    return mtm.MomentTensor(m=m)
コード例 #4
0
from matplotlib import pyplot as plt
from pyrocko import moment_tensor as pmt
from pyrocko import plot

fig = plt.figure(figsize=(4., 2.))
fig.subplots_adjust(left=0., right=1., bottom=0., top=1.)
axes = fig.add_subplot(1, 1, 1)
axes.set_xlim(0., 4.)
axes.set_ylim(0., 2.)
axes.set_axis_off()

for i, beachball_type in enumerate(['full', 'deviatoric', 'dc']):
    plot.beachball.plot_beachball_mpl(pmt.as_mt(
        (124654616., 370943136., -6965434.0, 553316224., -307467264.,
         84703760.0)),
                                      axes,
                                      beachball_type=beachball_type,
                                      size=60.,
                                      position=(i + 1, 1),
                                      color_t=plot.mpl_color('scarletred2'),
                                      linewidth=1.0)

fig.savefig('beachball-example03.pdf')
plt.show()
コード例 #5
0
from matplotlib import pyplot as plt
from pyrocko import moment_tensor as pmt
from pyrocko import plot


fig = plt.figure(figsize=(4., 2.))
fig.subplots_adjust(left=0., right=1., bottom=0., top=1.)
axes = fig.add_subplot(1, 1, 1)
axes.set_xlim(0., 4.)
axes.set_ylim(0., 2.)
axes.set_axis_off()

for i, beachball_type in enumerate(['full', 'deviatoric', 'dc']):
    plot.beachball.plot_beachball_mpl(
            pmt.as_mt((124654616., 370943136., -6965434.0,
                       553316224., -307467264., 84703760.0)),
            axes,
            beachball_type=beachball_type,
            size=60.,
            position=(i+1, 1),
            color_t=plot.mpl_color('scarletred2'),
            linewidth=1.0)

fig.savefig('beachball-example03.pdf')
plt.show()
コード例 #6
0
#!/usr/bin/env python3

from matplotlib import pyplot as plt
from pyrocko import moment_tensor as pmt
from pyrocko.plot import beachball

mt = pmt.as_mt([0.424, -0.47, 0.33, 0.711, -0.09, 0.16])
axes = plt.gca()

beachball.plot_beachball_mpl(mt, axes, size=50., position=(0., 0.), view='top')

beachball.plot_beachball_mpl(mt,
                             axes,
                             size=50.,
                             position=(0, -1.),
                             view='south')

beachball.plot_beachball_mpl(mt,
                             axes,
                             size=50.,
                             position=(-1, 0.),
                             view='east')

beachball.plot_beachball_mpl(mt,
                             axes,
                             size=50.,
                             position=(0, 1.),
                             view='north')

beachball.plot_beachball_mpl(mt, axes, size=50., position=(1, 0.), view='west')
コード例 #7
0
ファイル: beachball.py プロジェクト: wsja/pyrocko
    args = sys.argv[1:]

    data = []
    for iarg, arg in enumerate(args):

        if os.path.exists(arg):
            events = model.load_events(arg)
            for ev in events:
                if not ev.moment_tensor:
                    logger.warn('no moment tensor given for event')
                    continue

                data.append((ev.name, ev.moment_tensor))
        else:
            vals = list(map(float, arg.split(',')))
            mt = mtm.as_mt(vals)
            data.append(('%i' % (iarg+1), mt))

    n = len(data)

    ncols = 1
    while ncols**2 < n:
        ncols += 1

    nrows = ncols

    fig = plt.figure()
    axes = fig.add_subplot(1, 1, 1, aspect=1.)
    axes.axison = False
    axes.set_xlim(-0.05 - ncols, ncols + 0.05)
    axes.set_ylim(-0.05 - nrows, nrows + 0.05)
コード例 #8
0
ファイル: beachballs.py プロジェクト: shineusn/pyrocko
from matplotlib import pyplot as plt
from pyrocko import beachball, moment_tensor as pmt

fig = plt.figure(figsize=(10., 10.))
fig.subplots_adjust(left=0., right=1., bottom=0., top=1.)
axes = fig.add_subplot(1, 1, 1)
axes.set_xlim(0., 4.)
axes.set_ylim(0., 3.)
axes.set_axis_off()

for (strike, dip, rake), position, color in [
        ((0., 30., 120.), (1, 1.), 'red'),
        ((0., 30., 150.), (2., 1.), 'black'),
        ((0., 30., 180.), (3., 1), (0.5, 0.3, 0.7)),
        ((0., 30., -180.), (1., 2.), (0.1, 0.6, 0.1)),
        ((0., 30., -150.), (2., 2.), (0.2, 0.7, 1.0)),
        ((0., 30., -120.), (3., 2.), (0.2, 0.3, 0.1))]:

    beachball.plot_beachball_mpl(
        pmt.as_mt((strike, dip, rake)),
        axes,
        beachball_type='full',
        size=100.,
        position=position,
        color_t=color,
        linewidth=1.0)

fig.savefig('beachballs.pdf')

plt.show()