|
25 | 25 | "import sfs" |
26 | 26 | ] |
27 | 27 | }, |
28 | | - { |
29 | | - "cell_type": "code", |
30 | | - "execution_count": null, |
31 | | - "metadata": {}, |
32 | | - "outputs": [], |
33 | | - "source": [ |
34 | | - "# we test the usage of\n", |
35 | | - "# https://github.com/sfstoolbox/sfs-python/pull/194\n", |
36 | | - "def normalize_rows(x):\n", |
37 | | - " \"\"\"Normalize a list of vectors.\"\"\"\n", |
38 | | - " x = sfs.util.asarray_of_rows(x)\n", |
39 | | - " return x / np.linalg.norm(x, axis=1, keepdims=True)\n", |
40 | | - "# to be removed once this is merged" |
41 | | - ] |
42 | | - }, |
43 | 28 | { |
44 | 29 | "cell_type": "markdown", |
45 | 30 | "metadata": {}, |
|
151 | 136 | "# reference contour is a circle with origin xs and radius |xs|\n", |
152 | 137 | "xref_dist = np.linalg.norm(xs)\n", |
153 | 138 | "# calc reference contour xref(x0), cf. [Firtha19, eq. (24), (31)]\n", |
154 | | - "xref = xs + xref_dist * normalize_rows(array.x - xs)\n", |
| 139 | + "xref = xs + xref_dist * sfs.util.normalize_rows(array.x - xs)\n", |
155 | 140 | "d, selection, secondary_source = sfs.fd.wfs.point_25d(\n", |
156 | 141 | " omega, array.x, array.n, xs, xref=xref)\n", |
157 | 142 | "p_circ = sound_field(\n", |
|
225 | 210 | "\n", |
226 | 211 | "# plot stationary phase rays\n", |
227 | 212 | "# one ray connects the virtual source with one activate loudspeaker\n", |
228 | | - "spa = array.x + 3*R * normalize_rows(array.x - xs)\n", |
| 213 | + "spa = array.x + 3*R * sfs.util.normalize_rows(array.x - xs)\n", |
229 | 214 | "plt.plot(\n", |
230 | 215 | " np.vstack((array.x[selection, 0], spa[selection, 0])),\n", |
231 | 216 | " np.vstack((array.x[selection, 1], spa[selection, 1])),\n", |
|
0 commit comments