Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
we need to use x convention,
alpha_x = -pi (contour clock-wise rotate along z by pi)
beta_x = -pi/2 (contour clock-wise rotate along new x by pi/2)
gamma_x = 0
then y convention is:
alpha_y = alpha_x - pi/2 = 0
beta_y = beta_x = -pi/2
gamma_y = gamma_x + pi/2 = pi/2
reference: https://shtools.oca.eu/shtools/pyshrotaterealcoef.html
'''
new_lighting = np.zeros(lighting.shape)
n = lighting.shape[0]
for i in range(n):
shMatrix = shtools_sh2matrix(lighting[i,:], self.SH_DEGREE)
# rotate coordinate
shMatrix = SHRotateRealCoef(shMatrix, np.array([0, -np.pi/2, np.pi/2]), self.dj)
# rotate object
#shMatrix = SHRotateRealCoef(shMatrix, np.array([-np.pi/2, np.pi/2, -np.pi/2]), self.dj)
new_lighting[i,:] = shtools_matrix2vec(shMatrix)
return new_lighting
we need to use x convention,
alpha_x = pi/2 (clock-wise rotate along z axis by pi/2)
beta_x = -pi/2 (contour clock-wise rotate along new x by pi/2)
gamma_x = 0
then y convention is:
alpha_y = alpha_x - pi/2 = 0
beta_y = beta_x = -pi/2
gamma_y = gamma_x + pi/2 = pi/2
reference: https://shtools.oca.eu/shtools/pyshrotaterealcoef.html
'''
new_lighting = np.zeros(lighting.shape)
n = lighting.shape[0]
for i in range(n):
shMatrix = shtools_sh2matrix(lighting[i,:], self.SH_DEGREE)
# rotate coordinate
shMatrix = SHRotateRealCoef(shMatrix, np.array([0, -np.pi/2, np.pi/2]), self.dj)
# rotate object
#shMatrix = SHRotateRealCoef(shMatrix, np.array([np.pi/2, -np.pi/2, 0]), self.dj)
new_lighting[i,:] = shtools_matrix2vec(shMatrix)
return new_lighting