@@ -15,9 +15,9 @@ def wfs_2d_line(omega, x0, n0, xs, c=None):
1515 D(x0,k) = j/2 k (x0-xs) n0 / |x0-xs| * H1(k |x0-xs|)
1616
1717 """
18- x0 = np . asarray (x0 )
19- n0 = np . asarray (n0 )
20- xs = np . squeeze ( np . asarray ( xs ) )
18+ x0 = util . asarray_of_rows (x0 )
19+ n0 = util . asarray_of_rows (n0 )
20+ xs = util . asarray_1d ( xs )
2121 k = util .wavenumber (omega , c )
2222 ds = x0 - xs
2323 r = np .linalg .norm (ds , axis = 1 )
@@ -34,9 +34,9 @@ def _wfs_point(omega, x0, n0, xs, c=None):
3434 |x0-xs|^(3/2)
3535
3636 """
37- x0 = np . asarray (x0 )
38- n0 = np . asarray (n0 )
39- xs = np . squeeze ( np . asarray ( xs ) )
37+ x0 = util . asarray_of_rows (x0 )
38+ n0 = util . asarray_of_rows (n0 )
39+ xs = util . asarray_1d ( xs )
4040 k = util .wavenumber (omega , c )
4141 ds = x0 - xs
4242 r = np .linalg .norm (ds , axis = 1 )
@@ -56,10 +56,10 @@ def wfs_25d_point(omega, x0, n0, xs, xref=[0, 0, 0], c=None, omalias=None):
5656 |x0-xs|^(3/2)
5757
5858 """
59- x0 = np . asarray (x0 )
60- n0 = np . asarray (n0 )
61- xs = np . squeeze ( np . asarray ( xs ) )
62- xref = np . squeeze ( np . asarray ( xref ) )
59+ x0 = util . asarray_of_rows (x0 )
60+ n0 = util . asarray_of_rows (n0 )
61+ xs = util . asarray_1d ( xs )
62+ xref = util . asarray_1d ( xref )
6363 k = util .wavenumber (omega , c )
6464 ds = x0 - xs
6565 r = np .linalg .norm (ds , axis = 1 )
@@ -80,9 +80,9 @@ def _wfs_plane(omega, x0, n0, n=[0, 1, 0], c=None):
8080 D(x0,k) = j k n n0 e^(-j k n x0)
8181
8282 """
83- x0 = np . asarray (x0 )
84- n0 = np . asarray (n0 )
85- n = np . squeeze ( np . asarray ( n ) )
83+ x0 = util . asarray_of_rows (x0 )
84+ n0 = util . asarray_of_rows (n0 )
85+ n = util . asarray_1d ( n )
8686 k = util .wavenumber (omega , c )
8787 return 2j * k * np .inner (n , n0 ) * np .exp (- 1j * k * np .inner (n , x0 ))
8888
@@ -100,10 +100,10 @@ def wfs_25d_plane(omega, x0, n0, n=[0, 1, 0], xref=[0, 0, 0], c=None,
100100 D_2.5D(x0,w) = \|j k |xref-x0| n n0 e^(-j k n x0)
101101
102102 """
103- x0 = np . asarray (x0 )
104- n0 = np . asarray (n0 )
105- n = np . squeeze ( np . asarray ( n ) )
106- xref = np . squeeze ( np . asarray ( xref ) )
103+ x0 = util . asarray_of_rows (x0 )
104+ n0 = util . asarray_of_rows (n0 )
105+ n = util . asarray_1d ( n )
106+ xref = util . asarray_1d ( xref )
107107 k = util .wavenumber (omega , c )
108108 return wfs_25d_preeq (omega , omalias , c ) * \
109109 np .sqrt (2 * np .pi * np .linalg .norm (xref - x0 )) * \
@@ -113,7 +113,7 @@ def wfs_25d_plane(omega, x0, n0, n=[0, 1, 0], xref=[0, 0, 0], c=None,
113113wfs_3d_plane = _wfs_plane
114114
115115
116- def _wfs_focused (omega , x0 , n0 , xs , ns , c = None ):
116+ def _wfs_focused (omega , x0 , n0 , xs , c = None ):
117117 """Focused source by two- or three-dimensional WFS.
118118
119119 ::
@@ -123,9 +123,9 @@ def _wfs_focused(omega, x0, n0, xs, ns, c=None):
123123 |x0-xs|^(3/2)
124124
125125 """
126- x0 = np . asarray (x0 )
127- n0 = np . asarray (n0 )
128- xs = np . squeeze ( np . asarray ( xs ) )
126+ x0 = util . asarray_of_rows (x0 )
127+ n0 = util . asarray_of_rows (n0 )
128+ xs = util . asarray_1d ( xs )
129129 k = util .wavenumber (omega , c )
130130 ds = x0 - xs
131131 r = np .linalg .norm (ds , axis = 1 )
@@ -145,10 +145,10 @@ def wfs_25d_focused(omega, x0, n0, xs, xref=[0, 0, 0], c=None, omalias=None):
145145 |x0-xs|^(3/2)
146146
147147 """
148- x0 = np . asarray (x0 )
149- n0 = np . asarray (n0 )
150- xs = np . squeeze ( np . asarray ( xs ) )
151- xref = np . squeeze ( np . asarray ( xref ) )
148+ x0 = util . asarray_of_rows (x0 )
149+ n0 = util . asarray_of_rows (n0 )
150+ xs = util . asarray_1d ( xs )
151+ xref = util . asarray_1d ( xref )
152152 k = util .wavenumber (omega , c )
153153 ds = x0 - xs
154154 r = np .linalg .norm (ds , axis = 1 )
@@ -174,8 +174,8 @@ def wfs_25d_preeq(omega, omalias, c):
174174
175175def delay_3d_plane (omega , x0 , n0 , n = [0 , 1 , 0 ], c = None ):
176176 """Plane wave by simple delay of secondary sources."""
177- x0 = np . asarray (x0 )
178- n = np . squeeze ( np . asarray ( n ) )
177+ x0 = util . asarray_of_rows (x0 )
178+ n = util . asarray_1d ( n )
179179 k = util .wavenumber (omega , c )
180180 return np .exp (- 1j * k * np .inner (n , x0 ))
181181
@@ -186,8 +186,8 @@ def source_selection_plane(n0, n):
186186 Eq.(13) from [Spors et al, 2008]
187187
188188 """
189- n0 = np . asarray (n0 )
190- n = np . squeeze ( np . asarray ( n ) )
189+ n0 = util . asarray_of_rows (n0 )
190+ n = util . asarray_1d ( n )
191191 return np .inner (n , n0 ) >= defs .selection_tolerance
192192
193193
@@ -197,9 +197,9 @@ def source_selection_point(n0, x0, xs):
197197 Eq.(15) from [Spors et al, 2008]
198198
199199 """
200- n0 = np . asarray (n0 )
201- x0 = np . asarray (x0 )
202- xs = np . squeeze ( np . asarray ( xs ) )
200+ n0 = util . asarray_of_rows (n0 )
201+ x0 = util . asarray_of_rows (x0 )
202+ xs = util . asarray_1d ( xs )
203203 ds = x0 - xs
204204 return inner1d (ds , n0 ) >= defs .selection_tolerance
205205
@@ -219,9 +219,9 @@ def source_selection_focused(ns, x0, xs):
219219 Eq.(2.78) from [Wierstorf, 2014]
220220
221221 """
222- x0 = np . asarray (x0 )
223- xs = np . squeeze ( np . asarray ( xs ) )
224- ns = np . squeeze ( np . asarray ( ns ) )
222+ x0 = util . asarray_of_rows (x0 )
223+ xs = util . asarray_1d ( xs )
224+ ns = util . asarray_1d ( ns )
225225 ds = xs - x0
226226 return inner1d (ns , ds ) >= defs .selection_tolerance
227227
@@ -235,13 +235,15 @@ def nfchoa_2d_plane(omega, x0, r0, n=[0, 1, 0], c=None):
235235 """Plane wave by two-dimensional NFC-HOA.
236236
237237 ::
238+
238239 __
239240 2i \ i^-m
240241 D(phi0,w) = - ----- /__ ---------- e^(i m (phi0-phi_pw))
241242 pi r0 m=-N..N (2)
242243 Hm (w/c r0)
244+
243245 """
244- x0 = np . asarray (x0 )
246+ x0 = util . asarray_of_rows (x0 )
245247 k = util .wavenumber (omega , c )
246248 alpha , beta , r = util .cart2sph (n [0 ], n [1 ], n [2 ])
247249 alpha0 , beta0 , tmp = util .cart2sph (x0 [:, 0 ], x0 [:, 1 ], x0 [:, 2 ])
@@ -268,7 +270,7 @@ def nfchoa_25d_point(omega, x0, r0, xs, c=None):
268270 h|m| (w/c r0)
269271
270272 """
271- x0 = np . asarray (x0 )
273+ x0 = util . asarray_of_rows (x0 )
272274 k = util .wavenumber (omega , c )
273275 alpha , beta , r = util .cart2sph (xs [0 ], xs [1 ], xs [2 ])
274276 alpha0 , beta0 , tmp = util .cart2sph (x0 [:, 0 ], x0 [:, 1 ], x0 [:, 2 ])
@@ -295,7 +297,7 @@ def nfchoa_25d_plane(omega, x0, r0, n=[0, 1, 0], c=None):
295297 w/c h|m| (w/c r0)
296298
297299 """
298- x0 = np . asarray (x0 )
300+ x0 = util . asarray_of_rows (x0 )
299301 k = util .wavenumber (omega , c )
300302 alpha , beta , r = util .cart2sph (n [0 ], n [1 ], n [2 ])
301303 alpha0 , beta0 , tmp = util .cart2sph (x0 [:, 0 ], x0 [:, 1 ], x0 [:, 2 ])
@@ -320,9 +322,9 @@ def sdm_2d_line(omega, x0, n0, xs, c=None):
320322 D(x0,k) =
321323
322324 """
323- x0 = np . asarray (x0 )
324- n0 = np . asarray (n0 )
325- xs = np . squeeze ( np . asarray ( xs ) )
325+ x0 = util . asarray_of_rows (x0 )
326+ n0 = util . asarray_of_rows (n0 )
327+ xs = util . asarray_1d ( xs )
326328 k = util .wavenumber (omega , c )
327329 ds = x0 - xs
328330 r = np .linalg .norm (ds , axis = 1 )
@@ -338,9 +340,9 @@ def sdm_2d_plane(omega, x0, n0, n=[0, 1, 0], c=None):
338340 D(x0,k) = kpw,y * e^(-j*kpw,x*x)
339341
340342 """
341- x0 = np . asarray (x0 )
342- n0 = np . asarray (n0 )
343- n = np . squeeze ( np . asarray ( n ) )
343+ x0 = util . asarray_of_rows (x0 )
344+ n0 = util . asarray_of_rows (n0 )
345+ n = util . asarray_1d ( n )
344346 k = util .wavenumber (omega , c )
345347 return k * n [1 ] * np .exp (- 1j * k * n [0 ] * x0 [:, 0 ])
346348
@@ -354,10 +356,10 @@ def sdm_25d_plane(omega, x0, n0, n=[0, 1, 0], xref=[0, 0, 0], c=None):
354356 D_2.5D(x0,w) =
355357
356358 """
357- x0 = np . asarray (x0 )
358- n0 = np . asarray (n0 )
359- n = np . squeeze ( np . asarray ( n ) )
360- xref = np . squeeze ( np . asarray ( xref ) )
359+ x0 = util . asarray_of_rows (x0 )
360+ n0 = util . asarray_of_rows (n0 )
361+ n = util . asarray_1d ( n )
362+ xref = util . asarray_1d ( xref )
361363 k = util .wavenumber (omega , c )
362364 return 4j * np .exp (- 1j * k * n [1 ]* xref [1 ]) / hankel2 (0 , k * n [1 ]* xref [1 ]) * \
363365 np .exp (- 1j * k * n [0 ]* x0 [:, 0 ])
@@ -372,10 +374,10 @@ def sdm_25d_point(omega, x0, n0, xs, xref=[0, 0, 0], c=None):
372374 D(x0,k) =
373375
374376 """
375- x0 = np . asarray (x0 )
376- n0 = np . asarray (n0 )
377- xs = np . squeeze ( np . asarray ( xs ) )
378- xref = np . squeeze ( np . asarray ( xref ) )
377+ x0 = util . asarray_of_rows (x0 )
378+ n0 = util . asarray_of_rows (n0 )
379+ xs = util . asarray_1d ( xs )
380+ xref = util . asarray_1d ( xref )
379381 k = util .wavenumber (omega , c )
380382 ds = x0 - xs
381383 r = np .linalg .norm (ds , axis = 1 )
0 commit comments