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

beachball: try to fix some plotting issues, apparently caused by missing normalization and large numbers #2400

Merged
merged 1 commit into from
Oct 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion obspy/imaging/beachball.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def beach(fm, linewidth=2, facecolor='b', bgcolor='w', edgecolor='k',
# Return as collection
plot_dc_used = True
if mt:
(t, n, p) = mt2axes(mt)
(t, n, p) = mt2axes(mt.normalized)
if np.fabs(n.val) < EPSILON and np.fabs(t.val + p.val) < EPSILON:
colors, p = plot_dc(np1, size, xy=xy, width=width)
else:
Expand Down Expand Up @@ -1016,6 +1016,14 @@ def __init__(self, *args):
else:
raise TypeError("Wrong size of input parameter.")

@property
def normalized(self):
return MomentTensor(self.mt_normalized, self.expo)

@property
def mt_normalized(self):
return self.mt / np.linalg.norm(self.mt)

@property
def xx(self):
return self.mt[0][0]
Expand Down