def getCoordinatesHudsonPlot(mts): ''' Get Hudson plot coordinates for all events ''' us, vs = [], [] for mt in mts: mt = pmt.values_to_matrix(mt) eig_m = pmt.eigh_check(mt)[0] m3, m2, m1 = eig_m / num.max(num.abs(eig_m)) u = -2. / 3. * (m1 + m3 - 2.0 * m2) v = 1. / 3. * (m1 + m2 + m3) us.append(u) vs.append(v) return us, vs
def project(mt): '''Calculate Hudson's (u, v) coordinates for a given moment tensor. The moment tensor can be given as a :py:class:`pyrocko.moment_tensor.MomentTensor` object, or by anything that can be converted to a 3x3 NumPy matrix, or as the six independent moment tensor entries as ``(mnn, mee, mdd, mne, mnd, med)``. ''' mt = pmt.values_to_matrix(mt) eig_m = pmt.eigh_check(mt)[0] m3, m2, m1 = eig_m / num.max(num.abs(eig_m)) u = -2./3. * (m1 + m3 - 2.0*m2) v = 1./3. * (m1 + m2 + m3) return u, v