Processing

Script for radar signal processing

This script requires that numpy and scipy be installed within the Python environment you are running this script in.

██████╗  █████╗ ██████╗  █████╗ ██████╗ ███████╗██╗███╗   ███╗██╗  ██╗
██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔══██╗██╔════╝██║████╗ ████║╚██╗██╔╝
██████╔╝███████║██║  ██║███████║██████╔╝███████╗██║██╔████╔██║ ╚███╔╝ 
██╔══██╗██╔══██║██║  ██║██╔══██║██╔══██╗╚════██║██║██║╚██╔╝██║ ██╔██╗ 
██║  ██║██║  ██║██████╔╝██║  ██║██║  ██║███████║██║██║ ╚═╝ ██║██╔╝ ██╗
╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚═╝╚═╝     ╚═╝╚═╝  ╚═╝
radarsimpy.processing.cfar_ca_1d(data, guard, trailing, pfa=1e-05, axis=0, detector='squarelaw', offset=None)[source]

1-D Cell Averaging CFAR (CA-CFAR)

Parameters:
  • data (numpy.1darray or numpy.2darray) – Amplitude/Power data. Amplitude data for linear detector, Power data for squarelaw detector

  • guard (int) – Number of guard cells on one side, total guard cells are 2*guard

  • trailing (int) – Number of trailing cells on one side, total trailing cells are 2*trailing

  • pfa (float) – Probability of false alarm. default 1e-5

  • axis (int) – The axis to calculat CFAR. default 0

  • detector (str) – Detector type, linear or squarelaw. default squarelaw

  • offset (float) – CFAR threshold offset. If offect is None, threshold offset is 2*trailing(pfa^(-1/2/trailing)-1). default None

Returns:

CFAR threshold. The dimension is the same as data

Return type:

numpy.1darray or numpy.2darray

radarsimpy.processing.cfar_ca_2d(data, guard, trailing, pfa=1e-05, detector='squarelaw', offset=None)[source]

2-D Cell Averaging CFAR (CA-CFAR)

Parameters:
  • data (numpy.1darray or numpy.2darray) – Amplitude/Power data. Amplitude data for linear detector, Power data for squarelaw detector

  • guard (int or list[int]) – Number of guard cells on one side, total guard cells are 2*guard. When guard is a list, guard[0] is for axis 0, and guard[1] is for axis 1. If guard is a number, axis 0 and axis 1 are the same

  • trailing (int or list[int]) – Number of trailing cells on one side, total trailing cells are 2*trailing. When trailing is a list, trailing[0] is for axis 0, and trailing[1] is for axis 1. If trailing is a number, axis 0 and axis 1 are the same

  • pfa (float) – Probability of false alarm. default 1e-5

  • detector (str) – Detector type, linear or squarelaw. default squarelaw

  • offset (float) – CFAR threshold offset. If offect is None, threshold offset is 2*trailing(pfa^(-1/2/trailing)-1). default None

Returns:

CFAR threshold. The dimension is the same as data

Return type:

numpy.1darray or numpy.2darray

radarsimpy.processing.cfar_os_1d(data, guard, trailing, k, pfa=1e-05, axis=0, detector='squarelaw', offset=None)[source]

1-D Ordered Statistic CFAR (OS-CFAR)

For edge cells, use rollovered cells to fill the missing cells.

Parameters:
  • data (numpy.1darray or numpy.2darray) – Amplitude/Power data. Amplitude data for linear detector, Power data for squarelaw detector

  • guard (int) – Number of guard cells on one side, total guard cells are 2*guard

  • trailing (int) – Number of trailing cells on one side, total trailing cells are 2*trailing

  • k (int) – Rank in the order. k is usuall chosen to satisfy N/2 < k < N. Typically, k is on the order of 0.75N

  • pfa (float) – Probability of false alarm. default 1e-5

  • axis (int) – The axis to calculat CFAR. default 0

  • detector (str) – Detector type, linear or squarelaw. default squarelaw

  • offset (float) – CFAR threshold offset. If offect is None, threshold offset is calculated from pfa. default None

Returns:

CFAR threshold. The dimension is the same as data

Return type:

numpy.1darray or numpy.2darray

Reference

[1] H. Rohling, “Radar CFAR Thresholding in Clutter and Multiple Target Situations,” IEEE Trans. Aerosp. Electron. Syst., vol. AES-19, no. 4, pp. 608-621, 1983.

radarsimpy.processing.cfar_os_2d(data, guard, trailing, k, pfa=1e-05, detector='squarelaw', offset=None)[source]

2-D Ordered Statistic CFAR (OS-CFAR)

For edge cells, use rollovered cells to fill the missing cells.

Parameters:
  • data (numpy.1darray or numpy.2darray) – Amplitude/Power data. Amplitude data for linear detector, Power data for squarelaw detector

  • guard (int or list[int]) – Number of guard cells on one side, total guard cells are 2*guard. When guard is a list, guard[0] is for axis 0, and guard[1] is for axis 1. If guard is a number, axis 0 and axis 1 are the same

  • trailing (int or list[int]) – Number of trailing cells on one side, total trailing cells are 2*trailing. When trailing is a list, trailing[0] is for axis 0, and trailing[1] is for axis 1. If trailing is a number, axis 0 and axis 1 are the same

  • k (int) – Rank in the order. k is usuall chosen to satisfy N/2 < k < N. Typically, k is on the order of 0.75N

  • pfa (float) – Probability of false alarm. default 1e-5

  • detector (str) – Detector type, linear or squarelaw. default squarelaw

  • offset (float) – CFAR threshold offset. If offect is None, threshold offset is calculated from pfa. default None

Returns:

CFAR threshold. The dimension is the same as data

Return type:

numpy.1darray or numpy.2darray

Reference

[1] H. Rohling, “Radar CFAR Thresholding in Clutter and Multiple Target Situations,” IEEE Trans. Aerosp. Electron. Syst., vol. AES-19, no. 4, pp. 608-621, 1983.

radarsimpy.processing.doa_bartlett(covmat, spacing=0.5, scanangles=range(-90, 91))[source]

Bartlett beamforming for a uniform linear array (ULA)

Parameters:
  • covmat (numpy.2darray) – Sensor covariance matrix, specified as a complex-valued, positive- definite M-by-M matrix. The quantity M is the number of elements in the ULA array

  • spacing (float) – Distance (wavelength) between array elements. default 0.5

  • scanangles (numpy.1darray) – Broadside search angles, specified as a real-valued vector in degrees. Angles must lie in the range [-90°,90°] and must be in increasing order. ``default [-90°,90°] ``

Returns:

spectrum in dB

Return type:

numpy.1darray

radarsimpy.processing.doa_capon(covmat, spacing=0.5, scanangles=range(-90, 91))[source]

Capon (MVDR) beamforming for a uniform linear array (ULA)

Parameters:
  • covmat (numpy.2darray) – Sensor covariance matrix, specified as a complex-valued, positive- definite M-by-M matrix. The quantity M is the number of elements in the ULA array

  • spacing (float) – Distance (wavelength) between array elements. default 0.5

  • scanangles (numpy.1darray) – Broadside search angles, specified as a real-valued vector in degrees. Angles must lie in the range [-90°,90°] and must be in increasing order. ``default [-90°,90°] ``

Returns:

spectrum in dB

Return type:

numpy.1darray

radarsimpy.processing.doa_esprit(covmat, nsig, spacing=0.5)[source]

Estimate arrival directions of signals using ESPRIT for a uniform linear array (ULA)

Parameters:
  • covmat (numpy.2darray) – Sensor covariance matrix, specified as a complex-valued, positive- definite M-by-M matrix. The quantity M is the number of elements in the ULA array

  • nsig (int) – Number of arriving signals, specified as a positive integer. The number of signals must be smaller than the number of elements in the ULA array

  • spacing (float) – Distance (wavelength) between array elements. default 0.5

Returns:

doa angles in degrees

Return type:

list

radarsimpy.processing.doa_iaa(beam_vect, steering_vect, num_it=15, p_init=None)[source]

IAA-APES follows Source Localization and Sensing: A Nonparametric Iterative Adaptive Approach Based on Weighted Least Square and its notation

IAA-APES: iterative adaptive approach for amplitude and phase estimation

y(n) = A*s(n) + e(n) (n = 1,..,N snapshots)

Parameters:
  • beam_vect (numpy.2darray) – num_array X num_snap with num_array being the number of array elements and num_snap being the number of pulses/snap shots. When num_snap>1, beam_vect = [y(1),…,y(num_snap))] with y(n) - num_array X 1

  • steering_vect (numpy.2darray) – num_array X num_grid is the steering vectors matrix from array manifold. num_grid is the number of sources or the number of scanning points/grids

  • num_it (int) – number of iterations. According to the paper, IAA-APES does not provide significant improvements in performance after about 15 iterations. default 15

  • p_init (numpy.1darray) – Initial estimation. default None

Returns:

power (in dB) at each angle on the scanning grid

Return type:

numpy.1darray

radarsimpy.processing.doa_music(covmat, nsig, spacing=0.5, scanangles=range(-90, 91))[source]

Estimate arrival directions of signals using MUSIC for a uniform linear array (ULA)

Parameters:
  • covmat (numpy.2darray) – Sensor covariance matrix, specified as a complex-valued, positive- definite M-by-M matrix. The quantity M is the number of elements in the ULA array

  • nsig (int) – Number of arriving signals, specified as a positive integer. The number of signals must be smaller than the number of elements in the ULA array

  • spacing (float) – Distance (wavelength) between array elements. default 0.5

  • scanangles (numpy.1darray) – Broadside search angles, specified as a real-valued vector in degrees. Angles must lie in the range [-90°,90°] and must be in increasing order. ``default [-90°,90°] ``

Returns:

doa angles in degrees, doa index, pseudo spectrum (dB)

Return type:

list, list, numpy.1darray

radarsimpy.processing.doa_root_music(covmat, nsig, spacing=0.5)[source]

Estimate arrival directions of signals using root-MUSIC for a uniform linear array (ULA)

Parameters:
  • covmat (numpy.2darray) – Sensor covariance matrix, specified as a complex-valued, positive- definite M-by-M matrix. The quantity M is the number of elements in the ULA array

  • nsig (int) – Number of arriving signals, specified as a positive integer. The number of signals must be smaller than the number of elements in the ULA array

  • spacing (float) – Distance (wavelength) between array elements. default 0.5

Returns:

doa angles in degrees

Return type:

list

radarsimpy.processing.doppler_fft(data, dwin=None, n=None) ndarray[source]

Calculate range-Doppler matrix

Parameters:
  • data (numpy.3darray) – Range profile matrix, [channels, pulses, adc_samples]

  • dwin (numpy.1darray) – Window for FFT, length should be equal to adc_samples. (default is a square window)

  • n (int) – FFT size, if n > adc_samples, zero-padding will be applied. (default is None)

Returns:

A 3D array of range-Doppler map, [channels, Doppler, range]

Return type:

numpy.3darray

radarsimpy.processing.range_doppler_fft(data, rwin=None, dwin=None, rn=None, dn=None) ndarray[source]

Range-Doppler processing

Parameters:
  • data (numpy.3darray) – Baseband data, [channels, pulses, adc_samples]

  • rwin (numpy.1darray) – Range window for FFT, length should be equal to adc_samples. (default is a square window)

  • dwin (numpy.1darray) – Doppler window for FFT, length should be equal to adc_samples. (default is a square window)

  • rn (int) – Range FFT size, if n > adc_samples, zero-padding will be applied. (default is None)

  • dn (int) – Doppler FFT size, if n > adc_samples, zero-padding will be applied. (default is None)

Returns:

A 3D array of range-Doppler map, [channels, Doppler, range]

Return type:

numpy.3darray

radarsimpy.processing.range_fft(data, rwin=None, n=None) ndarray[source]

Calculate range profile matrix

Parameters:
  • data (numpy.3darray) – Baseband data, [channels, pulses, adc_samples]

  • rwin (numpy.1darray) – Window for FFT, length should be equal to adc_samples. (default is a square window)

  • n (int) – FFT size, if n > adc_samples, zero-padding will be applied. (default is None)

Returns:

A 3D array of range profile, [channels, pulses, range]

Return type:

numpy.3darray