DOA Utilities

This module contains useful functions to compute distances and errors on on circles and spheres.

pyroomacoustics.doa.utils.circ_dist(azimuth1, azimuth2, r=1.0)

Returns the shortest distance between two points on a circle

Parameters:
  • azimuth1 – azimuth of point 1
  • azimuth2 – azimuth of point 2
  • r (optional) – radius of the circle (Default 1)
pyroomacoustics.doa.utils.great_circ_dist(r, colatitude1, azimuth1, colatitude2, azimuth2)

calculate great circle distance for points located on a sphere

Parameters:
  • r (radius of the sphere) –
  • colatitude1 (colatitude of point 1) –
  • azimuth1 (azimuth of point 1) –
  • colatitude2 (colatitude of point 2) –
  • azimuth2 (azimuth of point 2) –
Returns:

great-circle distance

Return type:

float or ndarray

pyroomacoustics.doa.utils.polar_distance(x1, x2)

Given two arrays of numbers x1 and x2, pairs the cells that are the closest and provides the pairing matrix index: x1(index(1,:)) should be as close as possible to x2(index(2,:)). The function outputs the average of the absolute value of the differences abs(x1(index(1,:))-x2(index(2,:))).

Parameters:
  • x1 – vector 1
  • x2 – vector 2
Returns:

  • d – minimum distance between d
  • index – the permutation matrix

pyroomacoustics.doa.utils.spher2cart(r, azimuth, colatitude)

Convert a spherical point to cartesian coordinates.

Parameters:
  • r – radius
  • azimuth – azimuth
  • colatitude – colatitude
Returns:

An ndarray containing the Cartesian coordinates of the points its columns

Return type:

ndarray