corr_woofer['11'] = np.dot(R_30_y, corr_woofer['11']) corr_woofer['8'] = np.dot(R_30_y.T, corr_woofer['8']) corr_woofer['13'] = np.dot(R_30_x, corr_woofer['13']) corr_woofer['14'] = np.dot(R_30_x.T, corr_woofer['14']) # Now make two sets of markers for twitters and woofers twitters = markers.copy() woofers = markers.copy() # Apply the correction vectors twitters.correct(corr_twitter) woofers.correct(corr_woofer) if __name__ == "__main__": from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt # Plot all the markers in the same figure to check all the locations are correct fig = plt.figure() axes = fig.add_subplot(111, projection='3d') twitters.plot(axes=axes, c='b', marker='s') woofers.plot(axes=axes, c='r', marker='<') markers.plot(axes=axes, c='k', marker='.') print 'DoA of Speaker 5 to FPGA:', twitters.doa('FPGA','5')/np.pi*180.,'degrees' plt.show()
from point_cloud import PointCloud from speakers_microphones_locations import * from arrays import * # FPGA array reference point offset R = R_pyramic ref_pt_offset = 0.01 # meters # Adjust the z-offset of Pyramic R[2, :] += ref_pt_offset - R[2, 0] # Localize microphones in new reference frame R += twitters[['FPGA']] # correct FPGA reference point to be at the center of the array twitters.X[:, twitters.key2ind('FPGA')] = R.mean(axis=1) # Now we can try to visualize the geometry pyramic = PointCloud(X=R) # Plot all the markers in the same figure to check all the locations are correct fig = plt.figure() axes = fig.add_subplot(111, projection='3d') twitters.plot(axes=axes, c='k', marker='s') pyramic.plot(axes=axes, show_labels=False, c='r', marker='.') plt.show()