Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amplitude normalization factor in wfs.focused_25d function #176

Open
pizqleh opened this issue Apr 23, 2021 · 0 comments
Open

Amplitude normalization factor in wfs.focused_25d function #176

pizqleh opened this issue Apr 23, 2021 · 0 comments

Comments

@pizqleh
Copy link

pizqleh commented Apr 23, 2021

Hello. First of all, thank you for developing this tool, and for quickly answering the last issues. If possible, I would like to ask you about the 2.5D WFS foucus source case. Apparently, the sound field generated by the driving function given by wfs.focused_25d don't not ressemble correctly the sound field of it's related point source, because it's way stronger than the focused source field. Is this something that one should expect from the nature of the mathematical model? My first guess is that this might not be the case, because even in x_ref=(0,0,0) the amplitude is way stronger. Maybe there is missing an amplitude factor in the implementation? Related to this, apparently there is a missmatch on what is expressed in your pdf docs 'Theory of Sound Field Synthesis' and what is expressed in the web docs 'https://sfs-python.readthedocs.io/en/0.5.0/sfs.fd.wfs.html' (the equations for the 2.5D WFS focus source case have different amplitude factors).

import numpy as np
import matplotlib.pyplot as plt
import sfs

frequency = 343
radius = 2.5
start_x, end_x = 2 * radius * np.asarray([-1, 1])
start_y, end_y = start_x, end_x
spacing = 0.01
grid = sfs.util.xyz_grid([start_x, end_x], [start_y, end_y], 0, spacing=spacing)


### POINT SOURCE.
# Sfs way to generate point source.
position = np.asarray([0, 1/3 * radius, 0])
normalization = 4 * np.pi * np.linalg.norm(position)
point_source = sfs.fd.source.point(2 * np.pi * frequency, position, grid) * normalization
sfs.plot2d.amplitude(point_source, grid)
plt.show()


## WFS
n_loudspeakers = 100
array = sfs.array.circular(N=n_loudspeakers, R=radius)
omega = 2 * np.pi * frequency
x_ref=[0, 0, 0]
d_wfs, s_wfs, ss_wfs = sfs.fd.wfs.focused_25d(omega, array.x, array.n, position, -position / np.linalg.norm(position), xref=x_ref)
u_wfs = sfs.fd.synthesize(d_wfs, s_wfs, array, ss_wfs, grid=grid) * normalization
sfs.plot2d.amplitude(u_wfs, grid)
sfs.plot2d.loudspeakers(array.x, array.n, s_wfs * array.a, size=0.15)
plt.show()

# Plot difference.
sfs.plot2d.amplitude(u_wfs - point_source, grid)
sfs.plot2d.loudspeakers(array.x, array.n, s_wfs * array.a, size=0.15)
plt.show()

Note that I have applied the same normalization factor in the point source and WFS waves, for the sake of plots clarity. The synthetized sound field for the point source, WFS, and the difference are:
Captura de Pantalla 2021-06-03 a la(s) 15 50 59
Captura de Pantalla 2021-06-03 a la(s) 15 51 07
Captura de Pantalla 2021-06-03 a la(s) 15 51 17

Thank you,

Pedro Izquierdo L.

@pizqleh pizqleh closed this as completed May 12, 2021
@pizqleh pizqleh reopened this Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant