@@ -12,7 +12,7 @@ def sht_matrix(N, azi, elev, weights=None):
12
12
13
13
.. math::
14
14
15
- \mathbf{Y} = \left[ \begin{array}{cccccc}
15
+ \mathbf{Y} = \left[ \begin{array}{cccccc}
16
16
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]) \\
17
17
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]) \\
18
18
\vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\
@@ -25,6 +25,10 @@ def sht_matrix(N, azi, elev, weights=None):
25
25
26
26
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}
27
27
28
+
29
+ (Note: :math:`\mathbf{Y}` is interpreted as the inverse transform (or synthesis)
30
+ matrix in examples and documentation.)
31
+
28
32
Parameters
29
33
----------
30
34
N : int
@@ -38,22 +42,23 @@ def sht_matrix(N, azi, elev, weights=None):
38
42
39
43
Returns
40
44
-------
41
- Ymn : ((N+1)**2, Q ) numpy.ndarray
45
+ Ymn : (Q, (N+1)**2) numpy.ndarray
42
46
Matrix of spherical harmonics.
47
+
43
48
"""
44
49
azi = util .asarray_1d (azi )
45
50
elev = util .asarray_1d (elev )
46
51
if azi .ndim == 0 :
47
- M = 1
52
+ Q = 1
48
53
else :
49
- M = len (azi )
54
+ Q = len (azi )
50
55
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 )
53
58
i = 0
54
59
for n in range (N + 1 ):
55
60
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 )
57
62
i += 1
58
63
return Ymn
59
64
@@ -105,6 +110,10 @@ def cht_matrix(N, pol, weights=None):
105
110
1 & e^{i\varphi[Q-1]} & \cdots & e^{iN\varphi[Q-1]} & e^{-iN\varphi[Q-1]} & \cdots & e^{-i\varphi[Q-1]}
106
111
\end{array} \right]
107
112
113
+ (Note: :math:`\Psi` is interpreted as the inverse transform (or synthesis)
114
+ matrix in examples and documentation.)
115
+
116
+
108
117
Parameters
109
118
----------
110
119
N : int
@@ -116,8 +125,9 @@ def cht_matrix(N, pol, weights=None):
116
125
117
126
Returns
118
127
-------
119
- Psi : (2N+1, Q ) numpy.ndarray
128
+ Psi : (Q, 2N+1) numpy.ndarray
120
129
Matrix of circular harmonics.
130
+
121
131
"""
122
132
pol = util .asarray_1d (pol )
123
133
if pol .ndim == 0 :
@@ -126,10 +136,10 @@ def cht_matrix(N, pol, weights=None):
126
136
Q = len (pol )
127
137
if weights is None :
128
138
weights = np .ones (Q )
129
- Psi = np .zeros ([(2 * N + 1 ), Q ], dtype = complex )
139
+ Psi = np .zeros ([Q , (2 * N + 1 )], dtype = complex )
130
140
order = np .roll (np .arange (- N , N + 1 ), - N )
131
141
for i , n in enumerate (order ):
132
- Psi [i , : ] = weights * np .exp (1j * n * pol )
142
+ Psi [:, i ] = weights * np .exp (1j * n * pol )
133
143
return Psi
134
144
135
145
0 commit comments