Radar package

RadarFcnLib module

This module is intended for defining all radar functions from configuring, controling, running the radar, and reading DCA1000 packets down to obtaining different maps and higher layer of signal processing. Each function is compared against the Matlab outputs or it is tested within Python by a sample data.

Tracking UPDATES:

Date

Description

March-6-2019

Function annotations are added.

March-6-2019

Unnecessary initial variables are removed in unpackDCApayload.

March-6-2019

Timers are commented in readADCbits. These are for tracking the execution time.

March-10-2019

packetReorderZeroFilling considers the cases where zero filling process fills the buffer more than one round.

March-10-2019

readADCbits assumes that the received byte stream is flattened in contrast to what was assumed before.

March-12-2019

readADCbits should do np.reshape by F order otherwise the samples of each channel will be interleaved.

March-12-2019

FormingVirtualChans should do np.reshape by F order otherwise the samples of each channel will be interleaved.

May-02-2019

The table is added.

May-04-2019

DCA1000_CMD_RESPONSE_SEQ added.

Jun-01-2019

build_uis function added.

Jun-07-2019

SockBuf input is removed from packetReorderZeroFilling.

Jun-22-2019

DataExport input is removed from packetReorderZeroFilling and instead the function returns the export buffer. This is not mmeory efficient since it requires twice memory as before: one is for export buffer and the other for Q buffer outside the function.

Jul-17-2019

AveRemove is added.

Jul-27-2019

In FormingVirtualChans, the last two virtual channels were not made and it is fixed.

Jul-30-2019

A critical update in readADCbits. np.frombuffer is replaced instead of unpack to conver binaries to int16.

Mar-10-2020

A critical update in FormingVirtualChans: in which one for loop is removed for faster performance.

Mar-10-2020

A critical update in capon_az. scipy.linalg.lapack.zposv is used to compute inv_R_hat@a_hat, which is around 12 times faster than numpy.linalg.inv .

Author

Mostafa Alizadeh

radar.RadarFcnLib.AveRemove(a: <built-in function array>, retAve: bool, retAveRm: bool)

This function takes in a 3 dimensional array [x,y,z] as input and takes the average along the second dimension so the average array size would be [x,1,z]. When the average is taken, it will only create a matrix with dimension [x,z] as dimension y has been shrunk into one row. This matrix will be re-sized to return the dimensions [x,1,z] which would then be subtracted from the initial Array A to return the removed average array. The new averaged removed matrix will be returned.

Parameters
  • a (np.array) – 3D input array

  • retAve (bool) – whether or not return the average value

  • retAveRm (bool) – whether or not return the removed average array

Returns

based on retAve and retAve returns are determined

Author

Tanvir

radar.RadarFcnLib.CFAR2D()
radar.RadarFcnLib.DCA1000_CMD_RESPONSE_SEQ(CMD_SEQ: list, DCA1000Sock: socket.socket, DestAddr: ())

Sends and receives a sequence of message-reponses to and from the DCA1000 board. All the DCA1000 commands are supported except RESET_AR_DEV_CMD_CODE, PLAYBACK_START_CMD_CODE, PLAYBACK_STOP_CMD_CODE, SYSTEM_ERROR_CMD_CODE, CONFIG_DATA_MODE_AR_DEV_CMD_CODE, INIT_FPGA_PLAYBACK_CMD_CODE. The function sends a set of predefined commands which set default parameters for the DCA1000. The followings are the the default values for different parameters:

  • CONFIG_FPGA_GEN_CMD_CODE:

    Parameter

    Default value

    Raw data mode

    1

    Device

    AWR1243

    Capture

    LVDS

    Stream over

    Ethernet

    ADC bits

    16 bits

    Timer info.

    in seconds

  • CONFIG_EEPROM_CMD_CODE:

    Parameter

    Default value

    FPGA MAC Addr.

    12:90:78:56:34:12

    Config. Port #

    4098

  • CONFIG_PACKET_DATA_CMD_CODE:

    Parameter

    Default value

    Eth. packet size

    1472

    Eth. Packet delay

    25 ns

To start recording from the board, you should send the following sequence of commands:

  1. SYSTEM_CONNECT_CMD_CODE

  2. CONFIG_FPGA_GEN_CMD_CODE

  3. CONFIG_PACKET_DATA_CMD_CODE

  4. RECORD_START_CMD_CODE

To stop recording send RECORD_STOP_CMD_CODE command. For the input arguments and the outputs see parameters. It is assumed that the system IP is 192.168.33.30 and the FPGA IP is 192.168.33.180.

Parameters
  • CMD_SEQ (list[int]) – The list of commands to be sent in order.

  • DCA1000Sock (socket.socket) – The socket which is bound to the (System IP, configuration port). It is used for both send and receive of the commands and responses.

  • DestAddr (tuple[int,int]) – FPGA (IP, port) address.

Returns

A list of true and false indicating whether a message is submitted correctly or not. :rtype: list[int]

radar.RadarFcnLib.FFTrmNegativeFreqs(InMat: <built-in function array>, Nfft: int = None)

Takes FFT over columns of the input array (3D, 2D, or 1D array) and removes the negative frequencies. FFT is applied on the first axis.

Parameters
  • InMat (np.array) – Input array.

  • Nfft (int) – FFT size. If it is None then the FFT size is equal to the size of the columns, otherwise it is Nfft. However, the size along axis=0 should be an integer multiple of 2.

Returns

A NumPy array containing the FFT of the input array with removed negative frequencies.

radar.RadarFcnLib.FormingVirtualChans(Inmat: <built-in function array>, NumTxAnt: int, NumChirpSmps: int)

The Inmat is reshaped to a 3D array whose the 3rd dimension index is the virtual channel index. The input should have columns corresponding to each actual Rx channel samples. The 2D array made of the first two dimensions of the output 3D array contains chirp samples of a virtual channel.

Parameters

Inmat (np.array) – A matrix corresponding to the received data from actual Rx channels. Columns of the matrix should contain Rx channel data. It is assumed that the Inmat is a NumPy 2D array. Note that the order of Rx channels are from the first to the last column.

Returns

A 3D array with NumVirtualChan = NumTxAnt * Inmat.shape[1].

radar.RadarFcnLib.MDL4Targets(Zt: <built-in function array>)

Estimates the model order in MA, radar array response, harmonic mixtures, and etc. Refer to the paper for more details:

Parameters

Zt (array) – the sample matrix with the array sample in the columns

Returns

radar.RadarFcnLib.MakeSteeringMat(txPos: array([], dtype=float64), rxPos: array([], dtype=float64), theta_vec: array([], dtype=float64), phi_vec: array([], dtype=float64), lambda_ant: float)

Making ideal steering vectors by knowing Tx, Rx positions and the azimuth and elevation samples. The number of tx and rx elements are txPos.shape[0] and rxPos.shape[0], respectively.

\[ \begin{align}\begin{aligned}\boldsymbol{k} = &\sin \theta \cos \phi \; a_x + \\&\cos \theta \cos \phi \; a_y + \\&\sin \phi \; a_z \\& \theta: azimuth, \; \phi: elevation \\\boldsymbol{a}_{tx} = &[e^{j \boldsymbol{k}.\boldsymbol{tx}_1}, \cdots, e^{j \boldsymbol{k}.\boldsymbol{tx}_N}]^T \\\boldsymbol{a}_{rx} = &[e^{j \boldsymbol{k}.\boldsymbol{rx}_1}, \cdots, e^{j \boldsymbol{k}.\boldsymbol{rx}_M}]^T \\\boldsymbol{a}_{txrx} = &\boldsymbol{a}_{tx} \otimes \boldsymbol{a}_{rx}\end{aligned}\end{align} \]

Note

Every NAz columns of a_hat, starting from the first column to the end, is for all azimuth samples but for one elevation. This is compatible with :func:` <capon_az_el radar.RadarFcnLib.capon_az_el>`, which reshapes the output corresponding to the number of azimuth and elevation samples.

Parameters
  • txPos ([]) – tx element positions in which each row is [x,y] positions

  • rxPos ([]) – rx element positions in which each row is [x,y] positions

  • theta_vec ([]) – azimuth samples in a row vector with the shape (1,NAz)

  • phi_vec ([]) – elevation samples in a row vector with the shape (1, NEl)

  • lambda_ant (float) – wavelength

Returns

a_hat

radar.RadarFcnLib.SO_CFAR(input_vector, ng, nt, t_so)

The SO_CFAR function will take in a row vector of a given length and determine if there is an object at any of the given indexes. For each Cell Under Test the summation of the neighbouring cells are taken based on the training length value. The summation for the left and right side are taken and the one with the lowest value will be multiplied with the value of T to determine the threshold value. If the value of the Cell Under Test is greater than the threshold value then an object has been detected at that location. These values will be stored in a vector containing 0’s and 1’s and will be passed on for clustering.

Note

This is a core function for the following functions:

Parameters
  • matrix – input row vector that contains the square-law detector samples

  • ng – the gap length at each side of CUTs

  • nt – the half of the length of training window

  • pfa_val – false-alarm rate

Returns

returning a vector containing zeros and ones corresponding to the presence of targets or their absence, respectively.

radar.RadarFcnLib.VESPA(Zt: <built-in function array>, guide1: int, guide2: int, delta: <built-in function array>, d: int, f0: float, Sigma_n: <built-in function array>, shuffle: bool = None)

This functions calculates the source bearings, array steering vectors, and the source signals by means of ESPRIT. This is assumed that:

  1. The input array must be linear, the angle can not be obtained analytically by the nonlinear equation in the DOA estimation.

  1. we do apply smoothing by taking an average on all identical cross-correlations computed by cumulants.

Parameters
  • Zt (array) – Zt = [zt1 zt2 … zt … ztn] where the columns show measurements in time. the first two rows of Zt contain the reponses for guiding elements

  • guide1 (int) – is the indexe of the first guiding element

  • guide2 (int) – is the indexe of the second guiding element

  • delta (array) – delta, the translation vector, is known. delta is a displacement in x direction. In fact, it is guide2_pos - guide1_pos with the vector subraction where “guidei_pos” is the i’th guiding element location.

  • d (int) – d, the number of targets, is known

  • f0 (float) –

  • Sigma_n (array) – For this version, we need Sigma_n to be known a priori for waveform recovery

  • shuffle (Optional[bool]) – shuffle the columns and rows of the covariance matrix

Returns

direction of arrivals and estimated array response

radar.RadarFcnLib.VESPACovCompute(rt: <built-in function array>, guide1: int, guide2: int)

Computing cumulant-based covariance matrix for VESPA algorithm where the two guiding elements are indicated with guide1 and guide2 indexes.

Note

The speed needs to be optimized

Parameters
  • rt (array) – 2D array such that each column is the array response at a particular time instance

  • guide1 (int) – first guiding element index

  • guide2 (int) – second guiding element index

Returns

extended covariance matrix

radar.RadarFcnLib.build_uis(SRC: str = '.', DEST: str = '.')

Building all ‘.ui’ files in the SRC directory and put the results in DEST directory.

Parameters
  • SRC (str) – source directory.

  • DEST (str) – destination directory.

radar.RadarFcnLib.capon_az(rangeProfile, a_hat: <built-in function array>, a_her: <built-in function array>, Ntheta: int, ret_h_hat: bool = False, RngAzMat: <built-in function array> = array([], dtype=float64), h_hat: <built-in function array> = array([], dtype=float64))

Computing Capon spectrum for the azimuth angle. It takes a 3D array of rangeProfile, which has the following information on each dimension:

  • (range, slow-time or Doppler, antenna responses)

Note

This function uses a fast matrix inversion method by using zposv, which is 5 times faster than the usual matrix inversion. This is based on knowing that the matrix is positive defenite matrix.

Warning

This function will be omitted after testing capon_az_el for azimuth-only spectrum.

Parameters
  • rangeProfile – a 3D array of radar cube

  • a_hat (array) – steering matrix containing steering vectors on the columns. Each column is a sample of array manifold

  • a_her (array) – complex conjugate and transpose of a_hat

  • Ntheta (int) – Number of columns in a_hat

  • ret_h_hat (bool) – whether or not returning filter coefficients

  • RngAzMat (array) – if it is not empty array, it is a container for the output spectrum. If it is empty, it will return the spectrum to the output

  • h_hat (array) – if it is not empty, it returns the coefficients into this array; otherwise, it will return to the output if ret_h_hat is True.

Returns

radar.RadarFcnLib.capon_az_el(rangeProfile, a_hat: <built-in function array>, a_her: <built-in function array>, Ntheta: int, Nphi: int, ret_h_hat: bool = False, RngAzMat: <built-in function array> = array([], dtype=float64), h_hat: <built-in function array> = array([], dtype=float64))

The input radar cube will be used to create azimuth and elevation maps for each range. The input a_hat has columns corresponding to Ntheta*Nphi angle samples. In fact, every Ntheta columns of a_hat has all values for azimuth but for a single elevation. The output has two dimensions at the end of the array corresponding to azimuth and elevation samples, respectively.

Note

This function uses a fast matrix inversion method by using zposv, which is 5 times faster than the usual matrix inversion. This is based on knowing that the matrix is positive defenite matrix.

Parameters
  • rangeProfile – 3D radar cube

  • a_hat (array) – matrix of steering vectors

  • a_her (array) – complex conjugate transpose of a_hat

  • Ntheta (int) – number of azimuth samples

  • Nphi (int) – number of elevation samples. If it is only a single value, then there is no elevation spectrum

  • ret_h_hat (bool) – 0: does not return Capon filter coefficients, 1: returns coefficients

  • RngAzMat (array) – if defined, the output container of the Capon spectrum

  • h_hat (array) – if defined, output container of the filter coefficients

Returns

depending on ret_h_hat, RngAzMat, and h_hat returns RngAzMat and/or h_hat

radar.RadarFcnLib.f0_a_est(y_cmplx, R_hat, freqSet, M: int, L: int)

Fundamental frequency estimation based on Optimum filter design.

Parameters
  • y_cmplx – the complex input signal, which is a mixture of harmonics

  • R_hat – covariance matrix of y_cmplx

  • freqSet – a vector of frequency values to search for the fundamental frequency

  • M (int) – data block size

  • L (int) – number of harmonics

Returns

radar.RadarFcnLib.hierarchy_cluster(data, minimum_dist, lastCentroid, TTL, T)

The data points are clustered by hierarchy clustering. Then, according to the lastCentroid, they are reordered. In fact, lastCentroid holds the preceeding detected centroids. If a target disappears, its position will be held for T frames.

Note

we allocated 10 positions for 10 targets. If there are more than that they will be ignored. Each position will be held for 10 frames after disappearance of the target. A target is disappeared if and only if the following is true:

>>> len(lastCentroid) > num_clust

where num_clust is the number of new clusters.

Warning

This is an obsolete function. Instead, use hierarchy_cluster_v2.

Parameters
  • data – the detected points of targets where each column is for one dimension of the target

  • minimum_dist – minimum distance of two targets

  • lastCentroid – previous centroids

  • TTL – a vector of counters for each target position. If TTL[i] is T, it means the i’th target is new and if it is 0, it means the target was absent for T frames and it will be ignored by the next frame.

  • T – the number of frames that a position for a target will be held

Returns

radar.RadarFcnLib.hierarchy_cluster_v2(data, minimum_dist, lastCentroid, TTL, T)

First, the input data will be clustered by hierarchical clustering. Second, the new clusters will be mapped to the clusters of the previous frame if there was any; otherwise, they will be mapped to the empty positions.

lastCentroid holds the preceeding detected centroids. If a target disappears, its position will be held for T frames.

Note

we allocated 10 positions for 10 targets. If there are more than that they will be ignored. Each position will be held for 10 frames after disappearance of the target. A target is disappeared if and only if the following is true:

>>> len(lastCentroid) > num_clust

where num_clust is the number of new clusters.

Assumptions:

  • the new clusters will be mapped to all previous clusters no matter how far they are.

Parameters
  • data – the detected points of targets where each column is for one dimension of the target

  • minimum_dist – minimum distance of two targets

  • lastCentroid – previous centroids

  • TTL – a vector of counters for each target position. If TTL[i] is T, it means the i’th target is new and if it is 0, it means the target was absent for T frames and it will be ignored by the next frame.

  • T – the number of frames that a position for a target will be held

Returns

radar.RadarFcnLib.ndarray_CFAR(ndarray, P, T)

uses SO_CFAR for computing CFAR on an N-dimensional input array.

Warning

This is an obsolete function. Instead, use ndarray_CFAR_new and ndarray_CFAR_nested.

Parameters
  • ndarray – Multi-dimensional array with dimension n

  • P – Tuple containing the training length and guard band for the different dimensions

  • T – Tuple containing the list of the different values of T

Returns

radar.RadarFcnLib.ndarray_CFAR_nested(ndInput, P, T, nested: bool, detPoints=array([], dtype=float64))

Input detPoints is added to the ndarray_CFAR_new to enable using multiple CFAR functions in different points of processing while they are detecting targets in a N-dimensional space. For instance, the a CFAR can be applied on the range to truncate the radar cube for faster and more efficient angle processing. However, angle CFAR requires the detected range points in order to form teh final N-dimensional points.

Parameters
  • ndarray – Multi-dimensional array with dimension n

  • P – Tuple containing the training length and guard band for the different dimensions

  • T – Tuple containing the list of the different values of T

  • detPoints – detected previous points from the radar cube where the number of columns is the number of dimensions that CFAR has been applied on them before calling this function. If this is an empty array, it applies CFAR on all dimensions. P and T should be fed according to the actual number of dimensions that CFAR should be applied on.

Returns

radar.RadarFcnLib.ndarray_CFAR_new(ndInput, P, T)

It takes an Nd-dimensional array and applies CFAR sequentially on each dimension from the first to the last dimension. In fact, by going in the higher dimension, like n’th dimension, all detected points of the previous dimensions will be used to select a subspace of Nd-n+1 dimension. Then, CFAR will be applied on n’th dimension by summing the (Nd-n+1)-dimensional subsapce on the dimensions greater than n. The result of summation is a vector for all detected points on the dimensions less than n, and it all values of n’th dimension.

Warning

This will be obsolete after testing ndarray_CFAR_nested successfully.

Parameters
  • ndarray – Multi-dimensional array with dimension n

  • P – Tuple containing the training length and guard band for the different dimensions

  • T – Tuple containing the list of the different values of T

Returns

radar.RadarFcnLib.packetReorderZeroFilling(seqNum_: int, SeqNum: int, ByteCount: int, ByteCnt_: int, PayBits: bytearray, BufPt: int, RxBufSize: int, ExportLen: int, ByteBuf: bytearray, ZeroBytes: bytearray)

The function does packet reordering and zero filling for the received packets in PayBits. In fact, it checks whether the sequence numbers in PayBits are in order or not. If it is not, it will add appropriate amount of zero bytes to the buffer i.e. ByteBuf. After filling the buffer or when it is “almost” full, it puts the first ExportLen bytes to DataExport queue. Consider that buffers should be mutable object to make changes on them such that they will be available outside the function.

Parameters
  • seqNum (int) – The previous received sequence number.

  • SeqNum (int) – The current received sequence number.

  • ByteCount (int) – The current byte count from DCA1000.

  • ByteCnt (int) – The previous bytecount from DCA1000.

  • PayBits (bytearray) – Payload bits received from DCA1000.

  • BufPt (int) – A pointer to the current position of ByteBuf to fill the buffer.

  • RxBufSize (int) – The size of the buffer.

  • ExportLen (int) – The size of the output buffer

  • ByteBuf (bytearray) – The input buffer.

  • ZeroBytes (bytearray) – The zero-bytes array is a pre-allocated memory to reduce the memory usage by avoiding re/allocating of the zero-byte memory.

Returns

The updated position of the buffer pointer and the DataExport buffer.

radar.RadarFcnLib.readADCbits(ADCbits: bytearray, NumADCBits: int, isReal: bool)

Reads ADC bits from input and output uint samples i.e. 2-byte samples with little-endian order. This is a duplication of Matlab function provided by TI. It returns a matrix having columns with the received samples of each Rx channel.

Parameters
  • ADCbits (bytearray) – Input list of bits read from the DCA1000 packets

  • NumADCBits (int) – Number of ADC bits within each real/imaginary sample (# bits of ADCs).

  • isReal (bool) – An indication whether or not ADC has real or complex samples.

Returns

Returns the output matrix.

radar.RadarFcnLib.readStoredDCA1000(FileNames: ], RxBufSize: int, DataExport: queue.Queue)

Reads the binary files stored by mmave studio before packer reordering and zero filling. This function is good for offline analysis. The input FileNames is a list of binary file names to do packet reordering and zero filling on them in order.

Parameters
  • FileNames ([]) – a list of file names in a correct sequence to read the binary DCA packets saved by mmwave sutdio.

  • RxBufSize (int) – Buffer size for packetReorderZeroFilling.

  • DataExport (queue.Queue) – The thread queue for exporting reordered data.

Returns

True if it was successful, otherwise False.

radar.RadarFcnLib.readTDA2(fId, nSampsRead)

Reads nSampsRead samples from a binary file with the file ID of fId. It reads uin16 samples. This is used to read binary files from TDA2 device.

Parameters
  • fId – file ID

  • nSampsRead – number of samples to read

Returns

either a 2D array of samples containing columns for each receiver or an empty array if the end of file is reached.

radar.RadarFcnLib.rmAntCoupling(VirChans: <built-in function array>, MAxCalibRngIdx: int, AveLen: int)

Calculates the antenna coupling for the close ranges determined by MAxCalibRngIdx. Computes the average for the first bunch of samples with length AveLen. Also note that, it takes the average on the complex samples not on magnitude or phase separately.

Parameters
  • VirChans (np.array) – Input 3D array which comes normally from the output of FFTrmNegativeFreqs()

  • MAxCalibRngIdx (int) – Zero indexing of the maximum range index such that the antenna coupling effect will be calculated for the ranges up to that range index.

  • AveLen (int) – Averaging length.

Returns

The antenna coupling compensation array, which can be used later for removing the antenna coupling signature.

radar.RadarFcnLib.unpackDCApayload(fHand)

Takes a file handler and returns the ADC bits. The file is a binary file stored by mmwave studio in the format mentioned in the TI user guide of “DCA1000EVM Data Capture Card” section 5.3.

Parameters

fHand

File handler

return

Sequence numbers in a list.

Returns

Payload sizes in a list

Returns

ADC bits in a binary sequence

Defining TI FMCW parameters

class radar.params.FMCW_System_Params(profile_config, chirp_config, frame_config)

Bases: object

FMCW radar system parameters are computed based on the parameters in TI_FMCW_Profile_Params, TI_FMCW_Chirp_Params, TI_FMCW_Frame_Params. Assummptions are:

  • TDM and BPM MIMO and a single Tx/Rx modes are supported

  • in the defined chirps, one Tx could be active for multiple times

used. The default value of maxAng is \(\pi/2\) assuming half-wavelength spacing of Rx elements. In addition, this is assumed that number of ADC sample bits is 16.

class radar.params.TI_Data_Config

Bases: object

Set data configuration parameters of TI radar. # TODO: complete the class definition

class radar.params.TI_FMCW_Chirp_Params

Bases: object

Set chirp parameters of TI radar. You can define any number of chirps and send the configuration via using mmwavelink.dlldef. The default values are:

  • ProfileID = 0

  • StartIdx = 0

  • EndChirpIdx = 0

  • StartFreqVar = 0

  • TxEn = 0

  • KVar = 0

  • idleTimeVar = 0

  • ADCStartTimeVar = 0

Methods

getGuiParams

getGuiParams(self)
class radar.params.TI_FMCW_Frame_Params

Bases: object

Set frame configuration of the radar for calculating necessary radar system parameters or setting configuration on radar by using mmwavelink.dlldef. default values are:

  • StartChirpIdx = 0

  • EndChirpIdx = 0

  • NumFrames = 0

  • NumChirpLoops = 1

  • TrigDelay = 0

Methods

getGuiParams

getGuiParams(self)
class radar.params.TI_FMCW_Profile_Params(ProfileId=0, fc=77, K=None, lambda_max=None, idleTime=None, TxStartTime=1, ADCStartTime=2, NumChirpSamples=None, SampRate=None, RampEndTime=None, RxGain=30, PhTx0=0, PhTx1=0, PhTx2=0)

Bases: object

Set FMCW profile parameters in order to use it to configure the radar or calculate min/max valid values of range/velocity (or Doppler)/angle of arrival. The default values are:

  • ProfileID = 0

  • fc = 77 GHz

  • idleTime = 1 us

  • ADCStartTime = 2 us

  • RxGain = 30 dB

  • PhTx0 = 0

  • PhTx1 = 0

  • PhTx2 = 0

Note

The power backoff of all transmitters is 0dB.

Methods

getGuiParams

getGuiParams(self)

Radar processing blocks

The required blocks are leveraged from processing module.

class radar.radarProcessingBlocks.ADCReadBits(name, isReal, NumADCBits)

Bases: processing.t_general_block

This block performs conversion from bytes to short integer samples and forms a 2D matrix having 4 columns corresponding to each Rx channel and chirps samples in the row. This is tested with complex ADC samples only.

Parameters
  • name (str) – block name

  • isReal (bool) – whether the ADC samples are real or complex

  • NumADCBits – number of ADC bits can be 12,14,16 bits.

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self, \*inputs)

Takes the reordered and filled packets from packetReorder.

delay_calc

getName

isDaemon

setDaemon

setName

worker(self, \*inputs)

Takes the reordered and filled packets from packetReorder.

Parameters

inputs – packets from packetReorder

Returns

2D array of Rx chirp samples and each Rx samples are in each column.

class radar.radarProcessingBlocks.BPMDecode(blckName, bpmMat, numRx=4)

Bases: processing.t_general_block

Binary phased multiplexing (BPM) is decoded to make a virtual 3D array. This block assumes an input from VirtualChanFormer where it is a 3D array with the shape of (Nfft, NDop, Nant) such that Nfft, NDop, and Nant are the number of chirp samples, slow-time samples, and the number of virtual channels.

Parameters
  • blckName (str) – block name

  • bpmMat (ndarray) – a matrix of binary phases with the shape (Nant/4,Nant/4)

  • numRx (int) – number of actual Rx channels, which is 4 for a single chip

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self, \*ins)

param ins

output of VirtualChanFormer

delay_calc

getName

isDaemon

setDaemon

setName

worker(self, \*ins)
Parameters

ins – output of VirtualChanFormer

Returns

BPM decoded signal and formed virtual channels

class radar.radarProcessingBlocks.BPMDecode3Tx(blckName, bpmMat)

Bases: processing.t_general_block

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.CaponSpectrum(blockName, a_hat, NAz, NEl)

Bases: processing.p_general_block

This block calculates Capon spectrum for each entry of the first dimension. The input should be 3D array containing time samples in the second dimension.

Attributes
authkey
daemon

Return whether process is a daemon

exitcode

Return exit code of process or None if it has yet to stop

ident

Return identifier (PID) of process or None if it has yet to start

name
pid

Return identifier (PID) of process or None if it has yet to start

sentinel

Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination.

Methods

close(self)

Close the Process object.

is_alive(self)

Return whether process is alive

join(self[, timeout])

Wait until child process terminates

kill(self)

Terminate process; sends SIGKILL signal or uses TerminateProcess()

run(self)

Method to be run in sub-process; can be overridden in sub-class

start(self)

Start child process

terminate(self)

Terminate process; sends SIGTERM signal or uses TerminateProcess()

worker(self, \*ins)

param ins

expect to get a 3D array

delay_calc

worker(self, \*ins)
Parameters

ins – expect to get a 3D array

Returns

a 2D array with ranges in the rows and angles on the columns

class radar.radarProcessingBlocks.DCAReader(name, Niter, UDP_IP='192.168.33.30', UDP_port=4098, UDP_buffer_size=65000)

Bases: processing.p_source_block

This block collects the data stream from DCA1000 board through ethernet. It assumes that the ethernet protocol is UDP with the packet structures in DCA1000.

The initializer needs to know:

Parameters
  • name (str) – block name

  • Niter (int) – The number of iterations to receive packets from socket before sending them to other processing blocks. This is used for handling packet drops.

  • UDP_IP (str) – Host IP which is 192.168.33.30 to connect to the source i.e. DCA1000 FPGA.

  • UDP_port (int) – Host port used for data streaming through ethernet and this is 4098 by default.

  • UDP_buffer_size (int) – The network buffer size to handle packet drops. The default is 65000 bytes.

Attributes
authkey
daemon

Return whether process is a daemon

exitcode

Return exit code of process or None if it has yet to stop

ident

Return identifier (PID) of process or None if it has yet to start

name
pid

Return identifier (PID) of process or None if it has yet to start

sentinel

Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination.

Methods

close(self)

Close the Process object.

is_alive(self)

Return whether process is alive

join(self[, timeout])

Wait until child process terminates

kill(self)

Terminate process; sends SIGKILL signal or uses TerminateProcess()

run(self)

Method to be run in sub-process; can be overridden in sub-class

start(self)

Start child process

terminate(self)

Terminate process; sends SIGTERM signal or uses TerminateProcess()

worker(self)

Takes the UDP payload from socket and buffer them for Niter times, then sends them along with their length as a tuple of (len,packets) to the other blocks.

delay_calc

worker(self)

Takes the UDP payload from socket and buffer them for Niter times, then sends them along with their length as a tuple of (len,packets) to the other blocks.

Returns

(len,packets) = (list of packet lengths, list of packets)

class radar.radarProcessingBlocks.Decimation(blckName, NDecim, filtLen, DesBands, BandGains, fs)

Bases: processing.t_general_block

Decimate the input stream by an integer factor. It removes the filter delay by appending enough zeros at the end of received data. We are using firwin2 to design the anti-aliasing filter. The input to the block is expected to be a list of arrays coming from RangeAngle_filter block.

Warning

filtLen-1 should be a common divisor of 2*NDecim in order to have an integer group delay after decimaiton.

Parameters
  • blckName – block name

  • NDecim (int) – number of decimation

  • filtLen (int) – The length of anti-aliasing filter before decimation, which should be odd to have an integr group delay in the number of samples.

  • DesBands (()) – it should be a tuple with an even length as the same length as BandGains.

  • BandGains (()) – it should be a tuple with an even length as the same length as DesBands.

  • fs – Sampling frequency

  • axis – axis to apply decimation

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

ResponsePlot(self)

Plots the anti-aliasing filter response.

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

fltDesign

getName

isDaemon

setDaemon

setName

worker

ResponsePlot(self)

Plots the anti-aliasing filter response.

Returns

filter response plot

fltDesign(self, NSamps, desBands, desired, fs)
worker(self, \*ins)
class radar.radarProcessingBlocks.DopCompensate(blckName, Comp)

Bases: processing.t_general_block

The input Comp is a 3D array of shape (1,D,A) such that A and D are the number of Doppler bins and virtual antennas, respectively.

Parameters
  • blckName – block name

  • Comp – compensatation array

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.F0Processor(blckName, N, MTime, L, freqRange, freqRes, TimeShift, fs_ts, removeDC)

Bases: processing.tp_sink_block

The input is a list of signals including their slow-time samples after range angle filtering using RangeAngle_filter. The input length of each signal should be the same and equal to N. We are assuming:

  • when this block is called, there is at least one target detected for vital signs

The above policy is required to implement the input data buffers. The association stage should satisfy this condition.

Parameters
  • blckName (str) – block name in string

  • N (int) – the length of input data in slow-time, which is constant during runtime

  • MTime (float) – The block size for computing the input covriance matrix in seconds.

  • L (int) – Number of harmonics for the vital harmonic analysis

  • freqRange (np.ndarray) – two element vector showing the start and end of the frequency range for the vital sign

  • freqRes (float) – The required frequency resolution in Hz

  • TimeShift (float) – The amount of time shift between consecutive inputs in seconds showing how fast vital rate should be updated

  • fs_ts (float) – slow-time sampling frequency.

  • removeDC (bool) – removing DC of the input signal or not

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

PullFromBuff(self, ii)

should return np.nan when there is nothing to return.

get_R_hat(self, y_cmplx)

Computing covariance matrix of y_cmplx as a column vector for vital signs

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

pushToBuff(self, inSigList, DetPts)

An internal buffer is created for each detected target and the incoming signal of each target is placed to the buffer allocated for it.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self, \*ins)

param ins

it is one input containing two elements. The first element is the signal list, and the other element

delay_calc

getName

isDaemon

setDaemon

setName

PullFromBuff(self, ii: int)

should return np.nan when there is nothing to return.

Parameters

ii (int) – index of input buffer to pull

Returns

N-element vector if there is enough number of elements in the buffer

get_R_hat(self, y_cmplx)

Computing covariance matrix of y_cmplx as a column vector for vital signs

Parameters

y_cmplx – input complex signal

Returns

sample covariance matrix

pushToBuff(self, inSigList, DetPts)

An internal buffer is created for each detected target and the incoming signal of each target is placed to the buffer allocated for it.

Parameters
  • inSigList – signal input list corresponding to DetPts

  • DetPts – detected points which has the length as the number of targets

Returns

worker(self, \*ins)
Parameters

ins – it is one input containing two elements. The first element is the signal list, and the other element is detected points matrix.

Returns

vital signs dictionary

class radar.radarProcessingBlocks.FFTBlock(blckName, dim, fftshift, rmZeroFreq)

Bases: processing.t_general_block

Taking FFT over dim of the input array and swap the two halves of the array along dim if fftshift is True. Also, note that it applies unitary FFT for the sake of having the same power scale before and after FFT. rmZeroFreq is useful for removing zero Doppler.

Parameters
  • blckName – block name

  • dim (int) – dimension to apply FFT on

  • fftshift (bool) – centering the zero frequency or not

  • rmZeroFreq (bool) – 0: does not set zero frequency zero, 1: set zero frequency zero

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.HierClustering(blckName, xPts, ThetaPts, minDist, T, PhiPts=None)

Bases: processing.tp_sink_block

Hierarchical clustering for 2D inputs. It expects to get detected indexes from CFAR on the two or three dimensions.

Parameters
  • blckName – block name

  • xPts – row vector x points

  • ThetaPts – row vector theta points

  • minDist – minimum distance of the targets

  • T – number of frames to keep a position for a target

  • PhiPts – row vector phi points

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

CalcXY(self, data)

Convering (range,azimuth) points to (x,y) points :param data: detected indexes :return: (x,y) matrix with the same length as data

CalcXYZ(self, data)

Converting (range, azimuth, elevation) points to (x,y,z) points.

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

CalcXY(self, data)

Convering (range,azimuth) points to (x,y) points :param data: detected indexes :return: (x,y) matrix with the same length as data

CalcXYZ(self, data)

Converting (range, azimuth, elevation) points to (x,y,z) points. :param data: the detected points for (range, azimuth, elevation) :return: (x,y,z) matrix with the same length as data

worker(self, \*ins)
class radar.radarProcessingBlocks.MeanBlock(blckName, dim)

Bases: processing.t_general_block

Calculates the mean along the dimensions dim

Parameters
  • blckName – block name

  • dim (int) – dimension to take the average of it

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.RAPoint2xy(blckName, xRange)

Bases: processing.tp_sink_block

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

calcXY(self, dataX, dataTheta)

Convering (range,azimuth) points to (x,y) points :param data: detected indexes :return: (x,y) matrix with the same length as data

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

calcXY(self, dataX, dataTheta)

Convering (range,azimuth) points to (x,y) points :param data: detected indexes :return: (x,y) matrix with the same length as data

worker(self, \*ins)
class radar.radarProcessingBlocks.RangeAngle_filter(blckName, xRange, theta_vec, Nant, dx, lambda_max, fs_ts, NTime, TimeShift)

Bases: processing.t_general_block

The incoming detected points from association stage will be taken to filter out the radar cube at angle and the range such that the target signal in slow-time will be passed to F0Processor. The order of the targets will be kept as the association does. It is assumed that when a target disappears, the xy vector of detected points are filled with nan in the position of the disappeared target.

Parameters
  • blckName – block name

  • xRange – range vector

  • theta_vec – azimuth vector

  • Nant (int) – number of antennas

  • dx (float) – spacing between antenna elements assuming uniform spacing

  • lambda_max (float) – wavelength determining the antenna distance

  • fs_ts (float) – frame rate assuming a single chirp per Tx anteann per frame

  • NTime (float) – vital frame duration

  • TimeShift (float) – the update period of vital signs in seconds

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

getRA(self, DetPts)

Assuming that the received detected points, DetPts, are the candidate points of each target such that the array has two columns and n row where n is the number of targets.

getSig(self, RPs, RAvec)

Range-azimuth filtering for each target

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self, \*ins)

Expects to get two inputs.

delay_calc

getName

isDaemon

setDaemon

setName

getRA(self, DetPts)

Assuming that the received detected points, DetPts, are the candidate points of each target such that the array has two columns and n row where n is the number of targets. The first column is x and the second column is y.

Parameters

DetPts – detected points by the association step

Returns

the index of the closest range and angle to the target.

getSig(self, RPs, RAvec)

Range-azimuth filtering for each target

Parameters
  • RPs – radar cube

  • RAvec – (range,azimuth) matrix

Returns

signal list

worker(self, \*ins)

Expects to get two inputs. The first input is the detected points vector, and the second input is the radar cube such that the dimensions are (range, slow-time, antennas).

Parameters

ins

Returns

a list with the first element containing a list of filtered signals corresponding to the target (range,angle) indexes, which is in the second element of the output list.

class radar.radarProcessingBlocks.RangeAzimuth(blockName, numTx, lambda_ant, dx, maxTheta, NumAngs)

Bases: processing.p_general_block

This block calculates Capon filter for each range to obtain range-azimuth map. This uses capon_az as a core function.

Warning

This block will be obsolete.

Parameters
  • blockName – block name

  • numTx – number of Tx channels used

  • lambda_ant – wavelength used for the antennas on the board

  • dx – antenna spacing at the receiver on the TI EVM boards.

  • maxTheta (float) – maximum theta to calculate azimuth angles in [-maxTheta,maxTheta], though it should be positive value.

  • NumAngs – angle steps for computing steering vector

Attributes
authkey
daemon

Return whether process is a daemon

exitcode

Return exit code of process or None if it has yet to stop

ident

Return identifier (PID) of process or None if it has yet to start

name
pid

Return identifier (PID) of process or None if it has yet to start

sentinel

Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination.

Methods

a_theta(self, theta_vec, numTx, alpha, dx)

Calculates steering vector for Capon intput.

close(self)

Close the Process object.

is_alive(self)

Return whether process is alive

join(self[, timeout])

Wait until child process terminates

kill(self)

Terminate process; sends SIGKILL signal or uses TerminateProcess()

run(self)

Method to be run in sub-process; can be overridden in sub-class

start(self)

Start child process

terminate(self)

Terminate process; sends SIGTERM signal or uses TerminateProcess()

worker(self, \*ins)

param ins

expect to get output of rangeFFT or StationaryClutterRemoval blocks

delay_calc

a_theta(self, theta_vec, numTx, alpha, dx)

Calculates steering vector for Capon intput.

Parameters
  • theta_vec – vector of angles

  • numTx – number of Tx channels used

  • alpha\(2\pi/\) lambda_ant

  • dx – receiver elements spacing

Returns

steering vector

worker(self, \*ins)
Parameters

ins – expect to get output of rangeFFT or StationaryClutterRemoval blocks

Returns

a 2D array with ranges in the rows and angles on the columns

class radar.radarProcessingBlocks.RangeProfiles2mat(blockName, NSkip, NFrames, fileName)

Bases: processing.t_sink_block

Sinks the range profiles up to NFrames frames and saves them on a .mat file. This is to avoid large mat files. It skips NFirst frames, then it stores NFrames. It continues to add more files as if multiple NFrames are received.

Parameters
  • blockName – block name

  • NSkip (int) – number of skipped first frames

  • NFrames (int) – number of frames to store for each mat file

  • fileName (str) – file name

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.ReshapeBlock(blckName, newShape)

Bases: processing.t_general_block

Reshaping the input array to newShape

Parameters
  • blckName – block name

  • newShape (()) – new shape

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.Selector(blckName, dim)

Bases: processing.tp_sink_block

Selects a part of the input array along the dimension dim

Parameters
  • blckName – block name

  • dim (int) – dimension to select the sample

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self, \*ins)

param ins

it has two inputs. The first input is a vector of the indexes to select along dim and the second input is

delay_calc

getName

isDaemon

setDaemon

setName

worker(self, \*ins)
Parameters

ins – it has two inputs. The first input is a vector of the indexes to select along dim and the second input is the data.

Returns

truncated array

class radar.radarProcessingBlocks.StationaryClutterRemoval(name)

Bases: processing.t_general_block

Removing stationary clutters by subtracting the average of each range bin in a frame from the range bin.

Parameters

name (str) – block name

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self, \*inputs)

Expects to get the input from VirtualChanFormer or BPMDecode.

delay_calc

getName

isDaemon

setDaemon

setName

worker(self, \*inputs)

Expects to get the input from VirtualChanFormer or BPMDecode.

Parameters

inputs – assumes that it takes an array with range bins in each row.

Returns

row average removed array

class radar.radarProcessingBlocks.TDA2xxBits(blckName, FileDir, devList, nSamps, delay)

Bases: processing.t_source_block

This blocks reads binary data stored by TDA2xx board. So, this is used as a source for offline processing.

Parameters
  • blckName – block name

  • FileDir – the directory of binary files

  • devList (list) –

    list of devices to read the data. It reads all Rx channels of the listed devices. Devices are indexed as follows:

    • Master: 1

    • Slave1: 2

    • Slave2: 3

    • Slave3: 4

  • nSamps (int) – number of samples to read each time, which should be the number of complex samples in a frame

  • delay (float) – a delay between reading each frame

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

openFiles(self)

When it is called, the file list will be created again.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

openFiles(self)

When it is called, the file list will be created again.

Returns

a list of file objects if there is any; otherwise, it sets self.end to True

worker(self, \*ins)
class radar.radarProcessingBlocks.TDM_CAS_3D_VESPA(blckName, NumRxDec, fc, lambda_ant, dAzimuth, dElevation, xRange)

Bases: processing.tp_sink_block

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

VESPA_Azimuth(self, Zt, delta)

Note

the guiding elements are the two farthest azimuth elements

VESPA_Elevation(self, Zt)

Note

assuming that the 10’th and 36’th channels are aligned vertically by lambda_ant/2 when only

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

toXYZ(self, range, az_ext, el_ext)

Note

assuming a single range but different number of DOA_az and DOA_el and x,y,z values are:

delay_calc

getName

isDaemon

setDaemon

setName

worker

VESPA_Azimuth(self, Zt: <built-in function array>, delta)

Note

the guiding elements are the two farthest azimuth elements

Returns

VESPA_Elevation(self, Zt: <built-in function array>)

Note

assuming that the 10’th and 36’th channels are aligned vertically by lambda_ant/2 when only one device receivers are used.

Parameters

Zt (array) –

Returns

toXYZ(self, range, az_ext, el_ext)

Note

assuming a single range but different number of DOA_az and DOA_el and x,y,z values are:

\[x = r sin \phi sin heta y = r sin \phi cos heta z = r cos \phi\]
Parameters
  • range

  • DOA_az – a column vector of detected azimuth points

  • DOA_el – a column vector of detected elevation points

Returns

worker(self, \*ins)
class radar.radarProcessingBlocks.ToAbs(blckName)

Bases: processing.t_general_block

Takes absolute value of the input array.

Parameters

blckName – block name

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.ToPower(blckName)

Bases: processing.t_general_block

Takes a complex input nd array and gives its power. Essentially, it computes \(y = |x|^2\)

Parameters

blckName – block name

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.VESPA_detector(blckName, guide1, guide2, delta, d, f0, Sigma_n)

Bases: processing.t_general_block

It is assumed to take input from truncated radar cubes after range CFAR. Then, it applies VESPA for the angle detection and array calibration for each detected range.

Parameters
  • blckName – block name

  • guide1 (int) – first guiding element index

  • guide2 (int) – second guiding element index

  • delta (array) – translation direction for VESPA

  • d (int) – number of targets

  • f0 (float) – center frequency for array processing

  • Sigma_n (array) – noise covriance matrix

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self, \*ins)

param ins

Truncated radar cube

delay_calc

getName

isDaemon

setDaemon

setName

worker(self, \*ins)
Parameters

ins – Truncated radar cube

Returns

only DOAs in a list corresponding to each range

class radar.radarProcessingBlocks.VirtualChanFormer(name, numTxnAnt, numChirpsSmps)

Bases: processing.t_general_block

Takes ADCReadBits outputs and forms virtual channels by assuming that TDM MIMO is used.

Parameters
  • name (str) – block name

  • numTxnAnt (int) – number of Tx channels used

  • numChirpsSmps (int) – number of chirp samples

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self, \*inputs)

param inputs

expect to get ADCReadBits outputs

delay_calc

getName

isDaemon

setDaemon

setName

worker(self, \*inputs)
Parameters

inputs – expect to get ADCReadBits outputs

Returns

a 3D array with chirp samples on the columns and virtual channels in the third dimension. It contains samples of one frame if rx_buffer_size is set correctly in packetReorder.

class radar.radarProcessingBlocks.Vital2BinFile(blckName, filename, vital2Save)

Bases: processing.t_sink_block

Saves vital signs as detected by F0Processor. It expects to receive up to 4 targets.

Warning

It is tested only fr f0_Hz.

Parameters
  • blckName – name of the block

  • filename (str) – file names such that it appends the name of vital to the end of it.

  • vital2Save (()) –

    a list of vital names that they are in the output of F0Processor. For the current version it can be one of the followings:

    • f0_Hz

    • NoisePluseIntPowerdB

    • SINRdB

    • x_hat_flt

    • TimeShift

    • radarSig

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.VitalAssociation(blkName, NHold)

Bases: processing.tp_sink_block

Terminologies:
  • Preceding or previous targets: the targets in the previous frame

  • Current targets: the input targets from the clutersing block.

  • New targets: the targets that they were not in the previous frame.

Parameters
  • blkName (str) – block name

  • NHold (int) – number of frames to hold a position for a disappeared target.

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

DistanceMat(self, xy_, xy)

Returns a matrix containing distances of a current point to all previous points in a row.

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self, \*ins)

Policy:

delay_calc

getName

isDaemon

setDaemon

setName

DistanceMat(self, xy_, xy)

Returns a matrix containing distances of a current point to all previous points in a row.

Parameters
  • xy – previous point

  • xy – current point

Returns

Distance matrix

worker(self, \*ins)

Policy:

  1. Does not return anything when there is no target detected

  2. Considers if there is no target, one target or two targets

  3. Does not take any action if clustering potentially miss-cluster.

  4. If a target disappears, it holds its position for NHold frames

  5. If the number of targets is greater than before, it assigns the closest targets to the previous ones and add the rest as the new targets.

  6. If the number of targets is less than before, it assigns the current targets to the previous and holds the disappeared targets as np.nan.

Parameters

ins – It expect two inputs. The first input is a list containing points for each target. The second input corresponds

to the centroid of the first input. :return:

class radar.radarProcessingBlocks.comm_channel(BlockName)

Bases: processing.tp_sink_block

Computes absolute value square of the input data and takes an average on the second and third dimensions. This is used for getting the average range profiles.

Parameters

BlockName – block name

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self, \*ins)

param ins

3D array input with demnsions (range, slow-time/Doppler, antenna reponses)

delay_calc

getName

isDaemon

setDaemon

setName

worker(self, \*ins)
Parameters

ins – 3D array input with demnsions (range, slow-time/Doppler, antenna reponses)

Returns

class radar.radarProcessingBlocks.concat(blckName, N=<class 'int'>, axis=None)

Bases: processing.t_general_block

concatenate the incoming array.

Parameters
  • blckName – Block name

  • N – the number of inputs to concatenate

  • axis – the axis that all N collected arrays will be concatenated in. If it is None, then a new axis will be added to the data dimensions.

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.file_sink(blockName, fileName, frmt, frmtString='', delimiter='')

Bases: processing.t_sink_block

This block has one input port. It refreshes the existing file to append data to a newly created file. If it is storing data to a binary file, the data could be an nd array, and if it is storing in text format, the data should be 1D or 2D array.

Warning

When saving as a text file, the input array should be 1D or 2D. Also you should be cautious that it overwrites any existing files in the directory with the same name.

Parameters
  • blockName – block name in string

  • fileName – file name to save data

  • frmt (b) – ‘b’ or ‘s’ to save as binary or text file using numpy.save or numpy.savetxt.

  • frmtString – used for saving only 1D or 2D data as text. For more information see here.

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self, \*ins)

param ins

1D or 2D numpy array for saving on a text file and ndarray in general for saving as binary.

delay_calc

getName

isDaemon

setDaemon

setName

worker(self, \*ins)
Parameters

ins – 1D or 2D numpy array for saving on a text file and ndarray in general for saving as binary.

class radar.radarProcessingBlocks.file_src(blockName, fileName, sleepValue)

Bases: processing.t_source_block

The block reads .npy binary files stored by file_sink.

Parameters
  • blockName – block name

  • fileName (str) – file name to read

  • sleepValue (int) – the delay for reading each sample from the file

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self)

return out

ndarray in general for reading from a binary file.

delay_calc

getName

isDaemon

setDaemon

setName

worker(self)
Return out

ndarray in general for reading from a binary file.

class radar.radarProcessingBlocks.fineSpec(blckName, w_f, inshape, specDim, aveDim)

Bases: processing.p_general_block

Applies a matched filter (as a function of spectrum variable, f) to the input signal.

Parameters
  • blckName – block name

  • w_f ([]) – spectrum basis matrix as a function of f. Each column is a sample in f

  • inshape (int) – input array shape

  • aveDim (int) – averaging along the dimension dim, and if it is None, there is no averaging. Consider that by doing averaging, the output array does not have dimension dim.

“param specDim: the dimension of which the fine spectrum will be computed

Attributes
authkey
daemon

Return whether process is a daemon

exitcode

Return exit code of process or None if it has yet to stop

ident

Return identifier (PID) of process or None if it has yet to start

name
pid

Return identifier (PID) of process or None if it has yet to start

sentinel

Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination.

Methods

close(self)

Close the Process object.

is_alive(self)

Return whether process is alive

join(self[, timeout])

Wait until child process terminates

kill(self)

Terminate process; sends SIGKILL signal or uses TerminateProcess()

run(self)

Method to be run in sub-process; can be overridden in sub-class

start(self)

Start child process

terminate(self)

Terminate process; sends SIGTERM signal or uses TerminateProcess()

delay_calc

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.meanShiftClustering(blckName, xPts, ThetaPts)

Bases: processing.t_general_block

It uses mean shift for clustering the detected points. It takes the points from ndSOCACFAR or ndSOCACFARNested.

Note

Only 2D points are implemented.

Parameters
  • blckName – block name

  • xPts – range points

  • ThetaPts – azimuth points

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

meanShift(self, rIdx, thetaIdx)

param rIdx

range indexes

run(self)

Method representing the thread’s activity.

shift_centre(self, ms, centres)

Shifts the centre to a desired point on the target.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

meanShift(self, rIdx, thetaIdx)
Parameters
  • rIdx – range indexes

  • thetaIdx – azimuth indexes

Returns

cluster list, xy points, and cluster centers

shift_centre(self, ms, centres)

Shifts the centre to a desired point on the target. It might help to get better vital signals.

Parameters
  • ms – clusters

  • centres – centers

Returns

shifted centers to the closest point of the target to the radar.

worker(self, \*ins)
class radar.radarProcessingBlocks.ndSOCACFAR(blckName, NDim, CFARParams)

Bases: processing.t_general_block

This block creates a SO-CA-CFAR processor for the nd-dimensional incoming arrays. For more info on SO-CA-CFAR see Object detection with CFAR. This is based on ndarray_CFAR_new function.

Warning

This block will be obsolete.

Parameters
  • blckName (str) – block name

  • NDim (int) – number of input dimensions

  • CFARParams (()) – CFAR parameters as a list which has a length equal to NDim

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

PfaGOCFAR

PfaSOCFAR

delay_calc

getName

isDaemon

setDaemon

setName

t_solver

worker

PfaGOCFAR(self, Tval, n, N)
PfaSOCFAR(self, Tval, n, N, pfa_t)
t_solver(self, Pfa_vec, Nt, Ng)
worker(self, \*ins)
class radar.radarProcessingBlocks.ndSOCACFARNested(blckName, NDim, CFARParams, nested)

Bases: processing.t_general_block

This block creates a SO-CA-CFAR processor for the nd incoming arrays. This is based on ndarray_CFAR_nested function.

Parameters
  • blckName (str) – block name

  • NDim (int) – number of input dimensions when nested=False; otherwise, it is the number of dimensions that the nested CFAR should be applied on.

  • CFARParams (()) – CFAR parameters as a list which has a length equal to NDim.

  • nested (bool) – 0: it is not nested CFAR, 1: it is nested CFAR

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

PfaGOCFAR(self, Tval, n, N)

False-alarm rate of greatest-of CFAR in terms of T, left training window length, and right training window length

PfaSOCFAR(self, Tval, n, N, pfa_t)

param Tval

T value

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

t_solver(self, Pfa_vec, Nt, Ng)

Finds T values for each value in Pfa_vec by using the relationship between \(P^{SO}_{fa}\) and T and the left and right window lengths (see eq24).

worker(self, \*ins)

param ins

The first input is previously detected points and if this is empty, it returns an empty array.

delay_calc

getName

isDaemon

setDaemon

setName

PfaGOCFAR(self, Tval, n, N)

False-alarm rate of greatest-of CFAR in terms of T, left training window length, and right training window length

Parameters
  • Tval – T value

  • n – left training window length

  • N – total training window length

Returns

false-alarm rate of greatest-of CFAR

PfaSOCFAR(self, Tval, n, N, pfa_t)
Parameters
  • Tval – T value

  • n – left training window length

  • N – total training window length

  • pfa_t – target false-alarm rate

Returns

false-alarm rate of smallest-of CFAR

t_solver(self, Pfa_vec, Nt, Ng)

Finds T values for each value in Pfa_vec by using the relationship between \(P^{SO}_{fa}\) and T and the left and right window lengths (see eq24).

Parameters
  • Pfa_vec – a vector of target \(P_{fa}\) values

  • Nt – training length which is the total length of training data around the cell under test. Thus, one side may have less or more than Nt/2 samples.

  • Ng – gap length

Returns

worker(self, \*ins)
Parameters

ins – The first input is previously detected points and if this is empty, it returns an empty array. A full CFAR will be applied on when nested is False. Second input is the square-law output data. If nested is True, then it assumes that CFAR has been applied on the first d dimensions of the input where d is the number of columns for the first input.

Returns

detected points

class radar.radarProcessingBlocks.net_sink(blockName, ConfigPort, DataPort, dataInfo, IP='127.0.0.1')

Bases: processing.p_sink_block

A sink block sending input numpy arrays over a network. In fact, the array is sent in binary to a server by assuming that the server is run and it is waiting for initializing the connection. In the initialization, the block sends the data size in bytes to the server in order to stream fixed length data afterwards. The sever will recover data by using numpy.load.

Parameters
  • blockName (str) – block name

  • ConfigPort (int) – configuration port which is set on the server side for getting the packet sizes

  • DataPort (int) – data port for streaming data to server

  • dataInfo (((), <class 'type'>)) – a tuple of (datashape, type) where datashape is the shape of the numpy array and type is the type of elements in the array.

  • IP (str) – IP for both configuration and data streaming

Attributes
authkey
daemon

Return whether process is a daemon

exitcode

Return exit code of process or None if it has yet to stop

ident

Return identifier (PID) of process or None if it has yet to start

name
pid

Return identifier (PID) of process or None if it has yet to start

sentinel

Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination.

Methods

close(self)

Close the Process object.

is_alive(self)

Return whether process is alive

join(self[, timeout])

Wait until child process terminates

kill(self)

Terminate process; sends SIGKILL signal or uses TerminateProcess()

run(self)

Method to be run in sub-process; can be overridden in sub-class

start(self)

Start child process

terminate(self)

Terminate process; sends SIGTERM signal or uses TerminateProcess()

worker(self, \*data)

param data

taking any numpy array from other processing blocks

delay_calc

worker(self, \*data)
Parameters

data – taking any numpy array from other processing blocks

class radar.radarProcessingBlocks.net_sink_padded(blockName, ConfigPort, DataPort, dataInfo, IP='127.0.0.1')

Bases: processing.p_sink_block

This block is similar to net_sink except it fixes the output size based on the dataInfo. Thus, the input stream should have a size less than dataInfo[0].size, and enough zeros will be added to make the output binary buffer the fixed size of MSG_LEN.

Parameters
  • blockName (str) – block name

  • ConfigPort (int) – configuration port which is set on the server side for getting the packet sizes

  • DataPort (int) – data port for streaming data to server

  • dataInfo (((), <class 'type'>)) – a tuple of (datashape, type) where datashape is the shape of the numpy array and type is the type of elements in the array.

  • IP (str) – IP for both configuration and data streaming

Attributes
authkey
daemon

Return whether process is a daemon

exitcode

Return exit code of process or None if it has yet to stop

ident

Return identifier (PID) of process or None if it has yet to start

name
pid

Return identifier (PID) of process or None if it has yet to start

sentinel

Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination.

Methods

close(self)

Close the Process object.

is_alive(self)

Return whether process is alive

join(self[, timeout])

Wait until child process terminates

kill(self)

Terminate process; sends SIGKILL signal or uses TerminateProcess()

run(self)

Method to be run in sub-process; can be overridden in sub-class

start(self)

Start child process

terminate(self)

Terminate process; sends SIGTERM signal or uses TerminateProcess()

worker(self, \*data)

param data

taking any numpy array from other processing blocks

delay_calc

worker(self, \*data)
Parameters

data – taking any numpy array from other processing blocks

class radar.radarProcessingBlocks.net_sink_py_obj(blckName, port, host='127.0.0.1')

Bases: processing.p_sink_block

Sending a python object to the remote host.

Attributes
authkey
daemon

Return whether process is a daemon

exitcode

Return exit code of process or None if it has yet to stop

ident

Return identifier (PID) of process or None if it has yet to start

name
pid

Return identifier (PID) of process or None if it has yet to start

sentinel

Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination.

Methods

close(self)

Close the Process object.

is_alive(self)

Return whether process is alive

join(self[, timeout])

Wait until child process terminates

kill(self)

Terminate process; sends SIGKILL signal or uses TerminateProcess()

run(self)

Method to be run in sub-process; can be overridden in sub-class

start(self)

Start child process

terminate(self)

Terminate process; sends SIGTERM signal or uses TerminateProcess()

delay_calc

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.null_sink(BlockName)

Bases: processing.t_sink_block

It does sink any data coming to the input without doing any processing on it.

Parameters

BlockName – block name

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.packetReorder(name, rx_buffer_size)

Bases: processing.tp_source_block

Reorder and fill drop packets with zeros after packet reception by DCAReader.

Parameters
  • name (str) – block name

  • rx_buffer_size (int) – the buffer size to queue received and reordered bytes. Essentially it is twice the radar

frame length in bytes and it depends on:
  • number of chirps in a frame

  • number of chirp samples

  • number of ADC bits

  • real or complex sampling

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self, \*inputs)

Overrides the parent method by taking inputs from DCAReader block.

delay_calc

getName

isDaemon

setDaemon

setName

worker(self, \*inputs)

Overrides the parent method by taking inputs from DCAReader block.

Parameters

inputs – tuples of (len, packets).

Returns

it returns when rx_buffer_size/2 bytes when the buffer has this number of bytes. If it does not any bytes to return, it does not return any things.

class radar.radarProcessingBlocks.permute(blckName, axes=())

Bases: processing.t_general_block

Permutes the axes of the input array.

Parameters
  • blckName – block name

  • axes – a tuple listing the axis number in order for the permutation

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

worker(self, \*ins)
class radar.radarProcessingBlocks.radio_sink(blckName, COMPort, BaudRate, Timeout)

Bases: processing.t_sink_block

Sinks the detected points to a radio transmitter to broadcast information to a remote receiver.

Note

It assumes that the sent array to the remote receiver is a matrix with 3 columns indicating [x,y,z] values.

Parameters
  • blckName – block name

  • COMPort – COM port to open and send the data. This port should not be used by other open programs.

  • BaudRate – Baud rates could be: 115200 , 57600 , 38400 , 28800 , 19200 , 14400 , 9600.

  • Timeout – Time out value to avoid waiting more than TimeOut (in seconds).

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

tx_serial(self, ser, arr, buffLock, …)

A thread transferring a binary sequence to the radio

delay_calc

getName

isDaemon

setDaemon

setName

worker

tx_serial(self, ser: serial.serialwin32.Serial, arr: bytearray, buffLock: <built-in function allocate_lock>, radio_buff_size: int)

A thread transferring a binary sequence to the radio

Parameters
  • ser (Serial) – serial object

  • arr (bytearray) – transmit buffer

  • buffLock (allocate_lock) – a thread lock for the buffer

  • radio_buff_size (int) – buffer size to send each time

Returns

worker(self, \*ins)
class radar.radarProcessingBlocks.radio_source(blckName, COMPort, BaudRate, Timeout)

Bases: processing.t_source_block

A source to read data coming from a radio on the COMPort.

Note

It assumes that the received array from the remote sender is a matrix with 3 columns indicating [x,y,z] values.

Parameters
  • blckName – block name

  • COMPort – COM port

  • BaudRate – Baud rate

  • Timeout – Time out value in second to stop blocking if there is no data received within TimeOut

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

readBuff(self, arr)

To read a binary buffer to a numpy array.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

readBuff(self, arr: bytearray)

To read a binary buffer to a numpy array.

Parameters

arr (bytearray) – input buffer with received binary sequence

Returns

the rest of buffer after reading enough data for a numpy array.

worker(self, \*ins)
class radar.radarProcessingBlocks.rangeFFT(name)

Bases: processing.t_general_block

Taking range-FFT on the output of VirtualChanFormer.

Parameters

name (str) – block name

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

worker(self, \*inputs)

Taking FFT on the second dimension of the input array and removing negative frequencies.

delay_calc

getName

isDaemon

setDaemon

setName

worker(self, \*inputs)

Taking FFT on the second dimension of the input array and removing negative frequencies.

Parameters

inputs – expected to get 2D or 3D array such that chirp samples are on the second dimension.

Returns

2D or 3D array with the same size but half size on the second dimension.

class radar.radarProcessingBlocks.to_proc(blckName)

Bases: processing.tp_sink_block

Just to transfer data to a process block.

Parameters

blckName – block name

Attributes
daemon

A boolean value indicating whether this thread is a daemon thread.

ident

Thread identifier of this thread or None if it has not been started.

name

A string used for identification purposes only.

Methods

isAlive(self)

Return whether the thread is alive.

is_alive(self)

Return whether the thread is alive.

join(self[, timeout])

Wait until the thread terminates.

run(self)

Method representing the thread’s activity.

start(self)

Start the thread’s activity.

delay_calc

getName

isDaemon

setDaemon

setName

worker

worker(self, \*ins)