How to use the pyshtools.rotate.SHRotateRealCoef function in pyshtools

To help you get started, we’ve selected a few pyshtools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zhhoper / DPR / utils / utils_normal.py View on Github external
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
github zhhoper / DPR / utils / utils_normal.py View on Github external
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

pyshtools

SHTOOLS - Spherical Harmonic Tools

BSD-3-Clause
Latest version published 2 months ago

Package Health Score

78 / 100
Full package analysis

Similar packages