@@ -12,7 +12,7 @@ def sht_matrix(N, azi, elev, weights=None):
1212
1313 .. math::
1414
15- \mathbf{Y} = \left[ \begin{array}{cccccc}
15+ \mathbf{Y} = \left[ \begin{array}{cccccc}
1616 Y_0^0(\theta[0], \phi[0]) & Y_1^{-1}(\theta[0], \phi[0]) & Y_1^0(\theta[0], \phi[0]) & Y_1^1(\theta[0], \phi[0]) & \dots & Y_N^N(\theta[0], \phi[0]) \\
1717 Y_0^0(\theta[1], \phi[1]) & Y_1^{-1}(\theta[1], \phi[1]) & Y_1^0(\theta[1], \phi[1]) & Y_1^1(\theta[1], \phi[1]) & \dots & Y_N^N(\theta[1], \phi[1]) \\
1818 \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\
@@ -25,6 +25,10 @@ def sht_matrix(N, azi, elev, weights=None):
2525
2626 Y_n^m(\theta, \phi) = \sqrt{\frac{2n + 1}{4 \pi} \frac{(n-m)!}{(n+m)!}} P_n^m(\cos \theta) e^{i m \phi}
2727
28+
29+ (Note: :math:`\mathbf{Y}` is interpreted as the inverse transform (or synthesis)
30+ matrix in examples and documentation.)
31+
2832 Parameters
2933 ----------
3034 N : int
@@ -38,22 +42,23 @@ def sht_matrix(N, azi, elev, weights=None):
3842
3943 Returns
4044 -------
41- Ymn : ((N+1)**2, Q ) numpy.ndarray
45+ Ymn : (Q, (N+1)**2) numpy.ndarray
4246 Matrix of spherical harmonics.
47+
4348 """
4449 azi = util .asarray_1d (azi )
4550 elev = util .asarray_1d (elev )
4651 if azi .ndim == 0 :
47- M = 1
52+ Q = 1
4853 else :
49- M = len (azi )
54+ Q = len (azi )
5055 if weights is None :
51- weights = np .ones (M )
52- Ymn = np .zeros ([(N + 1 )** 2 , M ], dtype = complex )
56+ weights = np .ones (Q )
57+ Ymn = np .zeros ([Q , (N + 1 )** 2 ], dtype = complex )
5358 i = 0
5459 for n in range (N + 1 ):
5560 for m in range (- n , n + 1 ):
56- Ymn [i , : ] = weights * special .sph_harm (m , n , azi , elev )
61+ Ymn [:, i ] = weights * special .sph_harm (m , n , azi , elev )
5762 i += 1
5863 return Ymn
5964
@@ -105,6 +110,10 @@ def cht_matrix(N, pol, weights=None):
105110 1 & e^{i\varphi[Q-1]} & \cdots & e^{iN\varphi[Q-1]} & e^{-iN\varphi[Q-1]} & \cdots & e^{-i\varphi[Q-1]}
106111 \end{array} \right]
107112
113+ (Note: :math:`\Psi` is interpreted as the inverse transform (or synthesis)
114+ matrix in examples and documentation.)
115+
116+
108117 Parameters
109118 ----------
110119 N : int
@@ -116,8 +125,9 @@ def cht_matrix(N, pol, weights=None):
116125
117126 Returns
118127 -------
119- Psi : (2N+1, Q ) numpy.ndarray
128+ Psi : (Q, 2N+1) numpy.ndarray
120129 Matrix of circular harmonics.
130+
121131 """
122132 pol = util .asarray_1d (pol )
123133 if pol .ndim == 0 :
@@ -126,10 +136,10 @@ def cht_matrix(N, pol, weights=None):
126136 Q = len (pol )
127137 if weights is None :
128138 weights = np .ones (Q )
129- Psi = np .zeros ([(2 * N + 1 ), Q ], dtype = complex )
139+ Psi = np .zeros ([Q , (2 * N + 1 )], dtype = complex )
130140 order = np .roll (np .arange (- N , N + 1 ), - N )
131141 for i , n in enumerate (order ):
132- Psi [i , : ] = weights * np .exp (1j * n * pol )
142+ Psi [:, i ] = weights * np .exp (1j * n * pol )
133143 return Psi
134144
135145
0 commit comments