Skip to content

SHT and CHT #7

@narahahn

Description

@narahahn

According to Eq. (3.34) in Rafaely, 2015, the forward and inverse discrete spherical harmonic transform are defined as

fnm = Y^-1 * f
f = Y * fnm

where fnm denotes the SHT coefficient vector, f the sound field vector, Y the spherical harmonics matrix, and Y^-1 its pseudo-inverse. In our toolbox, we are using the same matrix Y (see sht_matrix), but it is not used in a consistent way.

# pressure on the surface of a rigid sphere for an incident plane wave
bn = micarray.modal.radial.spherical_pw(N, k, r, setup='rigid')
D = micarray.modal.radial.diagonal_mode_mat(bn)
Y_p = micarray.modal.angular.sht_matrix(N, azi, elev)
Y_pw = micarray.modal.angular.sht_matrix(N, azi_pw, np.pi/2)
p = np.matmul(np.matmul(np.conj(Y_pw.T), D), Y_p)
p = np.squeeze(p)

Here, Y_p is used for the synthesis (inverse transform) which follows the convention introduced in [Rafaely, 2015].

# plane wave decomposition using modal beamforming
Y_p = micarray.modal.angular.sht_matrix(N, azi, elev, weights)
# get SHT matrix for a source ensemble of azimuthal plane waves
azi_pwd = np.linspace(0, 2*np.pi, 91, endpoint=False)
Y_q = micarray.modal.angular.sht_matrix(N, azi_pwd, np.pi/2)
# get radial filters
bn = micarray.modal.radial.spherical_pw(N, k, r, setup='rigid')
dn, _ = micarray.modal.radial.regularize(1/bn, 100, 'softclip')
D = micarray.modal.radial.diagonal_mode_mat(dn)
# compute the PWD
A_mb = np.matmul(np.matmul(np.conj(Y_q.T), D), Y_p)
q_mb = np.squeeze(np.matmul(A_mb, np.expand_dims(p, 2)))
q_mb_t = np.fft.fftshift(np.fft.irfft(q_mb, axis=0), axes=0)

In the following part (PWD), however, Y_p is used for the analysis (forward transform).

The user should also note that Y_p is different for the analysis (with weights)

Y_p = micarray.modal.angular.sht_matrix(N, azi, elev, weights)

and synthesis (without weights)

Y_p = micarray.modal.angular.sht_matrix(N, azi, elev)

The same applies to CHT.

In my opinion, we need to specify the usage of the SHT and CHT matrices in the document or in the docstrings.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions