2022-06-07 18:36:52.304101: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2022-06-07 18:36:52.304159: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

cov_matrix[source]

cov_matrix(x)

Computes the covariance matrix $R_{xx}$ on signal x

$$ R_{xx} = xx^H $$

x can be batched. Hermitian transpose and matrix multiply applied on the last 2 dimensions

forward_backward_avg[source]

forward_backward_avg(Rxx)

Forward-Backward Averaging of covariance matrix Rxx

M. Zatman and D. Marshall, "Forward-backward averaging in the presence of array manifold errors," in IEEE Transactions on Antennas and Propagation, vol. 46, no. 11, pp. 1700-1704, Nov. 1998, doi: 10.1109/8.736625.

Inputs:

  • Rxx: Batch of covariance matrices [N, m, m]

aoa_capon[source]

aoa_capon(x, steering_vec, mu=1e-07)

Tensorflow implementation of Capon AoA estimatation

Inputs:

  • x: signal to be beamformed. [N, n_rx, n_samples]
  • steering_vec: Vandermode steering vector [n_angle_bins, n_rx]
  • mu: detuning factor, if $R_{xx}$ is singular, ensures that linalg.inv gives stable results.

Outputs:

  • den: denominator of Capon beamforming equation, i.e. $a(\theta)^*R_{xx}^{-1}a(\theta)^T$
  • weights: tuning weights for each antenna

Example Usage

import matplotlib.pyplot as plt
import numpy as np

from radicalsdk.h5dataset import H5DatasetLoader
from radicalsdk.radar.config_v1 import read_radar_params
from radicalsdk.radar.v1 import RadarFrame

data = H5DatasetLoader('../samples/indoor_sample_50.h5')

# Read config and configure RadarFrame object
radar_config = read_radar_params('../samples/indoor_human_rcs.cfg')
rf = RadarFrame(radar_config)
FRAME_IDX = 2
mmwave_range_az = rf.compute_range_azimuth(data['radar'][FRAME_IDX])
range_cube = rf.range_cube.copy()

Reference implementation in NumPy

plt.figure(figsize=(5, 10))
plt.imshow(np.log(np.abs(rf.compute_range_azimuth(data['radar'][FRAME_IDX]))))
plt.show()

Full Tensorflow implementation

spectrum, weights = aoa_capon(
    range_cube, 
    steering_vec=tf.cast(rf.steering_vec, tf.complex128),
    mu = None
)

plt.figure(figsize=(5, 10))
plt.imshow(np.fliplr(np.flipud(np.log(np.abs(spectrum)))))
plt.show()