Skip to content

Commit 5e496ee

Browse files
committed
generate circular grid points based on the maximum order
1 parent b38c0b7 commit 5e496ee

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

examples/modal_beamforming_open_circular_array.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
pol_pwd = np.linspace(0, 2*np.pi, 91, endpoint=False) # angles for plane wave decomposition
1313
k = np.linspace(0.1, 20, 100) # wavenumber vector
1414
r = 1 # radius of array
15-
M = 181 # number of microphones
1615

17-
# get uniform grid (microphone positions) of number M
18-
pol, weights = micarray.modal.angular.grid_equal_polar_angle(M)
16+
# get uniform grid (microphone positions) of order N
17+
pol, weights = micarray.modal.angular.grid_equal_polar_angle(N)
1918
# get circular harmonics matrix for sensors
2019
Psi_p = micarray.modal.angular.cht_matrix(N, pol, weights)
2120
# get circular harmonics matrix for a source ensemble of azimuthal plane wave

examples/modal_beamforming_rigid_circular_array.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
pol_pwd = np.linspace(0, 2*np.pi, 180, endpoint=False) # angles for plane wave decomposition
1414
k = np.linspace(0.1, 20, 100) # wavenumber vector
1515
r = 1 # radius of array
16-
M = 61 # number of microphones
1716

18-
# get uniform grid (microphone positions) of number M
19-
pol, weights = micarray.modal.angular.grid_equal_polar_angle(M)
17+
# get uniform grid (microphone positions) of order N
18+
pol, weights = micarray.modal.angular.grid_equal_polar_angle(N)
2019

2120
# pressure on the surface of a rigid cylinder for an incident plane wave
2221
bn = micarray.modal.radial.circular_pw(Nsf, k, r, setup='rigid')

micarray/modal/angular.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,13 @@ def grid_gauss(n):
197197
return azi, elev, weights
198198

199199

200-
def grid_equal_polar_angle(M, phi0=0):
200+
def grid_equal_polar_angle(n):
201201
"""Equi-angular sampling points on a circle.
202202
203203
Parameters
204204
----------
205-
M : int
206-
Number of microphones.
207-
phi0 : float
208-
Angular shift
205+
n : int
206+
Maximum order
209207
210208
Returns
211209
-------
@@ -214,6 +212,7 @@ def grid_equal_polar_angle(M, phi0=0):
214212
weights : array_like
215213
Weights.
216214
"""
217-
pol = np.linspace(0, 2*np.pi, num=M, endpoint=False) + phi0
218-
weights = 1/M * np.ones(M)
215+
num_mic = 2*n+1
216+
pol = np.linspace(0, 2*np.pi, num=num_mic, endpoint=False)
217+
weights = 1/num_mic * np.ones(num_mic)
219218
return pol, weights

0 commit comments

Comments
 (0)