Skip to content

Commit 2bc70e9

Browse files
committed
Consistent nomenclature for secondary source distance
1 parent 84de59f commit 2bc70e9

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

sfs/array.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def rectangular(N, spacing, *, center=[0, 0, 0], orientation=[1, 0, 0]):
289289
return SecondarySourceDistribution(positions, normals, weights)
290290

291291

292-
def rounded_edge(Nxy, Nr, dx, *, center=[0, 0, 0], orientation=[1, 0, 0]):
292+
def rounded_edge(Nxy, Nr, spacing, *, center=[0, 0, 0], orientation=[1, 0, 0]):
293293
"""Return SSD along the xy-axis with rounded edge at the origin.
294294
295295
Parameters
@@ -299,6 +299,8 @@ def rounded_edge(Nxy, Nr, dx, *, center=[0, 0, 0], orientation=[1, 0, 0]):
299299
Nr : int
300300
Number of secondary sources in rounded edge. Radius of edge is
301301
adjusted to equdistant sampling along entire array.
302+
spacing : float
303+
Distance (in metres) between secondary sources.
302304
center : (3,) array_like, optional
303305
Position of edge.
304306
orientation : (3,) array_like, optional
@@ -323,10 +325,11 @@ def rounded_edge(Nxy, Nr, dx, *, center=[0, 0, 0], orientation=[1, 0, 0]):
323325
"""
324326
# radius of rounded edge
325327
Nr += 1
326-
R = 2/_np.pi * Nr * dx
328+
R = 2/_np.pi * Nr * spacing
327329

328330
# array along y-axis
329-
x00, n00, a00 = linear(Nxy, dx, center=[0, Nxy//2*dx+dx/2+R, 0])
331+
x00, n00, a00 = linear(Nxy, spacing,
332+
center=[0, Nxy//2*spacing+spacing/2+R, 0])
330333
x00 = _np.flipud(x00)
331334
positions = x00
332335
directions = n00
@@ -342,13 +345,14 @@ def rounded_edge(Nxy, Nr, dx, *, center=[0, 0, 0], orientation=[1, 0, 0]):
342345
x00[n, 1] = R * (1 - _np.sin(alpha))
343346
n00[n, 0] = _np.cos(alpha)
344347
n00[n, 1] = _np.sin(alpha)
345-
a00[n] = dx
348+
a00[n] = spacing
346349
positions = _np.concatenate((positions, x00))
347350
directions = _np.concatenate((directions, n00))
348351
weights = _np.concatenate((weights, a00))
349352

350353
# array along x-axis
351-
x00, n00, a00 = linear(Nxy, dx, center=[Nxy//2*dx-dx/2+R, 0, 0],
354+
x00, n00, a00 = linear(Nxy, spacing,
355+
center=[Nxy//2*spacing-spacing/2+R, 0, 0],
352356
orientation=[0, 1, 0])
353357
x00 = _np.flipud(x00)
354358
positions = _np.concatenate((positions, x00))
@@ -363,13 +367,15 @@ def rounded_edge(Nxy, Nr, dx, *, center=[0, 0, 0], orientation=[1, 0, 0]):
363367
return SecondarySourceDistribution(positions, directions, weights)
364368

365369

366-
def edge(Nxy, dx, *, center=[0, 0, 0], orientation=[1, 0, 0]):
370+
def edge(Nxy, spacing, *, center=[0, 0, 0], orientation=[1, 0, 0]):
367371
"""Return SSD along the xy-axis with sharp edge at the origin.
368372
369373
Parameters
370374
----------
371375
Nxy : int
372376
Number of secondary sources along x- and y-axis.
377+
spacing : float
378+
Distance (in metres) between secondary sources.
373379
center : (3,) array_like, optional
374380
Position of edge.
375381
orientation : (3,) array_like, optional
@@ -393,14 +399,16 @@ def edge(Nxy, dx, *, center=[0, 0, 0], orientation=[1, 0, 0]):
393399
394400
"""
395401
# array along y-axis
396-
x00, n00, a00 = linear(Nxy, dx, center=[0, Nxy//2*dx+dx/2, 0])
402+
x00, n00, a00 = linear(Nxy, spacing,
403+
center=[0, Nxy//2*spacing+spacing/2, 0])
397404
x00 = _np.flipud(x00)
398405
positions = x00
399406
directions = n00
400407
weights = a00
401408

402409
# array along x-axis
403-
x00, n00, a00 = linear(Nxy, dx, center=[Nxy//2*dx-dx/2, 0, 0],
410+
x00, n00, a00 = linear(Nxy, spacing,
411+
center=[Nxy//2*spacing-spacing/2, 0, 0],
404412
orientation=[0, 1, 0])
405413
x00 = _np.flipud(x00)
406414
positions = _np.concatenate((positions, x00))

0 commit comments

Comments
 (0)