Skip to content

Commit

Permalink
Changes the KDTree in MeasuredDirectivity from operating on spherical…
Browse files Browse the repository at this point in the history
… to cartesian coordinates. Re-generates the test file after visual inspection.
  • Loading branch information
fakufaku committed May 27, 2024
1 parent d392bb6 commit d48a899
Show file tree
Hide file tree
Showing 45 changed files with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pyroomacoustics/directivities/measured.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ def __init__(self, orientation, grid, impulse_responses, fs):
if not isinstance(grid, Grid):
raise ValueError("Grid must be a Grid object")

self._orientation = orientation
self._original_grid = grid
self._irs = impulse_responses
self.fs = fs

# set the initial orientation
self.set_orientation(self._orientation)
self.set_orientation(orientation)

@property
def is_impulse_response(self):
Expand Down Expand Up @@ -72,7 +71,7 @@ def set_orientation(self, orientation):
cartesian_points=self._orientation.rotate(self._original_grid.cartesian)
)
# create the kd-tree
self._kdtree = cKDTree(self._grid.spherical.T)
self._kdtree = cKDTree(self._grid.cartesian.T)

def get_response(
self, azimuth, colatitude=None, magnitude=False, frequency=None, degrees=True
Expand All @@ -97,7 +96,9 @@ def get_response(
azimuth = np.radians(azimuth)
colatitude = np.radians(colatitude)

_, index = self._kdtree.query(np.column_stack((azimuth, colatitude)))
cart = spher2cart(azimuth, colatitude)

_, index = self._kdtree.query(cart.T)
return self._irs[index, :]

@requires_matplotlib
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit d48a899

Please sign in to comment.