|
12 | 12 | pol_pwd = np.linspace(0, 2*np.pi, 91, endpoint=False) # angles for plane wave decomposition |
13 | 13 | k = np.linspace(0.1, 20, 100) # wavenumber vector |
14 | 14 | r = 1 # radius of array |
15 | | -M = 181 # number of microphones |
| 15 | +M = 181 # number of microphones |
16 | 16 |
|
17 | 17 | # get uniform grid (microphone positions) of number M |
18 | 18 | pol, weights = micarray.modal.angular.grid_equal_polar_angle(M) |
|
26 | 26 | D = micarray.modal.radial.circ_diagonal_mode_mat(Dn) |
27 | 27 |
|
28 | 28 | # compute microphone signals for an incident broad-band plane wave |
29 | | -p = np.exp(1j * k[:, np.newaxis]*r * np.cos(pol - pw_angle)) |
| 29 | +p = np.exp(-1j * k[:, np.newaxis]*r * np.cos(pol - pw_angle)) |
30 | 30 | # compute plane wave decomposition |
31 | 31 | A_pwd = np.matmul(np.matmul(np.conj(Psi_q.T), D), Psi_p) |
32 | 32 | q_pwd = np.squeeze(np.matmul(A_pwd, np.expand_dims(p, 2))) |
33 | 33 | q_pwd_t = np.fft.fftshift(np.fft.irfft(q_pwd, axis=0), axes=0) |
34 | 34 |
|
35 | 35 | # visualize plane wave decomposition (aka beampattern) |
36 | 36 | plt.figure() |
37 | | -plt.pcolormesh(k, pol_pwd/np.pi, 20*np.log10(np.abs(q_pwd.T)), vmin=-40) |
| 37 | +plt.pcolormesh(k, pol_pwd/np.pi, micarray.util.db(q_pwd.T), vmin=-40) |
38 | 38 | plt.colorbar() |
39 | 39 | plt.xlabel(r'$kr$') |
40 | 40 | plt.ylabel(r'$\phi / \pi$') |
41 | 41 | plt.title('Plane wave docomposition by modal beamformer (frequency domain)') |
42 | 42 | plt.savefig('modal_open_beamformer_pwd_fd.png') |
43 | 43 |
|
44 | 44 | plt.figure() |
45 | | -plt.pcolormesh(range(2*len(k)-2), pol_pwd/np.pi, 20*np.log10(np.abs(q_pwd_t.T)), vmin=-40) |
| 45 | +plt.pcolormesh(range(2*len(k)-2), pol_pwd/np.pi, micarray.util.db(q_pwd_t.T), vmin=-40) |
46 | 46 | plt.colorbar() |
47 | 47 | plt.ylabel(r'$\phi / \pi$') |
48 | 48 | plt.title('Plane wave docomposition by modal beamformer (time domain)') |
|
0 commit comments