@@ -84,7 +84,7 @@ def as_secondary_source_distribution(arg, **kwargs):
8484 return SecondarySourceDistribution (x , n , a )
8585
8686
87- def linear (N , spacing , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
87+ def linear (N , spacing , * , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
8888 """Return linear, equidistantly sampled secondary source distribution.
8989
9090 Parameters
@@ -119,7 +119,7 @@ def linear(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
119119 return _linear_helper (np .arange (N ) * spacing , center , orientation )
120120
121121
122- def linear_diff (distances , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
122+ def linear_diff (distances , * , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
123123 """Return linear secondary source distribution from a list of distances.
124124
125125 Parameters
@@ -152,7 +152,7 @@ def linear_diff(distances, center=[0, 0, 0], orientation=[1, 0, 0]):
152152 return _linear_helper (ycoordinates , center , orientation )
153153
154154
155- def linear_random (N , min_spacing , max_spacing , center = [0 , 0 , 0 ],
155+ def linear_random (N , min_spacing , max_spacing , * , center = [0 , 0 , 0 ],
156156 orientation = [1 , 0 , 0 ], seed = None ):
157157 """Return randomly sampled linear array.
158158
@@ -190,10 +190,10 @@ def linear_random(N, min_spacing, max_spacing, center=[0, 0, 0],
190190 """
191191 r = np .random .RandomState (seed )
192192 distances = r .uniform (min_spacing , max_spacing , size = N - 1 )
193- return linear_diff (distances , center , orientation )
193+ return linear_diff (distances , center = center , orientation = orientation )
194194
195195
196- def circular (N , R , center = [0 , 0 , 0 ]):
196+ def circular (N , R , * , center = [0 , 0 , 0 ]):
197197 """Return circular secondary source distribution parallel to the xy-plane.
198198
199199 Parameters
@@ -235,7 +235,7 @@ def circular(N, R, center=[0, 0, 0]):
235235 return SecondarySourceDistribution (positions , normals , weights )
236236
237237
238- def rectangular (N , spacing , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
238+ def rectangular (N , spacing , * , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
239239 """Return rectangular secondary source distribution.
240240
241241 Parameters
@@ -272,18 +272,22 @@ def rectangular(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
272272 offset1 = spacing * (N2 - 1 ) / 2 + spacing / np .sqrt (2 )
273273 offset2 = spacing * (N1 - 1 ) / 2 + spacing / np .sqrt (2 )
274274 positions , normals , weights = concatenate (
275- linear (N1 , spacing , [- offset1 , 0 , 0 ], [1 , 0 , 0 ]), # left
276- linear (N2 , spacing , [0 , offset2 , 0 ], [0 , - 1 , 0 ]), # upper
277- linear (N1 , spacing , [offset1 , 0 , 0 ], [- 1 , 0 , 0 ]), # right
278- linear (N2 , spacing , [0 , - offset2 , 0 ], [0 , 1 , 0 ]), # lower
275+ # left
276+ linear (N1 , spacing , center = [- offset1 , 0 , 0 ], orientation = [1 , 0 , 0 ]),
277+ # upper
278+ linear (N2 , spacing , center = [0 , offset2 , 0 ], orientation = [0 , - 1 , 0 ]),
279+ # right
280+ linear (N1 , spacing , center = [offset1 , 0 , 0 ], orientation = [- 1 , 0 , 0 ]),
281+ # lower
282+ linear (N2 , spacing , center = [0 , - offset2 , 0 ], orientation = [0 , 1 , 0 ]),
279283 )
280284 positions , normals = _rotate_array (positions , normals ,
281285 [1 , 0 , 0 ], orientation )
282286 positions += center
283287 return SecondarySourceDistribution (positions , normals , weights )
284288
285289
286- def rounded_edge (Nxy , Nr , dx , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
290+ def rounded_edge (Nxy , Nr , dx , * , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
287291 """Return SSD along the xy-axis with rounded edge at the origin.
288292
289293 Parameters
@@ -357,7 +361,7 @@ def rounded_edge(Nxy, Nr, dx, center=[0, 0, 0], orientation=[1, 0, 0]):
357361 return SecondarySourceDistribution (positions , directions , weights )
358362
359363
360- def edge (Nxy , dx , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
364+ def edge (Nxy , dx , * , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
361365 """Return SSD along the xy-axis with sharp edge at the origin.
362366
363367 Parameters
@@ -409,7 +413,7 @@ def edge(Nxy, dx, center=[0, 0, 0], orientation=[1, 0, 0]):
409413 return SecondarySourceDistribution (positions , directions , weights )
410414
411415
412- def planar (N , spacing , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
416+ def planar (N , spacing , * , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
413417 """Return planar secondary source distribtion.
414418
415419 Parameters
@@ -460,7 +464,7 @@ def planar(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
460464 return SecondarySourceDistribution (positions , normals , weights )
461465
462466
463- def cube (N , spacing , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
467+ def cube (N , spacing , * , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
464468 """Return cube-shaped secondary source distribtion.
465469
466470 Parameters
@@ -496,24 +500,31 @@ def cube(N, spacing, center=[0, 0, 0], orientation=[1, 0, 0]):
496500
497501 """
498502 N1 , N2 , N3 = (N , N , N ) if np .isscalar (N ) else N
499- offset1 = spacing * (N2 - 1 ) / 2 + spacing / np .sqrt (2 )
500- offset2 = spacing * (N1 - 1 ) / 2 + spacing / np .sqrt (2 )
501- offset3 = spacing * (N3 - 1 ) / 2 + spacing / np .sqrt (2 )
503+ d = spacing
504+ offset1 = d * (N2 - 1 ) / 2 + d / np .sqrt (2 )
505+ offset2 = d * (N1 - 1 ) / 2 + d / np .sqrt (2 )
506+ offset3 = d * (N3 - 1 ) / 2 + d / np .sqrt (2 )
502507 positions , directions , weights = concatenate (
503- planar ((N1 , N3 ), spacing , [- offset1 , 0 , 0 ], [1 , 0 , 0 ]), # west
504- planar ((N2 , N3 ), spacing , [0 , offset2 , 0 ], [0 , - 1 , 0 ]), # north
505- planar ((N1 , N3 ), spacing , [offset1 , 0 , 0 ], [- 1 , 0 , 0 ]), # east
506- planar ((N2 , N3 ), spacing , [0 , - offset2 , 0 ], [0 , 1 , 0 ]), # south
507- planar ((N2 , N1 ), spacing , [0 , 0 , - offset3 ], [0 , 0 , 1 ]), # bottom
508- planar ((N2 , N1 ), spacing , [0 , 0 , offset3 ], [0 , 0 , - 1 ]), # top
508+ # west
509+ planar ((N1 , N3 ), d , center = [- offset1 , 0 , 0 ], orientation = [1 , 0 , 0 ]),
510+ # north
511+ planar ((N2 , N3 ), d , center = [0 , offset2 , 0 ], orientation = [0 , - 1 , 0 ]),
512+ # east
513+ planar ((N1 , N3 ), d , center = [offset1 , 0 , 0 ], orientation = [- 1 , 0 , 0 ]),
514+ # south
515+ planar ((N2 , N3 ), d , center = [0 , - offset2 , 0 ], orientation = [0 , 1 , 0 ]),
516+ # bottom
517+ planar ((N2 , N1 ), d , center = [0 , 0 , - offset3 ], orientation = [0 , 0 , 1 ]),
518+ # top
519+ planar ((N2 , N1 ), d , center = [0 , 0 , offset3 ], orientation = [0 , 0 , - 1 ]),
509520 )
510521 positions , directions = _rotate_array (positions , directions ,
511522 [1 , 0 , 0 ], orientation )
512523 positions += center
513524 return SecondarySourceDistribution (positions , directions , weights )
514525
515526
516- def sphere_load (file , radius , center = [0 , 0 , 0 ]):
527+ def sphere_load (file , radius , * , center = [0 , 0 , 0 ]):
517528 """Load spherical secondary source distribution from file.
518529
519530 ASCII Format (see MATLAB SFS Toolbox) with 4 numbers (3 for the cartesian
@@ -562,7 +573,7 @@ def sphere_load(file, radius, center=[0, 0, 0]):
562573 return SecondarySourceDistribution (positions , normals , weights )
563574
564575
565- def load (file , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
576+ def load (file , * , center = [0 , 0 , 0 ], orientation = [1 , 0 , 0 ]):
566577 """Load secondary source distribution from file.
567578
568579 Comma Separated Values (CSV) format with 7 values
@@ -615,7 +626,7 @@ def load(file, center=[0, 0, 0], orientation=[1, 0, 0]):
615626 return SecondarySourceDistribution (positions , normals , weights )
616627
617628
618- def weights_midpoint (positions , closed ):
629+ def weights_midpoint (positions , * , closed ):
619630 """Calculate loudspeaker weights for a simply connected array.
620631
621632 The weights are calculated according to the midpoint rule.
0 commit comments