# mmwave.dsp.compensation¶

mmwave.dsp.compensation.add_doppler_compensation(input_data, num_tx_antennas, doppler_indices=None, num_doppler_bins=None)

Compensation of Doppler phase shift in the virtual antennas.

Compensation of Doppler phase shift on the virtual antennas (corresponding to second or third Tx antenna chirps). Symbols corresponding to virtual antennas, are rotated by half of the Doppler phase shift measured by Doppler FFT for 2 Tx system and 1/3 and 2/3 of the Doppler phase shift for 3 Tx system. The phase shift read from the table using half or 1/3 of the object Doppler index value. If the Doppler index is odd, an extra half of the bin phase shift is added.

The original function is called per detected objects. This functions is modified to directly compensate the azimuth_in matrix (numDetObj, num_angle_bins)

Parameters: input_data (ndarray) – (range, num_antennas, doppler) Radar data cube that needs to be compensated. It can be the input of azimuth FFT after CFAR or the intermediate right before beamforming. num_tx_antennas (int) – Number of transmitters. num_doppler_bins (int) – (Optional) Number of doppler bins in the radar data cube. If given, that means the doppler indices are signed and needs to be converted to unsigned. doppler_indices (ndarray) – (Optional) Doppler index of the object with the shape of (num_detected_objects). If given, that means we only compensate on selected doppler bins. Original input data with the columns related to virtual receivers got compensated. input_data (ndarray)

Example

>>> # If the compensation is done right before naive azimuth FFT and objects is detected already. you need to
>>> # feed in the doppler_indices
>>> dataIn = add_doppler_compensation(dataIn, 3, doppler_indices, 128)

mmwave.dsp.compensation.rx_channel_phase_bias_compensation(rx_channel_compensations, input, num_antennas)

Compensation of rx channel phase bias.

Parameters: rx_channel_compensations – rx channel compensation coefficient. input – complex number. num_antennas – number of symbols.
mmwave.dsp.compensation.near_field_correction(idx, detected_objects, start_range_index, end_range_index, azimuth_input, azimuth_output, num_angle_bins, num_rx_antennas, range_resolution)

Correct phase error as the far-field plane wave assumption breaks.

Calculates near field correction for input detected index (corresponding to a range position). Referring to top level doxygen @ref nearFieldImplementation, this function performs the Set 1 rotation with the correction and adds to Set 0 in place to produce result in Set 0 of the azimuth_output.

This correction is done per detected objects from CFAR detection

Parameters: idx – index of the detected objects in detected_objects. detected_objects – detected objects matrix with dimension of 100 x 6, where it holds at most 100 objects and 6 members are rangeIdx, dopplerIdx, peakVal, x, y and z. It is configured as a structured array. start_range_index – start range index of near field correction. end_range_index – end range index of near field correction. azimuth_input – complex array of which length is num_angle_bins+numVirtualAntAzim, where numVirtualAntAzim = 4, 8 or 12 depending on how many Txs are used. None. azimuth_output is changed in-place.
mmwave.dsp.compensation.dc_range_signature_removal(fft_out1_d, positive_bin_idx, negative_bin_idx, calib_dc_range_sig_cfg, num_tx_antennas, num_chirps_per_frame)

Compensation of DC range antenna signature.

Antenna coupling signature dominates the range bins close to the radar. These are the bins in the range FFT output located around DC. This feature is under user control in terms of enable/disable and start/end range bins through a CLI command called calibDcRangeSig. During measurement (when the CLI command is issued with feature enabled), each of the specified range bins for each of the virtual antennas are accumulated over the specified number of chirps and at the end of the period, the average is computed for each bin/antenna combination for removal after the measurement period is over. Note that the number of chirps to average must be power of 2. It is assumed that no objects are present in the vicinity of the radar during this measurement period. After measurement is done, the removal starts for all subsequent frames during which each of the bin/antenna average estimate is subtracted from the corresponding received samples in real-time for subsequent processing.

This function has a measurement phase while calib_dc_range_sig_cfg.counter is less than the preferred value and calibration phase afterwards. The original function is performed per chirp. Here it is modified to be called per frame.

Parameters: fft_out1_d – (num_chirps_per_frame, num_rx_antennas, numRangeBins). Output of 1D FFT. positive_bin_idx – the first positive_bin_idx range bins (inclusive) to be compensated. negative_bin_idx – the last -negative_bin_idx range bins to be compensated. calib_dc_range_sig_cfg – a simple class for calibration configuration’s storing purpose. num_tx_antennas – number of transmitters. num_chirps_per_frame – number of total chirps per frame. None. fft_out1_d is modified in-place.
mmwave.dsp.compensation.clutter_removal(input_val, axis=0)

Perform basic static clutter removal by removing the mean from the input_val on the specified doppler axis.

Parameters: input_val (ndarray) – Array to perform static clutter removal on. Usually applied before performing doppler FFT. e.g. [num_chirps, num_vx_antennas, num_samples], it is applied along the first axis. axis (int) – Axis to calculate mean of pre-doppler. Array with static clutter removed. ndarray