moment_tensor

This module provides various moment tensor related utility functions.

It can be used to convert between strike-dip-rake and moment tensor representations and provides different options to produce random moment tensors.

Moment tensors are represented by MomentTensor instances. The internal representation uses a north-east-down (NED) coordinate system, but it can convert from/to the conventions used by the Global CMT catalog (up-south-east, USE).

If not otherwise noted, scalar moment is interpreted as the Frobenius norm based scalar moment (see MomentTensor.scalar_moment(). The scalar moment according to the “standard decomposition” can be found in the output of MomentTensor.standard_decomposition().

random_axis(rstate=None)[source]

Get randomly oriented unit vector.

Parameters

rstatenumpy.random.RandomState object, can be used to create reproducible pseudo-random sequences

rotation_from_angle_and_axis(angle, axis)[source]

Build rotation matrix based on axis and angle.

Parameters
  • angle – rotation angle [degrees]

  • axis – orientation of rotation axis, either in spherical coordinates (theta, phi) [degrees], or as a unit vector (ux, uy, uz).

random_rotation(x=None)[source]

Get random rotation matrix.

A random rotation matrix, drawn from a uniform distrubution in the space of rotations is returned, after Avro 1992 - “Fast random rotation matrices”.

Parameters

x – three (uniform random) numbers in the range [0, 1[ used as input to the distribution tranformation. If None, random numbers are used. Can be used to create grids of random rotations with uniform density in rotation space.

random_strike_dip_rake(strikemin=0.0, strikemax=360.0, dipmin=0.0, dipmax=90.0, rakemin=- 180.0, rakemax=180.0)[source]

Get random strike, dip, rake triplet.

Note

Might not produce a homogeneous distribution of mechanisms. Better use MomentTensor.random_dc() which is based on random_rotation().

to6(m)[source]

Get non-redundant components from symmetric 3x3 matrix.

Returns

1D NumPy array with entries ordered like (a_xx, a_yy, a_zz, a_xy, a_xz, a_yz)

symmat6(a_xx, a_yy, a_zz, a_xy, a_xz, a_yz)[source]

Create symmetric 3x3 matrix from its 6 non-redundant values.

values_to_matrix(values)[source]

Convert anything to moment tensor represented as a NumPy array.

Transforms MomentTensor objects, tuples, lists and NumPy arrays with 3x3 or 3, 4, 6, or 7 elements into NumPy 3x3 array objects.

The values argument is interpreted depending on shape and type as follows:

  • (strike, dip, rake)

  • (strike, dip, rake, magnitude)

  • (mnn, mee, mdd, mne, mnd, med)

  • (mnn, mee, mdd, mne, mnd, med, magnitude)

  • ((mnn, mne, mnd), (mne, mee, med), (mnd, med, mdd))

  • MomentTensor

moment_to_magnitude(moment)[source]

Convert scalar moment to moment magnitude Mw.

Parameters

moment – scalar moment [Nm]

Returns

moment magnitude Mw

Moment magnitude is defined as

M_\mathrm{w} = {\frac{2}{3}}\log_{10}(M_0 \cdot 10^7) - 10.7

where M_0 is the scalar moment given in [Nm].

Note

Global CMT uses 10.7333333 instead of 10.7, based on [Kanamori 1977], 10.7 is from [Hanks and Kanamori 1979].

magnitude_to_moment(magnitude)[source]

Convert moment magnitude Mw to scalar moment.

Parameters

magnitude – moment magnitude

Returns

scalar moment [Nm]

See moment_to_magnitude().

euler_to_matrix(alpha, beta, gamma)[source]

Given euler angle triplet, create rotation matrix

Given coordinate system (x,y,z) and rotated system (xs,ys,zs) the line of nodes is the intersection between the x,y and the xs,ys planes.

Parameters
  • alpha – is the angle between the z-axis and the zs-axis [rad]

  • beta – is the angle between the x-axis and the line of nodes [rad]

  • gamma – is the angle between the line of nodes and the xs-axis [rad]

Usage for moment tensors:

m_unrot = numpy.array([[0,0,-1],[0,0,0],[-1,0,0]])
euler_to_matrix(dip,strike,-rake, rotmat)
m = num.dot(rotmat.T, num.dot(m_unrot, rotmat))
matrix_to_euler(rotmat)[source]

Get eulerian angle triplet from rotation matrix.

unique_euler(alpha, beta, gamma)[source]

Uniquify eulerian angle triplet.

Put eulerian angle triplet into ranges compatible with (dip, strike, -rake) conventions in seismology:

alpha (dip)   : [0, pi/2]
beta (strike) : [0, 2*pi)
gamma (-rake) : [-pi, pi)

If alpha1 is near to zero, beta is replaced by beta+gamma and gamma is set to zero, to prevent this additional ambiguity.

If alpha is near to pi/2, beta is put into the range [0,pi).

as_mt(mt)[source]

Convenience function to convert various objects to moment tensor object.

Like :py:meth:MomentTensor.from_values, but does not create a new MomentTensor object when mt already is one.

class MomentTensor(m=None, m_up_south_east=None, m_east_north_up=None, strike=0.0, dip=0.0, rake=0.0, scalar_moment=1.0, mnn=None, mee=None, mdd=None, mne=None, mnd=None, med=None, strike1=None, dip1=None, rake1=None, strike2=None, dip2=None, rake2=None, p_axis=None, t_axis=None, magnitude=None, moment=None)[source]

Moment tensor object

Parameters
  • m – NumPy array in north-east-down convention

  • m_up_south_east – NumPy array in up-south-east convention

  • m_east_north_up – NumPy array in east-north-up convention

  • strike,dip,rake – fault plane angles in [degrees]

  • p_axis,t_axis – initialize double-couple from p and t axes

  • scalar_moment – scalar moment in [Nm]

  • magnitude – moment magnitude Mw

Global CMT catalog moment tensors use the up-south-east (USE) coordinate system convention with r (up), \theta (south), and \phi (east).

\begin{align*}
    M_{rr} &= M_{dd}, & M_{  r\theta} &= M_{nd},\\
    M_{\theta\theta} &= M_{ nn}, & M_{r\phi} &= -M_{ed},\\
    M_{\phi\phi} &=  M_{ee}, & M_{\theta\phi} &= -M_{ne}
\end{align*}

mnn

float, default: 0.0

mee

float, default: 0.0

mdd

float, default: 0.0

mne

float, default: 0.0

mnd

float, default: -1.0

med

float, default: 0.0

strike1

float, optional

dip1

float, optional

rake1

float, optional

strike2

float, optional

dip2

float, optional

rake2

float, optional

moment

float, optional

magnitude

float, optional

classmethod random_dc(x=None, scalar_moment=1.0, magnitude=None)[source]

Create random oriented double-couple moment tensor

The rotations used are uniformly distributed in the space of rotations.

classmethod random_mt(x=None, scalar_moment=1.0, magnitude=None)[source]

Create random moment tensor

Moment tensors produced by this function appear uniformly distributed when shown in a Hudson’s diagram. The rotations used are unifomly distributed in the space of rotations.

classmethod from_values(values)[source]

Alternative constructor for moment tensor objects

This constructor takes a MomentTensor object, a tuple, list or NumPy array with 3x3 or 3, 4, 6, or 7 elements to build a Moment tensor object.

The values argument is interpreted depending on shape and type as follows:

  • (strike, dip, rake)

  • (strike, dip, rake, magnitude)

  • (mnn, mee, mdd, mne, mnd, med)

  • (mnn, mee, mdd, mne, mnd, med, magnitude)

  • ((mnn, mne, mnd), (mne, mee, med), (mnd, med, mdd))

  • MomentTensor object

both_strike_dip_rake()[source]

Get both possible (strike,dip,rake) triplets.

p_axis()[source]

Get direction of p axis.

t_axis()[source]

Get direction of t axis.

null_axis()[source]

Get diretion of the null axis.

eigenvals()[source]

Get the eigenvalues of the moment tensor in accending order.

Returns

(ep, en, et)

eigensystem()[source]

Get the eigenvalues and eigenvectors of the moment tensor.

Returns

(ep, en, et, vp, vn, vt)

both_slip_vectors()[source]

Get both possible slip directions.

m()[source]

Get plain moment tensor as 3x3 matrix.

m6()[source]

Get the moment tensor as a six-element array.

Returns

(mnn, mee, mdd, mne, mnd, med)

m_up_south_east()[source]

Get moment tensor in up-south-east convention as 3x3 matrix.

\begin{align*}
    M_{rr} &= M_{dd}, & M_{  r\theta} &= M_{nd},\\
    M_{\theta\theta} &= M_{ nn}, & M_{r\phi} &= -M_{ed},\\
    M_{\phi\phi} &=  M_{ee}, & M_{\theta\phi} &= -M_{ne}
\end{align*}

m_east_north_up()[source]

Get moment tensor in east-north-up convention as 3x3 matrix.

m6_up_south_east()[source]

Get moment tensor in up-south-east convention as a six-element array.

Returns

(muu, mss, mee, mus, mue, mse)

m6_east_north_up()[source]

Get moment tensor in east-north-up convention as a six-element array.

Returns

(mee, mnn, muu, men, meu, mnu)

m_plain_double_couple()[source]

Get plain double couple with same scalar moment as moment tensor.

moment_magnitude()[source]

Get moment magnitude of moment tensor.

scalar_moment()[source]

Get the scalar moment of the moment tensor (Frobenius norm based)

M_0 = \frac{1}{\sqrt{2}}\sqrt{\sum_{i,j} |M_{ij}|^2}

The scalar moment is calculated based on the Euclidean (Frobenius) norm (Silver and Jordan, 1982). The scalar moment returned by this function differs from the standard decomposition based definition of the scalar moment for non-double-couple moment tensors.

deviatoric()[source]

Get deviatoric part of moment tensor.

Returns a new moment tensor object with zero trace.

standard_decomposition()[source]

Decompose moment tensor into isotropic, DC and CLVD components.

Standard decomposition according to e.g. Jost and Herrmann 1989 is returned as:

[
    (moment_iso, ratio_iso, m_iso),
    (moment_dc, ratio_dc, m_dc),
    (moment_clvd, ratio_clvd, m_clvd),
    (moment_devi, ratio_devi, m_devi),
    (moment, 1.0, m)
]
rotated(rot)[source]

Get rotated moment tensor.

Parameters

rot – ratation matrix, coordinate system is NED

Returns

new MomentTensor object

random_rotated(angle_std=None, angle=None, rstate=None)[source]

Get distorted MT by rotation around random axis and angle.

Parameters
  • angle_std – angles are drawn from a normal distribution with zero mean and given standard deviation [degrees]

  • angle – set angle [degrees], only axis will be random

  • rstatenumpy.random.RandomState object, can be used to create reproducible pseudo-random sequences

Returns

new MomentTensor object

other_plane(strike, dip, rake)[source]

Get the respectively other plane in the double-couple ambiguity.

order_like(sdrs, sdrs_ref)[source]

Order strike-dip-rake pair post closely to a given reference pair.

Parameters
  • sdrs – tuple, ((strike1, dip1, rake1), (strike2, dip2, rake2))

  • sdrs_ref – as above but with reference pair

kagan_angle(mt1, mt2)[source]

Given two moment tensors, return the Kagan angle in degrees.

After Kagan (1991) and Tape & Tape (2012).

rand_to_gutenberg_richter(rand, b_value, magnitude_min)[source]

Draw magnitude from Gutenberg Richter distribution.

magnitude_to_duration_gcmt(magnitudes)[source]

Scaling relation used by Global CMT catalog for most of its events.