def eigendecompose(self, normalise=False): """ Performs and eigendecomposition of the tensor and orders into descending eigenvalues """ self.eigenvalues, self.eigenvectors = utils.eigendecompose(self.tensor, normalise) return self.eigenvalues, self.eigenvectors
def eigendecompose(self, normalise=False): """ Performs and eigendecomposition of the tensor and orders into descending eigenvalues """ self.eigenvalues, self.eigenvectors = utils.eigendecompose( self.tensor, normalise) return self.eigenvalues, self.eigenvectors
def get_nodal_planes(self): """ Returns the nodal planes by eigendecomposition of the moment tensor """ # Convert reference frame to NED self.tensor, self.tensor_sigma = self._to_ned() self.ref_frame = 'NED' # Eigenvalue decomposition # Tensor _, evect = utils.eigendecompose(self.tensor) # Rotation matrix _, rot_vec = utils.eigendecompose( np.array([[0., 0., -1], [0., 0., 0.], [-1., 0., 0.]])) rotation_matrix = (evect @ rot_vec.T).T if np.linalg.det(rotation_matrix) < 0.: rotation_matrix @= -1. flip_dc = np.array([[0., 0., -1.], [0., -1., 0.], [-1., 0., 0.]]) rotation_matrices = sorted( [rotation_matrix, flip_dc @ rotation_matrix], cmp=cmp_mat) nodal_planes = GCMTNodalPlanes() dip, strike, rake = [ (180. / pi) * angle for angle in utils.matrix_to_euler(rotation_matrices[0]) ] # 1st Nodal Plane nodal_planes.nodal_plane_1 = { 'strike': strike % 360, 'dip': dip, 'rake': -rake } # 2nd Nodal Plane dip, strike, rake = [ (180. / pi) * angle for angle in utils.matrix_to_euler(rotation_matrices[1]) ] nodal_planes.nodal_plane_2 = { 'strike': strike % 360., 'dip': dip, 'rake': -rake } return nodal_planes
def get_nodal_planes(self): """ Returns the nodal planes by eigendecomposition of the moment tensor """ # Convert reference frame to NED self.tensor, self.tensor_sigma = self._to_ned() self.ref_frame = 'NED' # Eigenvalue decomposition # Tensor _, evect = utils.eigendecompose(self.tensor) # Rotation matrix _, rot_vec = utils.eigendecompose(np.array([[0., 0., -1], [0., 0., 0.], [-1., 0., 0.]])) rotation_matrix = (evect @ rot_vec.T).T if np.linalg.det(rotation_matrix) < 0.: rotation_matrix @= -1. flip_dc = np.array([[0., 0., -1.], [0., -1., 0.], [-1., 0., 0.]]) rotation_matrices = sorted( [rotation_matrix, flip_dc @ rotation_matrix], cmp=cmp_mat) nodal_planes = GCMTNodalPlanes() dip, strike, rake = [(180. / pi) * angle for angle in utils.matrix_to_euler( rotation_matrices[0])] # 1st Nodal Plane nodal_planes.nodal_plane_1 = {'strike': strike % 360, 'dip': dip, 'rake': -rake} # 2nd Nodal Plane dip, strike, rake = [(180. / pi) * angle for angle in utils.matrix_to_euler( rotation_matrices[1])] nodal_planes.nodal_plane_2 = {'strike': strike % 360., 'dip': dip, 'rake': -rake} return nodal_planes