DOA Utilities¶
This module contains useful functions to compute distances and errors on on circles and spheres.
- pyroomacoustics.doa.utils.cart2spher(vectors)¶
- Parameters
vectors (array_like, shape (3, n_vectors)) – The vectors to transform
- Returns
azimuth (numpy.ndarray, shape (n_vectors,)) – The azimuth of the vectors
colatitude (numpy.ndarray, shape (n_vectors,)) – The colatitude of the vectors
r (numpy.ndarray, shape (n_vectors,)) – The length of the vectors
- 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(azimuth, colatitude=None, r=1, degrees=False)¶
Convert a spherical point to cartesian coordinates.
- Parameters
azimuth – azimuth
colatitude – colatitude
r – radius
degrees – Returns values in degrees instead of radians if set to
True
- Returns
An ndarray containing the Cartesian coordinates of the points as its columns.
- Return type
ndarray