Esempio n. 1
0
def euler_mat(euler_angles, kind="zyz"):
    """Defines the rotation matrix M for a ABC euler rotation,
	such that M = A(alpha)B(beta)C(gamma), where euler_angles =
	[alpha,beta,gamma]. The default kind is ABC=ZYZ."""
    alpha, beta, gamma = euler_angles
    R1 = utils.rotmatrix(gamma, kind[2])
    R2 = utils.rotmatrix(beta, kind[1])
    R3 = utils.rotmatrix(alpha, kind[0])
    return np.einsum("...ij,...jk->...ik",
                     np.einsum("...ij,...jk->...ik", R3, R2), R1)
Esempio n. 2
0
def change_response(resp_old, resp_new, data):
	resp_old = np.array(resp_old,dtype=float)
	resp_new = np.array(resp_new,dtype=float)
	res = np.array(data)
	# T is simple. Just rescale
	res[:,0] *= resp_new[0]/resp_old[0]
	# P is a rotation plus a rescaling
	amp_old, ang_old = polar(resp_old[1:])
	amp_new, ang_new = polar(resp_new[1:])
	R = utils.rotmatrix(ang_new-ang_old, 'z')[:2,:2] * amp_new / amp_old
	res[:,1:] = np.einsum("ab,fb...->fa...",R,res[:,1:])
	return res