9. convert¶
MTfit
contains a submodule MTfit.convert
that can handle moment tensor conversions. Mostly it is used with the --convert
flag for converting the moment tensor results to the different source parameterisations. However it can be used separately, and the functions are described here.
9.1. moment_tensor_conversion.py¶
Module containing moment tensor conversion functions. Acts on the parameters of the moment tensor 3x3 form or the modified 6-vector form, dependent on the name
The function naming is OriginalVariables_NewVariables
The coordinate system is North (X), East (Y), Down (Z)
-
MTfit.convert.moment_tensor_conversion.
E_GD
(E)[source]¶ Convert the eigenvalues to the Tape parameterisation gamma and delta.
- Args
- E: array of eigenvalues
- Returns
- (numpy.array, numpy.array): tuple of gamma, delta
-
MTfit.convert.moment_tensor_conversion.
E_tk
(E)[source]¶ Convert the moment tensor eigenvalues to the Hudson tau, k parameters
- Args
- E: indexable list/array (e.g numpy.array) of moment tensor eigenvalues
- Returns
- (float, float): tau, k tuple
-
MTfit.convert.moment_tensor_conversion.
E_uv
(E)[source]¶ Convert the eigenvalues to the Hudson i, v parameters
- Args
- E: indexable list/array (e.g numpy.array) of moment tensor eigenvalues
- Returns
- (float, float): u, v tuple
-
MTfit.convert.moment_tensor_conversion.
FP_SDR
(normal, slip)[source]¶ Convert fault normal and slip to strike, dip and rake
Coordinate system is North East Down.
- Args
- normal: numpy matrix - Normal vector slip: numpy matrix - Slip vector
- Returns
- (float, float, float): tuple of strike, dip and rake angles in radians
-
MTfit.convert.moment_tensor_conversion.
FP_SDSD
(N1, N2)[source]¶ Convert the the fault normal and slip vectors to the strike and dip pairs (all angles in radians).
- Args
- Normal: numpy matrix - Normal vector Slip: numpy matrix - Slip vector
- Returns
- (float, float, float, float): tuple of strike1, dip1, strike2, dip2 angles
- in radians
-
MTfit.convert.moment_tensor_conversion.
FP_TNP
(normal, slip)[source]¶ Convert fault normal and slip to TNP axes
Coordinate system is North East Down.
- Args
- normal: numpy matrix - normal vector slip: numpy matrix - slip vector
- Returns
- (numpy.matrix, numpy.matrix, numpy.matrix): tuple of T, N, P vectors
-
MTfit.convert.moment_tensor_conversion.
GD_E
(gamma, delta)[source]¶ Convert the Tape parameterisation gamma and delta to the eigenvalues.
- Args
- gamma: numpy array of gamma values delta: numpy array of delta values
- Returns
- numpy.array: array of eigenvalues
-
MTfit.convert.moment_tensor_conversion.
GD_basic_cdc
(gamma, delta)[source]¶ Convert gamma, delta to basic crack+double-couple parameters
Gamma and delta are the source type parameters from the Tape parameterisation.
- Args
- gamma: numpy array of gamma values delta: numpy array of delta values
Returns: tuple of alpha, poisson Return type: (numpy.array, numpy.array)
-
MTfit.convert.moment_tensor_conversion.
MT33_GD
(MT33)[source]¶ Convert the 3x3 Moment Tensor to theTape parameterisation gamma and delta.
- Args
- MT33: 3x3 numpy matrix
- Returns
- (numpy.array, numpy.array): tuple of gamma, delta
-
MTfit.convert.moment_tensor_conversion.
MT33_MT6
(MT33)[source]¶ Convert a 3x3 matrix to six vector maintaining normalisation. 6-vector has the form:
Mxx Myy Mzz sqrt(2)*Mxy sqrt(2)*Mxz sqrt(2)*Myz
- Args
- M33: 3x3 numpy matrix
- Returns
- numpy.matrix: MT 6-vector
-
MTfit.convert.moment_tensor_conversion.
MT33_SDR
(MT33)[source]¶ Convert the 3x3 Moment Tensor to the strike, dip and rake.
- Args
- MT33: 3x3 numpy matrix
- Returns
- (float, float, float): tuple of strike, dip, rake angles in radians
-
MTfit.convert.moment_tensor_conversion.
MT33_TNPE
(MT33)[source]¶ Convert the 3x3 Moment Tensor to the T,N,P vectors and the eigenvalues.
- Args
- MT33: 3x3 numpy matrix
- Returns
- (numpy.matrix, numpy.matrix, numpy.matrix, numpy.array): tuple of T, N, P
- vectors and Eigenvalue array
-
MTfit.convert.moment_tensor_conversion.
MT6_MT33
(MT6)[source]¶ Convert a six vector to a 3x3 MT maintaining normalisation. 6-vector has the form:
Mxx Myy Mzz sqrt(2)*Mxy sqrt(2)*Mxz sqrt(2)*Myz
- Args
- MT6: numpy matrix Moment tensor 6-vector
- Returns
- numpy.matrix: 3x3 Moment Tensor
-
MTfit.convert.moment_tensor_conversion.
MT6_TNPE
(MT6)[source]¶ Convert the 6xn Moment Tensor to the T,N,P vectors and the eigenvalues.
- Args
- MT6: 6xn numpy matrix
- Returns
- (numpy.matrix, numpy.matrix, numpy.matrix, numpy.array): tuple of T, N, P
- vectors and Eigenvalue array
-
MTfit.convert.moment_tensor_conversion.
MT6_Tape
(MT6)[source]¶ Convert the moment tensor 6-vector to the Tape parameters.
6-vector has the form:
Mxx Myy Mzz sqrt(2)*Mxy sqrt(2)*Mxz sqrt(2)*Myz
- Args
- MT6: numpy matrix six-vector
- Returns
- (numpy.array, numpy.array, numpy.array, numpy.array, numpy.array): tuple of
- gamma, delta, strike, cos(dip) and slip (angles in radians)
-
MTfit.convert.moment_tensor_conversion.
MT6_biaxes
(MT6, c=[3.0, 1.0, 1.0, 0, 0, 0, 3.0, 1.0, 0, 0, 0, 3.0, 0, 0, 0, 1.0, 0, 0, 1.0, 0, 1.0])[source]¶ Convert six vector to bi-axes
Convert the moment tensor 6-vector to the bi-axes decomposition from Chapman, C and Leaney,S, 2011. A new moment-tensor decomposition for seismic events in anisotropic media, GJI, 188(1), 343-370. The 6-vector has the form:
Mxx Myy Mzz sqrt(2)*Mxy sqrt(2)*Mxz sqrt(2)*Myz
The stiffness tensor can be provided as an input, as a list of the 21 elements of the upper triangular part of the Voigt stiffness matrix:
C(21) = ( C_11, C_12, C_13, C_14, C_15, C_16, C_22, C_23, C_24, C_25, C_26, C_33, C_34, C_35, C_36, C_44, C_45, C_46, C_55, C_56, C_66 ) (upper triangular part of Voigt stiffness matrix)
Alternatively, the default isotropic parameters can be used or a possible isotropic stiffness tensor can be genereated using (isotropic_c)
- Args
- MT6: numpy matrix Moment tensor 6-vector c: list or numpy array of the 21 element input stiffness tensor
- Returns
- (numpy.array, numpy.array, numpy.array): tuple of phi (bi-axes) vectors,
- explosion value and area_displacement value.
-
MTfit.convert.moment_tensor_conversion.
MT6c_D6
(MT6, c=[3.0, 1.0, 1.0, 0, 0, 0, 3.0, 1.0, 0, 0, 0, 3.0, 0, 0, 0, 1.0, 0, 0, 1.0, 0, 1.0])[source]¶ Convert the moment tensor 6-vector to the potency tensor. The 6-vector has the form:
Mxx Myy Mzz sqrt(2)*Mxy sqrt(2)*Mxz sqrt(2)*Myz
The stiffness tensor can be provided as an input, as a list of the 21 elements of the upper triangular part of the Voigt stiffness matrix:
C(21) = ( C_11, C_12, C_13, C_14, C_15, C_16, C_22, C_23, C_24, C_25, C_26, C_33, C_34, C_35, C_36, C_44, C_45, C_46, C_55, C_56, C_66 ) (upper triangular part of Voigt stiffness matrix)
Alternatively, the default isotropic parameters can be used or a possible isotropic stiffness tensor can be genereated using (isotropic_c).
- Args
- MT6: numpy matrix Moment tensor 6-vector c: list or numpy array of the 21 element input stiffness tensor
- Returns
- numpy.array: numpy array of the potency 6 vector (in the same ordering as the
- moment tensor six vector)
-
MTfit.convert.moment_tensor_conversion.
SDR_FP
(strike, dip, rake)[source]¶ Convert the strike, dip and rake in radians to the fault normal and slip.
- Args
- strike: float strike angle of fault plane in radians dip: float dip angle of fault plane in radians rake: float rake angle of fault plane in radians
- Returns
- (numpy.matrix, numpy.matrix): tuple of Normal and slip vectors
-
MTfit.convert.moment_tensor_conversion.
SDR_SDR
(strike, dip, rake)[source]¶ Convert strike, dip rake to strike, dip rake for other fault plane
Coordinate system is North East Down.
- Args
- strike: float radians dip: float radians rake: float radians
- Returns
- (float, float, float): tuple of strike, dip and rake angles of alternate fault
- plane in radians
-
MTfit.convert.moment_tensor_conversion.
SDR_SDSD
(strike, dip, rake)[source]¶ Convert the strike, dip and rake to the strike and dip pairs (all angles in radians).
- Args
- strike: float strike angle of fault plane in radians dip: float dip angle of fault plane in radians rake: float rake angle of fault plane in radians
- Returns
- (float, float, float, float): tuple of strike1, dip1, strike2, dip2 angles in radians
-
MTfit.convert.moment_tensor_conversion.
SDR_TNP
(strike, dip, rake)[source]¶ Convert strike, dip rake to TNP vectors
Coordinate system is North East Down.
- Args
- strike: float radians dip: float radians rake: float radians
- Returns
- (numpy.matrix, numpy.matrix, numpy.matrix): tuple of T,N,P vectors.
-
MTfit.convert.moment_tensor_conversion.
SDSD_FP
(strike1, dip1, strike2, dip2)[source]¶ Convert strike and dip pairs to fault normal and slip
Converts the strike and dip pairs in radians to the fault normal and slip.
- Args
- strike1: float strike angle of fault plane 1 in radians dip1: float dip angle of fault plane 1 in radians strike2: float strike angle of fault plane 2 in radians dip2: float dip of fault plane 2 in radians
- Returns
- (numpy.matrix, numpy.matrix): tuple of Normal and slip vectors
-
MTfit.convert.moment_tensor_conversion.
TNP_SDR
(T, N, P)[source]¶ Convert the T,N,P vectors to the strike, dip and rake in radians
- Args
- T: numpy matrix of T vectors. N: numpy matrix of N vectors. P: numpy matrix of P vectors.
- Returns
- (float, float, float): tuple of strike, dip and rake angles of fault plane in radians
-
MTfit.convert.moment_tensor_conversion.
TP_FP
(T, P)[source]¶ Convert the 3x3 Moment Tensor to the fault normal and slip vectors.
- Args
- T: numpy matrix of T vectors. P: numpy matrix of P vectors.
- Returns
- (numpy.matrix, numpy.matrix): tuple of Normal and slip vectors
-
MTfit.convert.moment_tensor_conversion.
Tape_MT33
(gamma, delta, kappa, h, sigma, **kwargs)[source]¶ Convert Tape parameters to a 3x3 moment tensor
- Args
- gamma: float, gamma parameter (longitude on funamental lune takes values
- between -pi/6 and pi/6).
- delta: float, delta parameter (latitude on funamental lune takes values
- between -pi/2 and pi/2)
kappa: float, strike (takes values between 0 and 2*pi) h: float, cos(dip) (takes values between 0 and 1) sigma: float, slip angle (takes values between -pi/2 and pi/2)
- Returns
- numpy.matrix: 3x3 moment tensor
-
MTfit.convert.moment_tensor_conversion.
Tape_MT6
(gamma, delta, kappa, h, sigma)[source]¶ Convert the Tape parameterisation to the moment tensor six-vectors.
- Args
- gamma: Gamma parameter (longitude on funamental lune takes values
- between -pi/6 and pi/6).
- delta: Delta parameter (latitude on funamental lune takes values
- between -pi/2 and pi/2)
kappa: Strike (takes values between 0 and 2*pi) h: Cos(dip) (takes values between 0 and 1) sigma: Slip angle (takes values between -pi/2 and pi/2)
- Returns
- np.array: Array of MT 6-vectors
-
MTfit.convert.moment_tensor_conversion.
Tape_TNPE
(gamma, delta, kappa, h, sigma)[source]¶ Convert the Tape parameterisation to the T,N,P vectors and the eigenvalues.
- Args
- gamma: Gamma parameter (longitude on funamental lune takes values
- between -pi/6 and pi/6).
- delta: Delta parameter (latitude on funamental lune takes values
- between -pi/2 and pi/2)
kappa: Strike (takes values between 0 and 2*pi) h: Cos(dip) (takes values between 0 and 1) sigma: Slip angle (takes values between -pi/2 and pi/2)
- Returns
- (numpy.matrix, numpy.matrix, numpy.matrix, numpy.array): T,N,P vectors
- and Eigenvalues tuple
-
MTfit.convert.moment_tensor_conversion.
basic_cdc_GD
(alpha, poisson=0.25)[source]¶ Convert alpha and poisson ratio to gamma and delta
alpha is opening angle, poisson : ratio lambda/(2(lambda+mu)) Defaults to 0.25. Uses basic crack+double-couple model of Minson et al (Seismically and geodetically determined nondouble-couple source mechanisms from the 2000 Miyakejima volcanic earthquake swarm, Minson et al, 2007, JGR 112) and Tape and Tape (The classical model for moment tensors, Tape and Tape, 2013, GJI)
- Args
- alpha: Opening angle in radians (between 0 and pi/2) poisson:[0.25] Poisson ratio on the fault surface.
Returns: tuple of gamma, delta Return type: (numpy.array, numpy.array)
-
MTfit.convert.moment_tensor_conversion.
c21_cvoigt
(c)[source]¶ Convert an input stiffness tensor to voigt form
The stiffness tensor needs to be provided as a list of the 21 elements of the upper triangular part of the Voigt stiffness matrix:
C(21) = ( C_11, C_12, C_13, C_14, C_15, C_16, C_22, C_23, C_24, C_25, C_26, C_33, C_34, C_35, C_36, C_44, C_45, C_46, C_55, C_56, C_66 ) (upper triangular part of Voigt stiffness matrix)
- Args
- c: input list of stiffness parameters (21 required)
- Returns
- numpy.array: voigt form of the stiffness tensor
-
MTfit.convert.moment_tensor_conversion.
c_norm
(c)[source]¶ Calculate norm of the stiffness tensor.
The stiffness tensor needs to be provided as a list of the 21 elements of the upper triangular part of the Voigt stiffness matrix:
C(21) = ( C_11, C_12, C_13, C_14, C_15, C_16, C_22, C_23, C_24, C_25, C_26, C_33, C_34, C_35, C_36, C_44, C_45, C_46, C_55, C_56, C_66 ) (upper triangular part of Voigt stiffness matrix)
- Args
- c: input list of stiffness parameters (21 required)
- Returns
- float: Euclidean norm of the tensor
-
MTfit.convert.moment_tensor_conversion.
is_isotropic_c
(c)[source]¶ Evaluate if an input stiffness tensor is isotropic
The stiffness tensor needs to be provided as a list of the 21 elements of the upper triangular part of the Voigt stiffness matrix:
C(21) = ( C_11, C_12, C_13, C_14, C_15, C_16, C_22, C_23, C_24, C_25, C_26, C_33, C_34, C_35, C_36, C_44, C_45, C_46, C_55, C_56, C_66 ) (upper triangular part of Voigt stiffness matrix)
- Args
- c: input list of stiffness parameters (21 required)
- Returns
- bool: result of is_isotropic check
-
MTfit.convert.moment_tensor_conversion.
isotropic_c
(lambda_=1, mu=1, c=False)[source]¶ Calculate the isotropic stiffness tensor
Calculate isotropic stiffness parameters. The input parameters are either the two lame parameters lambda and mu, or is a full 21 element stiffness tensor:
C(21) = ( C_11, C_12, C_13, C_14, C_15, C_16, C_22, C_23, C_24, C_25, C_26, C_33, C_34, C_35, C_36, C_44, C_45, C_46, C_55, C_56, C_66 ) (upper triangular part of Voigt stiffness matrix)
If the full stiffness tensor is used, the "average" isotropic approximation is calculated using Eqns 81a and 81b from Chapman, C and Leaney,S, 2011. A new moment-tensor decomposition for seismic events in anisotropic media, GJI, 188(1), 343-370.
- Args
lambda_: lambda value mu: mu value c: list or numpy array of the 21 element input stiffness tensor (overrides
lambda and mu arguments)- Returns
- list: list of 21 elements of the stiffness tensor
-
MTfit.convert.moment_tensor_conversion.
normal_SD
(normal)[source]¶ Convert a plane normal to strike and dip
Coordinate system is North East Down.
- Args
- normal: numpy matrix - Normal vector
- Returns
- (float, float): tuple of strike and dip angles in radians
-
MTfit.convert.moment_tensor_conversion.
output_convert
(mts)[source]¶ Convert the moment tensors into several different parameterisations
The moment tensor six-vectors are converted into the Tape gamma,delta,kappa,h,sigma parameterisation; the Hudson u,v parameterisation; and the strike, dip and rakes of the two fault planes are calculated.
- Args
- mts: numpy array of moment tensor six-vectors
- Returns
- dict: dictionary of numpy arrays for each parameter
-
MTfit.convert.moment_tensor_conversion.
tk_uv
(tau, k)[source]¶ Convert the Hudson tau, k parameters to the Hudson u, v parameters
- Args
- tau: float, Hudson tau parameter k: float, Hudson k parameter
- Returns
- (float, float): u, v tuple
-
MTfit.convert.moment_tensor_conversion.
toa_vec
(azimuth, plunge, radians=False)[source]¶ Convert the azimuth and plunge of a vector to a cartesian description of the vector
- Args
- azimuth: float, vector azimuth plunge: float, vector plunge
- Keyword Arguments
- radians: boolean, flag to use radians [default = False]
- Returns
- np.matrix: vector