def MT2Plane(mt):
    """
    Calculates a nodal plane of a given moment tensor.

    :param mt: :class:`~MomentTensor`
    :return: :class:`~NodalPlane`

    Adapted from MATLAB script
    `bb.m <http://www.ceri.memphis.edu/people/olboyd/Software/Software.html>`_
    written by Andy Michael and Oliver Boyd.
    """
    (d, v) = np.linalg.eig(mt.mt)
    D = np.array([d[1], d[0], d[2]])
    V = np.array([[v[1, 1], -v[1, 0], -v[1, 2]],
                  [v[2, 1], -v[2, 0], -v[2, 2]],
                  [-v[0, 1], v[0, 0], v[0, 2]]])
    IMAX = D.argmax()
    IMIN = D.argmin()
    AE = (V[:, IMAX] + V[:, IMIN]) / np.sqrt(2.0)
    AN = (V[:, IMAX] - V[:, IMIN]) / np.sqrt(2.0)
    AER = np.sqrt(np.power(AE[0], 2) + np.power(AE[1], 2) + np.power(AE[2], 2))
    ANR = np.sqrt(np.power(AN[0], 2) + np.power(AN[1], 2) + np.power(AN[2], 2))
    AE = AE / AER
    if not ANR:
        AN = np.array([np.nan, np.nan, np.nan])
    else:
        AN = AN / ANR
    if AN[2] <= 0.:
        AN1 = AN
        AE1 = AE
    else:
        AN1 = -AN
        AE1 = -AE
    (ft, fd, fl) = TDL(AN1, AE1)
    return NodalPlane(360 - ft, fd, 180 - fl)
def MT2Plane ( mt ) : ( d , v ) = np . linalg . eig ( mt . mt ) D = np . array ( [ d [ 1 ] , d [ 0 ] , d [ 2 ] ] ) V = np . array ( [ [ v [ 1 , 1 ] , - v [ 1 , 0 ] , - v [ 1 , 2 ] ] , [ v [ 2 , 1 ] , - v [ 2 , 0 ] , - v [ 2 , 2 ] ] , [ - v [ 0 , 1 ] , v [ 0 , 0 ] , v [ 0 , 2 ] ] ] ) IMAX = D . argmax ( ) IMIN = D . argmin ( ) AE = ( V [ : , IMAX ] + V [ : , IMIN ] ) / np . sqrt ( 2.0 ) AN = ( V [ : , IMAX ] - V [ : , IMIN ] ) / np . sqrt ( 2.0 ) AER = np . sqrt ( np . power ( AE [ 0 ] , 2 ) + np . power ( AE [ 1 ] , 2 ) + np . power ( AE [ 2 ] , 2 ) ) ANR = np . sqrt ( np . power ( AN [ 0 ] , 2 ) + np . power ( AN [ 1 ] , 2 ) + np . power ( AN [ 2 ] , 2 ) ) AE = AE / AER if not ANR : AN = np . array ( [ np . nan , np . nan , np . nan ] ) else : AN = AN / ANR if AN [ 2 ] <= 0. : AN1 = AN AE1 = AE else : AN1 = - AN AE1 = - AE ( ft , fd , fl ) = TDL ( AN1 , AE1 ) return NodalPlane ( 360 - ft , fd , 180 - fl )
Calculates a nodal plane of a given moment tensor.

    :param mt: :class:`~MomentTensor`
    :return: :class:`~NodalPlane`

    Adapted from MATLAB script
    `bb.m <http://www.ceri.memphis.edu/people/olboyd/Software/Software.html>`_
    written by Andy Michael and Oliver Boyd.