# Processing¶

radarsimpy.processing.cfar_ca_1d(data, guard, trailing, pfa=1e-05, axis=0, offset=None)

1-D Cell Averaging CFAR (CA-CFAR)

Parameters:
• data (numpy.1darray or numpy.2darray) – Radar data

• 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`

• 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

2-D Cell Averaging CFAR (CA-CFAR)

Parameters:
• data (numpy.1darray or numpy.2darray) – Radar data

• guard (int or list[int]) – Number of guard cells on one side, total guard cells are `2*guard`. When `guard` is a list, `guard` is for axis 0, and `guard` 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` is for axis 0, and `trailing` 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`

• 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, offset=None)

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) – Radar data

• 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`

• 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

 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, offset=None)

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) – Radar data

• guard (int or list[int]) – Number of guard cells on one side, total guard cells are `2*guard`. When `guard` is a list, `guard` is for axis 0, and `guard` 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` is for axis 0, and `trailing` 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`

• 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

 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.

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

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

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

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

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

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

Convert cartesian coordinate to polar

Parameters:
• image (numpy.2darray) – Data with cartesian coordinate, [range, angle]

• range_bins (int) – Number of range bins

• angle_bins (int) – Number of angle bins

• fov_deg (float) – Field of view (deg)

Returns:

A 2D image with polar coordinate

Return type:

numpy.2darray

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

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