Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug report - plot vs decompose #8

Open
sjaye013 opened this issue May 19, 2017 · 2 comments
Open

bug report - plot vs decompose #8

sjaye013 opened this issue May 19, 2017 · 2 comments

Comments

@sjaye013
Copy link

Plotting the DC component of the moment tensor via plot function outputs a different beach ball, compared to running the decompose function and plotting the DC matrix. (The former results to an all-red explosion beach ball, while the latter plots the correct DC beach ball.)

Figures attached. Script below:

% mopad plot 713668000000000,12428000000000,-726096000000000,-654200000000000,332200000000000,8175000000000 -P dc -f sampledc.png

% mopad decompose 713668000000000,12428000000000,-726096000000000,-654200000000000,332200000000000,8175000000000 -p dc

Double Couple part in NED-coordinates:

/ 0.78 -0.59 0.49
| -0.59 0.22 0.18 | x 435092335422952.562500
\ 0.49 0.18 -1.00 /

% mopad plot 0.78,0.22,-1,-0.59,0.49,0.18 -f sampledc2.png

sampledc
sampledc2

@megies
Copy link

megies commented May 22, 2017

Not sure if you'll get answers here, mopad is essentially not maintained by the original authors, as far as I know.

If you come across the same problems when using obspy (which has mopad plugged in for beachball plotting) you could let us know at obspy/obspy.

@emolch
Copy link
Collaborator

emolch commented May 29, 2017

A new and much shorter code (hopefully also with fewer errors :-) to plot beachballs is available in pyrocko.beachball (examples). It can plot full, deviatoric and dc beachballs.

from matplotlib import pyplot as plt
from pyrocko import beachball, moment_tensor as pmt, 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()

mt = pmt.as_mt((713668000000000, 12428000000000, -726096000000000,
                -654200000000000, 332200000000000, 8175000000000))

for i, beachball_type in enumerate(['full', 'deviatoric', 'dc']):
    beachball.plot_beachball_mpl(
        mt,
        axes,
        beachball_type=beachball_type,
        size=60.,
        position=(i+1, 1),
        color_t=plot.mpl_color('scarletred2'),
        linewidth=1.0)

fig.savefig('beachball-example03.png')
plt.show()

print mt.standard_decomposition()

beachball-example03

See also: MomentTensor.standard_decomposition()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants