def doa(self, receiver, source):
''' Computes the direction of arrival wrt a source and receiver '''
s_ind = self.key2ind(source)
r_ind = self.key2ind(receiver)
# vector from receiver to source
v = self.X[:,s_ind] - self.X[:,r_ind]
azimuth = np.arctan2(v[1], v[0])
elevation = np.arctan2(v[2], la.norm(v[:2]))
azimuth = azimuth + 2*np.pi if azimuth < 0. else azimuth
elevation = elevation + 2*np.pi if elevation < 0. else elevation
return np.array([azimuth, elevation])
评论列表
文章目录