Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ adheres to `Semantic Versioning <http://semver.org/spec/v2.0.0.html>`_.
`Unreleased`_
-------------

Nothing yet.
Fixed
~~~~~

- `spiral_2D_array` now correctly uses the ``center`` parameter. Previously, it always returned the array at the origin. (`#413 <https://github.com/LCAV/pyroomacoustics/issues/413>`_).


`0.10.1`_ - 2026-05-01
Expand Down
2 changes: 1 addition & 1 deletion pyroomacoustics/beamforming.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def spiral_2D_array(center, M, radius=1.0, divi=3, angle=None):
pos_mic_x = pos_array_norm * np.cos(pos_array_angle)
pos_mic_y = pos_array_norm * np.sin(pos_array_angle)

return np.array([pos_mic_x, pos_mic_y])
return np.array(center)[:, np.newaxis] + np.array([pos_mic_x, pos_mic_y])


def fir_approximation_ls(weights, T, n1, n2):
Expand Down
29 changes: 29 additions & 0 deletions tests/test_issue_413.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import numpy as np

import pyroomacoustics as pra


def test_spiral_2d_array_center():
"""Test that spiral_2D_array correctly uses the center parameter."""

# Test with fixed angle to avoid random variance
angle = 0.3

# Array at origin
arr0 = pra.spiral_2D_array([0, 0], 10, radius=1.0, divi=3, angle=angle)

# Same array shifted
center = np.array([2.5, -1.5])
arr_shifted = pra.spiral_2D_array(center, 10, radius=1.0, divi=3, angle=angle)

# Every point should be shifted by exactly the center offset
np.testing.assert_allclose(arr_shifted[0] - arr0[0], center[0])
np.testing.assert_allclose(arr_shifted[1] - arr0[1], center[1])

# Test single point (M=1) — should be at center
arr_single = pra.spiral_2D_array([5.0, -3.0], 1, radius=2.0, angle=0.0)
np.testing.assert_allclose(arr_single.ravel(), [5.0, -3.0])

# Test that center as list also works
arr_list = pra.spiral_2D_array([1.0, 2.0], 4, radius=0.5, divi=2, angle=0.0)
assert arr_list.shape == (2, 4)
Loading