Skip to content

Commit e9ce066

Browse files
committed
Update wfs-referencing.ipynb
- added mgeier comments, such as bibtex entries also as cite text - 2.5D WFS in headline - bib Start1997 added for theory - text mods to correct and improve the story - correct normalizing for xref
1 parent b6b2f6f commit e9ce066

File tree

1 file changed

+33
-15
lines changed

1 file changed

+33
-15
lines changed

doc/examples/wfs-referencing.ipynb

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# WFS Referencing Schemes\n",
7+
"# 2.5D WFS Referencing Schemes\n",
88
"\n",
9-
"Illustrates the usage of the SFS toolbox for the simulation of different 2.5D WFS referencing schemes for contours within the listening area that exhibit amplitude correct synthesis, cf. Ch. 4.1.3 in <cite data-cite=\"Firtha2019\">[Firtha19]</cite> and <cite data-cite=\"Firtha2017\">(FFSS17)</cite>."
9+
"Illustrates the usage of the SFS toolbox for the simulation of different 2.5D WFS referencing schemes.\n",
10+
"This so called referencing controls contours alongside correct amplitude is obtained within the listening area,\n",
11+
"cf. Ch 3.1-3.3 in <cite data-cite=\"Start1997\">(Start1997)</cite>, Ch. 4.1.3 in <cite data-cite=\"Firtha2019\">(Firtha2019)</cite> and <cite data-cite=\"Firtha2017\">(Firtha2017)</cite> for the theory."
1012
]
1113
},
1214
{
@@ -83,7 +85,7 @@
8385
"source": [
8486
"### Line as reference contour\n",
8587
"\n",
86-
"The reference contour is calculated according to <cite data-cite=\"Firtha2017\">(FFSS17)</cite> for a virtual point source on x-axis."
88+
"The reference contour is calculated according to <cite data-cite=\"Firtha2017\">(Firtha2017)</cite> for a virtual point source on x-axis."
8789
]
8890
},
8991
{
@@ -94,7 +96,7 @@
9496
"source": [
9597
"# reference contour is a straight line\n",
9698
"xref_line = 0\n",
97-
"# calc reference contour xref(x0), cf. [FFSS17, eq. (24), (31), (52)]\n",
99+
"# calc reference contour xref(x0), cf. [Firtha2017, eq. (24), (31), (52)]\n",
98100
"# this code assumes virtual point source on x-axis\n",
99101
"cosbeta = (array.n @ [1, 0, 0]).reshape(-1, 1)\n",
100102
"xref = array.x + \\\n",
@@ -110,7 +112,7 @@
110112
"cell_type": "markdown",
111113
"metadata": {},
112114
"source": [
113-
"The level plot includes a white 0 dB isobar curve, which nicely demonstrates the intended amplitude correct synthesis. Note that this isobar is not perfectly aligned along the intended reference contour (gray points) due to diffraction artifacts, which cannot really be compensated."
115+
"The level plot includes a white 0 dB isobar curve, which nicely demonstrates the intended amplitude correct synthesis. Note that this isobar is not perfectly aligned along the intended reference contour (orange-like dots) due to diffraction artifacts, which cannot really be compensated."
114116
]
115117
},
116118
{
@@ -130,7 +132,7 @@
130132
"source": [
131133
"# reference contour is a circle with origin xs\n",
132134
"xref_dist = np.linalg.norm(xs)\n",
133-
"# calc reference contour xref(x0), cf. [Fir19, eq. (24), (31)]\n",
135+
"# calc reference contour xref(x0), cf. [Firtha19, eq. (24), (31)]\n",
134136
"x0xs = array.x - xs\n",
135137
"x0xs_length = np.linalg.norm(x0xs, axis=1, keepdims=True)\n",
136138
"x0xs_unit = x0xs / x0xs_length # unit vec\n",
@@ -164,7 +166,7 @@
164166
"cell_type": "markdown",
165167
"metadata": {},
166168
"source": [
167-
"The (complex-valued) ratio between the two sound fields tells us about the difference of both approaches in terms of dB. Note that again a white 0 dB isobar curve is added as contour plot."
169+
"The (complex-valued) ratio between the two sound fields tells us about the difference of both approaches in terms of dB. Note, that again a white 0 dB isobar curve is overlaid as contour plot."
168170
]
169171
},
170172
{
@@ -193,10 +195,11 @@
193195
"source": [
194196
"The default handling in\n",
195197
"`point_25d(omega, x0, n0, xs, xref=[0, 0, 0], c=None, omalias=None)`\n",
196-
"uses just a reference point, and more specifically the origin, from which the reference contour is determined.\n",
198+
"uses just a reference point xref, and more specifically this point is in the origin.\n",
199+
"This single point, the virtual source position and the loudspeaker array then determine the reference contour without further user access to it.\n",
197200
"This handling is chosen due to convenience and practical relevance using circular loudspeaker arrays.\n",
198201
"The example below shows the resulting reference contour for the default case.\n",
199-
"In the example it looks similar to the line referencing contour, but is in general not the same!"
202+
"In the example it looks similar to the line referencing contour, but is in general not exactly the same."
200203
]
201204
},
202205
{
@@ -206,6 +209,7 @@
206209
"outputs": [],
207210
"source": [
208211
"xref = [0, 0, 0]\n",
212+
"normalize_gain = 4 * np.pi * np.linalg.norm(xs - np.array(xref))\n",
209213
"d, selection, secondary_source = sfs.fd.wfs.point_25d(\n",
210214
" omega, array.x, array.n, xs, xref=xref)\n",
211215
"p_circ = sound_field(d * normalize_gain, np.array([xref]*array.x.shape[0]),\n",
@@ -216,9 +220,13 @@
216220
"cell_type": "markdown",
217221
"metadata": {},
218222
"source": [
219-
"The reference point handling might (and indeed mostly will) fail for other reference point locations, as can be seen below.\n",
220-
"The 0 dB isobar curve does not meet the intended xref point.\n",
221-
"Hence, be very careful with this referencing in non-default scenarios."
223+
"From an academic viewpoint, the reference point handling in most cases will fail, as it is rather unlikely to set up the loudspeaker array and the virtual source and the reference point, such that the latter exactly fulfills the stationary phase requirement with one of the active loudspeakers.\n",
224+
"\n",
225+
"In the example above this worked, but only because it was intentionally chosen to do so.\n",
226+
"\n",
227+
"The example below shows the failing case. The point xref does not match any ray (gray lines) alongside the stationary phase holds with its corresponding loudspeaker. \n",
228+
"The obtained reference level at xref point is however close to 0 dB, as the reference contour (white 0 dB isobar) is very very close to it.\n",
229+
"So, in practice this handling will likely work with sufficient precision."
222230
]
223231
},
224232
{
@@ -227,18 +235,28 @@
227235
"metadata": {},
228236
"outputs": [],
229237
"source": [
230-
"xref = [-0.5, 0, 0]\n",
238+
"xref = [0, 0.1175, 0] # intentionally no stationary phase point\n",
239+
"# we don't forget to normalize the point source's amplitude\n",
240+
"# to this new reference point:\n",
241+
"normalize_gain = 4 * np.pi * np.linalg.norm(xs - np.array(xref))\n",
231242
"d, selection, secondary_source = sfs.fd.wfs.point_25d(\n",
232243
" omega, array.x, array.n, xs, xref=xref)\n",
233244
"p_circ = sound_field(d * normalize_gain, np.array([xref]*array.x.shape[0]),\n",
234-
" selection, secondary_source, array, grid)"
245+
" selection, secondary_source, array, grid)\n",
246+
"\n",
247+
"spa_unit_path = array.x - xs # path along the stationary phase holds\n",
248+
"spa_unit_path /= np.linalg.norm(spa_unit_path, axis=1, keepdims=1)\n",
249+
"spa = array.x + R * spa_unit_path\n",
250+
"for spa1, spa2 in zip(array.x[selection, :2], spa[selection, :2]):\n",
251+
" plt.plot([spa1[0], spa2[0]],\n",
252+
" [spa1[1], spa2[1]], 'dimgray')"
235253
]
236254
},
237255
{
238256
"cell_type": "markdown",
239257
"metadata": {},
240258
"source": [
241-
"A plane wave like sound field, by setting `xs = -1000, 0, 0`, for all above examples reveals some more implications of the different referencing schemes."
259+
"A plane wave like sound field, e.g. by setting `xs = -100, 0, 0`, for all above examples reveals some more implications of the different referencing schemes."
242260
]
243261
}
244262
],

0 commit comments

Comments
 (0)