Skip to content

Commit 638bf9c

Browse files
committed
Update Rostock WFS array data (coordinates, weights), adding mgeier suggestions
-Old "university_rostock.csv" as of 2015 is "wfs_university_rostock_2015.csv" now. New measurement data of december 2018 is stored in "wfs_university_rostock_2018" and now includes absolute height (z coordinate, KH120 logo) and weights of the 64 loudspeakers. -also updated the examples/sound_field_synthesis.py to work with the new file -also added WFS array example in array docu
1 parent 4cc7987 commit 638bf9c

File tree

4 files changed

+114
-24
lines changed

4 files changed

+114
-24
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
1.8555,0.12942,1.6137,-1,0,0,0.1877
2+
1.8604,0.31567,1.6137,-1,0,0,0.2045
3+
1.8638,0.53832,1.6133,-1,0,0,0.22837
4+
1.8665,0.77237,1.6118,-1,0,0,0.24117
5+
1.8673,1.0206,1.6157,-1,0,0,0.24838
6+
1.8688,1.2691,1.6154,-1,0,0,0.23781
7+
1.8702,1.4962,1.6167,-1,0,0,0.20929
8+
1.8755,1.6876,1.6163,-1,0,0,0.22679
9+
1.6875,1.8702,1.6203,0,-1,0,0.22545
10+
1.4993,1.8843,1.6154,0,-1,0,0.21679
11+
1.2547,1.8749,1.6174,0,-1,0,0.23875
12+
1.022,1.8768,1.6184,0,-1,0,0.23992
13+
0.77488,1.8763,1.6175,0,-1,0,0.2349
14+
0.55221,1.8775,1.6177,0,-1,0,0.2327
15+
0.3095,1.8797,1.6157,0,-1,0,0.24573
16+
0.060789,1.882,1.6134,0,-1,0,0.21554
17+
-0.12151,1.8841,1.6101,0,-1,0,0.18685
18+
-0.31278,1.8791,1.613,0,-1,0,0.20506
19+
-0.53142,1.8855,1.6099,0,-1,0,0.22562
20+
-0.76382,1.8905,1.6061,0,-1,0,0.23945
21+
-1.0102,1.8888,1.6101,0,-1,0,0.25042
22+
-1.2646,1.8911,1.6086,0,-1,0,0.23947
23+
-1.4891,1.8936,1.607,0,-1,0,0.20807
24+
-1.6807,1.8964,1.6062,0,-1,0,0.22572
25+
-1.8625,1.7108,1.6075,1,0,0,0.22016
26+
-1.863,1.5303,1.6066,1,0,0,0.21877
27+
-1.8611,1.2733,1.6107,1,0,0,0.2448
28+
-1.8653,1.0408,1.6075,1,0,0,0.23885
29+
-1.8729,0.79578,1.6054,1,0,0,0.23437
30+
-1.8704,0.5722,1.6071,1,0,0,0.23219
31+
-1.881,0.33166,1.6053,1,0,0,0.24605
32+
-1.8783,0.080365,1.6075,1,0,0,0.21801
33+
-1.8781,-0.10434,1.6061,1,0,0,0.1852
34+
-1.8798,-0.28999,1.609,1,0,0,0.20278
35+
-1.8842,-0.50982,1.6095,1,0,0,0.22814
36+
-1.8911,-0.74608,1.6054,1,0,0,0.23945
37+
-1.8901,-0.98854,1.6102,1,0,0,0.24439
38+
-1.8928,-1.2348,1.6095,1,0,0,0.24209
39+
-1.8925,-1.4727,1.6117,1,0,0,0.21306
40+
-1.8939,-1.6609,1.6115,1,0,0,0.22209
41+
-1.7127,-1.8417,1.611,0,1,0,0.21959
42+
-1.5295,-1.8417,1.6129,0,1,0,0.21598
43+
-1.2809,-1.8485,1.6079,0,1,0,0.24212
44+
-1.0454,-1.8478,1.6094,0,1,0,0.2401
45+
-0.80072,-1.8512,1.609,0,1,0,0.23619
46+
-0.57305,-1.8524,1.6082,0,1,0,0.23437
47+
-0.33198,-1.8525,1.6074,0,1,0,0.24395
48+
-0.085164,-1.854,1.6085,0,1,0,0.21792
49+
0.10383,-1.8571,1.6082,0,1,0,0.18649
50+
0.28774,-1.8609,1.6061,0,1,0,0.20288
51+
0.50951,-1.8574,1.6049,0,1,0,0.22772
52+
0.74305,-1.8643,1.6034,0,1,0,0.23983
53+
0.989,-1.8695,1.6036,0,1,0,0.24802
54+
1.239,-1.8649,1.6041,0,1,0,0.24388
55+
1.4767,-1.8678,1.6054,0,1,0,0.20977
56+
1.6585,-1.8653,1.6059,0,1,0,0.22148
57+
1.8436,-1.6811,1.6054,-1,0,0,0.22264
58+
1.8563,-1.4974,1.6033,-1,0,0,0.21688
59+
1.8468,-1.248,1.6072,-1,0,0,0.24047
60+
1.85,-1.0167,1.6076,-1,0,0,0.23909
61+
1.8513,-0.76986,1.6101,-1,0,0,0.23739
62+
1.8585,-0.54207,1.6076,-1,0,0,0.23585
63+
1.8562,-0.29831,1.6107,-1,0,0,0.24122
64+
1.857,-0.059658,1.6121,-1,0,0,0.21387

doc/examples/sound_field_synthesis.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@
3333
#x0, n0, a0 = sfs.array.linear_random(N, 0.2*dx, 5*dx)
3434
#x0, n0, a0 = sfs.array.rectangular(N, dx, orientation=sfs.util.direction_vector(0*np.pi/4, np.pi/2))
3535
#x0, n0, a0 = sfs.array.circular(N, R)
36-
x0, n0, a0 = sfs.array.load('../../data/arrays/university_rostock.csv')
36+
x0, n0, a0 = sfs.array.load('../../data/arrays/wfs_university_rostock_2018.csv')
37+
x0[:,2] = 0 # in wfs_university_rostock_2018.csv we encode absolute height
38+
# which is not used here, we also could set the grid coordinate to z=1.615 m
3739

3840
#x0, n0, a0 = sfs.array.planar(N, dx, orientation=sfs.util.direction_vector(np.radians(0),np.radians(180)))
3941
#x0, n0, a0 = sfs.array.cube(N, dx, orientation=sfs.util.direction_vector(0, np.pi/2))

sfs/array.py

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
class ArrayData(namedtuple('ArrayData', 'x n a')):
18-
"""Get named tuple returned by array functions.
18+
"""Named tuple returned by array functions.
1919
2020
See `collections.namedtuple`.
2121
@@ -43,7 +43,7 @@ def take(self, indices):
4343

4444

4545
def linear(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
46-
"""Get linear, equidistantly sampled secondary source distribution.
46+
"""Return linear, equidistantly sampled secondary source distribution.
4747
4848
Parameters
4949
----------
@@ -78,7 +78,7 @@ def linear(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
7878

7979

8080
def linear_diff(distances, center=[0, 0, 0], orientation=[1, 0, 0]):
81-
"""Get linear secondary source distribution from a list of distances.
81+
"""Return linear secondary source distribution from a list of distances.
8282
8383
Parameters
8484
----------
@@ -112,7 +112,7 @@ def linear_diff(distances, center=[0, 0, 0], orientation=[1, 0, 0]):
112112

113113
def linear_random(N, min_spacing, max_spacing, center=[0, 0, 0],
114114
orientation=[1, 0, 0], seed=None):
115-
"""Get randomly sampled linear array.
115+
"""Return randomly sampled linear array.
116116
117117
Parameters
118118
----------
@@ -136,11 +136,14 @@ def linear_random(N, min_spacing, max_spacing, center=[0, 0, 0],
136136
.. plot::
137137
:context: close-figs
138138
139-
x0, n0, a0 = sfs.array.linear_random(12, 0.15, 0.4, orientation=[0, -1, 0])
139+
x0, n0, a0 = sfs.array.linear_random(
140+
N=12,
141+
min_spacing=0.15, max_spacing=0.4,
142+
orientation=[0, -1, 0])
140143
sfs.plot.loudspeaker_2d(x0, n0, a0)
141144
plt.axis('equal')
142145
plt.xlabel('x / m')
143-
plt.ylabel('y / m')
146+
plt.ylabel('y / m')
144147
145148
"""
146149
r = np.random.RandomState(seed)
@@ -149,7 +152,7 @@ def linear_random(N, min_spacing, max_spacing, center=[0, 0, 0],
149152

150153

151154
def circular(N, R, center=[0, 0, 0]):
152-
"""Get circular secondary source distribution parallel to the xy-plane.
155+
"""Return circular secondary source distribution parallel to the xy-plane.
153156
154157
Parameters
155158
----------
@@ -191,7 +194,7 @@ def circular(N, R, center=[0, 0, 0]):
191194

192195

193196
def rectangular(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
194-
"""Get rectangular secondary source distribution.
197+
"""Return rectangular secondary source distribution.
195198
196199
Parameters
197200
----------
@@ -239,7 +242,8 @@ def rectangular(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
239242

240243

241244
def rounded_edge(Nxy, Nr, dx, center=[0, 0, 0], orientation=[1, 0, 0]):
242-
"""Get secondary source distribution along the xy-axis with rounded edge at the origin.
245+
"""Return secondary source distribution along the xy-axis with rounded
246+
edge at the origin.
243247
244248
Parameters
245249
----------
@@ -313,7 +317,8 @@ def rounded_edge(Nxy, Nr, dx, center=[0, 0, 0], orientation=[1, 0, 0]):
313317

314318

315319
def edge(Nxy, dx, center=[0, 0, 0], orientation=[1, 0, 0]):
316-
"""Get secondary source distribution along the xy-axis with sharp edge at the origin.
320+
"""Return secondary source distribution along the xy-axis with sharp
321+
edge at the origin.
317322
318323
Parameters
319324
----------
@@ -365,7 +370,7 @@ def edge(Nxy, dx, center=[0, 0, 0], orientation=[1, 0, 0]):
365370

366371

367372
def planar(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
368-
"""Get planar secondary source distribtion.
373+
"""Return planar secondary source distribtion.
369374
370375
Parameters
371376
----------
@@ -389,7 +394,9 @@ def planar(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
389394
.. plot::
390395
:context: close-figs
391396
392-
x0, n0, a0 = sfs.array.planar((4,3), 0.5, center=[0, 0, 0], orientation=[0, 0, 1])
397+
x0, n0, a0 = sfs.array.planar(
398+
N=(4,3), spacing=0.5,
399+
center=[0, 0, 0], orientation=[0, 0, 1])
393400
sfs.plot.loudspeaker_2d(x0, n0, a0)
394401
plt.axis('equal')
395402
plt.xlabel('x / m')
@@ -409,7 +416,7 @@ def planar(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
409416

410417

411418
def cube(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
412-
"""Get cube-shaped secondary source distribtion.
419+
"""Return cube-shaped secondary source distribtion.
413420
414421
Parameters
415422
----------
@@ -433,7 +440,9 @@ def cube(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
433440
.. plot::
434441
:context: close-figs
435442
436-
x0, n0, a0 = sfs.array.cube(2, 0.5, center=[0, 0, 0], orientation=[1, 0, 0])
443+
x0, n0, a0 = sfs.array.cube(
444+
N=2, spacing=0.5,
445+
center=[0, 0, 0], orientation=[1, 0, 0])
437446
sfs.plot.loudspeaker_2d(x0, n0, a0)
438447
plt.axis('equal')
439448
plt.xlabel('x / m')
@@ -462,8 +471,8 @@ def cube(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
462471
def sphere_load(file, radius, center=[0, 0, 0]):
463472
"""Load spherical secondary source distribution from file.
464473
465-
ASCII Format (see MATLAB SFS Toolbox) with 4 numbers (3 for the cartesian
466-
position vector, 1 for the integration weight) per secondary source located
474+
ASCII Format (see MATLAB SFS Toolbox) with 4 numbers (3 for the cartesian
475+
position vector, 1 for the integration weight) per secondary source located
467476
on the unit circle which is resized by the given radius and shifted to the
468477
given center.
469478
@@ -474,7 +483,7 @@ def sphere_load(file, radius, center=[0, 0, 0]):
474483
475484
Examples
476485
--------
477-
content of `example_array_6LS_3D.txt`
486+
content of example_array_6LS_3D.txt
478487
::
479488
1 0 0 1
480489
-1 0 0 1
@@ -489,12 +498,15 @@ def sphere_load(file, radius, center=[0, 0, 0]):
489498
.. plot::
490499
:context: close-figs
491500
492-
x0, n0, a0 = sfs.array.sphere_load('../data/arrays/example_array_6LS_3D.txt', radius=2, center=[0, 0, 0])
501+
x0, n0, a0 = sfs.array.sphere_load(
502+
'../data/arrays/example_array_6LS_3D.txt',
503+
radius=2,
504+
center=[0, 0, 0])
493505
sfs.plot.loudspeaker_2d(x0, n0, a0, size=0.25)
494506
plt.axis('equal')
495507
plt.xlabel('x / m')
496508
plt.ylabel('y / m')
497-
plt.title('view onto xy-plane')
509+
plt.title('view onto xy-plane')
498510
499511
"""
500512
data = np.loadtxt(file)
@@ -509,7 +521,7 @@ def load(file, center=[0, 0, 0], orientation=[1, 0, 0]):
509521
"""Load secondary source distribution from file.
510522
511523
Comma Separated Values (CSV) format with 7 values
512-
(3 for the cartesian position vector, 3 for the cartesian inward normal
524+
(3 for the cartesian position vector, 3 for the cartesian inward normal
513525
vector, 1 for the integration weight) per secondary source.
514526
515527
Returns
@@ -519,7 +531,7 @@ def load(file, center=[0, 0, 0], orientation=[1, 0, 0]):
519531
520532
Examples
521533
--------
522-
content of `example_array_4LS_2D.csv`
534+
content of example_array_4LS_2D.csv
523535
::
524536
1,0,0,-1,0,0,1
525537
0,1,0,0,-1,0,1
@@ -538,6 +550,17 @@ def load(file, center=[0, 0, 0], orientation=[1, 0, 0]):
538550
plt.xlabel('x / m')
539551
plt.ylabel('y / m')
540552
553+
.. plot::
554+
:context: close-figs
555+
556+
x0, n0, a0 = sfs.array.load(
557+
'../data/arrays/wfs_university_rostock_2018.csv')
558+
sfs.plot.loudspeaker_2d(x0, n0, a0)
559+
plt.axis('equal')
560+
plt.xlabel('x / m')
561+
plt.ylabel('y / m')
562+
plt.title('top view of 64 channel WFS system at university of Rostock')
563+
541564
"""
542565
data = np.loadtxt(file, delimiter=',')
543566
positions, normals, weights = data[:, :3], data[:, 3:6], data[:, 6]
@@ -574,7 +597,7 @@ def weights_midpoint(positions, closed):
574597
>>> import sfs
575598
>>> x0, n0, a0 = sfs.array.circular(2**5, 1)
576599
>>> a = sfs.array.weights_midpoint(x0, closed=True)
577-
>>> print(max(abs(a0-a)))
600+
>>> max(abs(a0-a))
578601
0.0003152601902411123
579602
580603
"""
@@ -616,7 +639,8 @@ def concatenate(*arrays):
616639
Returns
617640
-------
618641
`ArrayData`
619-
Positions, orientations and weights of the concatenated secondary sources.
642+
Positions, orientations and weights
643+
of the concatenated secondary sources.
620644
621645
Examples
622646
--------

0 commit comments

Comments
 (0)