xwr.rsp.jax
¶
Radar Signal Processing in Jax.
Info
In addition to mirroring the functionality of
xwr.rsp.numpy
, this module also provides a range of
point cloud processing algorithms.
Warning
This module is not automatically imported; you will need to explicitly import it:
Since jax is not declared as a required dependency, you will also need
to install jax
yourself (or install the jax
extra with
pip install xwr[jax]
).
xwr.rsp.jax.AWR1642Boost
¶
Bases: RSPJax
Radar Signal Processing for the AWR1642 or AWR1843 with TX2 disabled.
Antenna Array
The TI AWR1642Boost (or AWR1843Boost with TX2 disabled) has a 1x8 linear MIMO array:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
window
|
bool | dict[Literal['range', 'doppler', 'azimuth', 'elevation'], bool]
|
whether to apply a hanning window. If |
False
|
size
|
dict[Literal['range', 'doppler', 'azimuth', 'elevation'], int]
|
target size for each axis after zero-padding, specified by axis. If an axis is not spacified, it is not padded. |
{}
|
Source code in src/xwr/rsp/jax/rsp.py
xwr.rsp.jax.AWR1843AOP
¶
Bases: RSPJax
Radar Signal Processing for AWR1843AOP.
Antenna Array
In the TI AWR1843AOP, the MIMO virtual array is arranged in a 2D grid:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
window
|
bool | dict[Literal['range', 'doppler', 'azimuth', 'elevation'], bool]
|
whether to apply a hanning window. If |
False
|
size
|
dict[Literal['range', 'doppler', 'azimuth', 'elevation'], int]
|
target size for each axis after zero-padding, specified by axis. If an axis is not spacified, it is not padded. |
{}
|
Source code in src/xwr/rsp/jax/rsp.py
xwr.rsp.jax.AWR1843Boost
¶
Bases: RSPJax
Radar Signal Processing for AWR1843Boost.
Antenna Array
In the TI AWR1843Boost, the MIMO virtual array has resolution 2x8, with a single 1/2-wavelength elevated middle antenna element:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
window
|
bool | dict[Literal['range', 'doppler', 'azimuth', 'elevation'], bool]
|
whether to apply a hanning window. If |
False
|
size
|
dict[Literal['range', 'doppler', 'azimuth', 'elevation'], int]
|
target size for each axis after zero-padding, specified by axis. If an axis is not spacified, it is not padded. |
{}
|
Source code in src/xwr/rsp/jax/rsp.py
elevation_aoa
¶
elevation_aoa(
iq: Complex64[Array, "batch slow tx rx fast"]
| Int16[Array, "batch slow tx rx fast*2"],
) -> Float32[Array, "batch doppler range"]
Estimate elevation angle of arrival (AoA).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iq
|
Complex64[Array, 'batch slow tx rx fast'] | Int16[Array, 'batch slow tx rx fast*2']
|
raw IQ data. |
required |
Returns:
Type | Description |
---|---|
Float32[Array, 'batch doppler range']
|
Estimated elevation angle of arrival (AoA) in radians for each range-Doppler bin. |
Source code in src/xwr/rsp/jax/rsp.py
xwr.rsp.jax.CFAR
¶
Cell-averaging CFAR.
Expects a 2d input, with the guard
and window
sizes corresponding to
the respective input axes.
┌─────────────────┐ ▲ window[0]
│ ┌───────┐ │ │
│ │ ┌─┐ │ │ ▼
│ │ └─┘ │ │ ▲ guard[0]
│ └───────┘ │ ▼
└─────────────────┘
guard[1] ◄──► ◄───────► window[1]
Note
The user is responsible for applying the desired thresholding.
For example, when using a gaussian model, the threshold should be
calculated using an inverse normal CDF (e.g. scipy.stats.norm.isf
):
Parameters:
Name | Type | Description | Default |
---|---|---|---|
guard
|
tuple[int, int]
|
size of guard cells (excluded from noise estimation). |
(2, 2)
|
window
|
tuple[int, int]
|
total CFAR window size. |
(4, 4)
|
Source code in src/xwr/rsp/jax/spectrum.py
__call__
¶
Get CFAR thresholds.
Note
Boundary cells are zero-padded.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Float[Array, 'd r ...']
|
input. If more than 2 axes are present, the additional axes are averaged before running CFAR. |
required |
Returns:
Type | Description |
---|---|
Float[Array, 'd r']
|
CFAR threshold values for this input. |
Source code in src/xwr/rsp/jax/spectrum.py
xwr.rsp.jax.CFARCASO
¶
Cell-averaging Smallest of CFAR.
Expects a 2d input, with the guard
and window
sizes corresponding to
the respective input axes.
Info
Instead of the 2D kernel used in Cell-averaging CFAR, CASO uses a separate 1D kernel for the range and doppler axes; detection occurs if the SNR exceeds the specified threshold on either axis.
┌─┐ ▲ window[0]
│ │ │
├─┤ ▼
┌───┬─┼─┼─┬───┐
└───┴─┼─┼─┴───┘ ▲ guard[0]
├─┤ ▼
│ │
└─┘
guard[1] ◄─► ◄───► window[1]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
train_window
|
Sequence[int]
|
training window size for (range, doppler). |
(8, 4)
|
guard_window
|
Sequence[int]
|
guard window size for (range, doppler). |
(8, 0)
|
snr_thresh
|
Sequence[float]
|
signal to noise ratio threshold for (range, doppler). |
(5.0, 3.0)
|
discard_range
|
Sequence[int]
|
range bins (close, far) to discard around DC. |
(10, 20)
|
Source code in src/xwr/rsp/jax/spectrum.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
__call__
¶
__call__(
signal_cube: Float32[Array, "doppler Rx Tx range"],
) -> tuple[
Bool[Array, "range doppler"],
Float32[Array, "range doppler"],
Float32[Array, "range doppler"],
]
Run 2D CFAR CASO.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
signal_cube
|
Float32[Array, 'doppler Rx Tx range']
|
post range doppler FFT radar cube in amplitude. |
required |
Returns:
Type | Description |
---|---|
Bool[Array, 'range doppler']
|
cfar detected object mask. |
Float32[Array, 'range doppler']
|
range doppler spectrum for detection. |
Float32[Array, 'range doppler']
|
signal to noise ratio. |
Source code in src/xwr/rsp/jax/spectrum.py
xwr.rsp.jax.CalibratedSpectrum
¶
Bases: Generic[TRSP]
Radar processing with zero-doppler calibration.
Zero Doppler Calibration
Due to the antenna geometry and radar returns from the data collection rig which is mounted rigidly to the radar, the radar spectrum has a substantial constant offset in the zero-doppler bins.
- We assume that the range-Doppler plots are sparse, and take the median across a number of sample frames for the zero-doppler bin to estimate this offset.
- If a hanning window is applied, we instead calculate the offset
across doppler bins
[-1, 1]
to account for doppler bleed. - This calculated offset is subtracted from the calculated spectrum.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rsp
|
TRSP
|
RSP pipeline to use. |
required |
Source code in src/xwr/rsp/jax/spectrum.py
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
__call__
¶
__call__(
iq: Complex64[Array, "#batch doppler tx rx range"]
| Int16[Array, "#batch doppler tx rx range2"],
calib: Float32[Array, "doppler el az range"],
) -> Float32[Array, "batch doppler el az range"]
Run radar spectrum processing pipeline.
Note
After subtracting the calibration patch, any negative values are clipped to zero.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iq
|
Complex64[Array, '#batch doppler tx rx range'] | Int16[Array, '#batch doppler tx rx range2']
|
batch of IQ data to run. |
required |
calib
|
Float32[Array, 'doppler el az range']
|
calibration patch to apply. |
required |
Returns:
Type | Description |
---|---|
Float32[Array, 'batch doppler el az range']
|
Doppler-elevation-azimuth-range real spectrum, with zero doppler correction applied. |
Source code in src/xwr/rsp/jax/spectrum.py
calibration_patch
¶
calibration_patch(
sample: Complex64[Array, "n slow tx rx fast"]
| Int16[Array, "n slow tx rx fast2"],
batch: int = 1,
) -> Float32[Array, "doppler el az range"]
Create a calibration patch for zero-doppler correction.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sample
|
Complex64[Array, 'n slow tx rx fast'] | Int16[Array, 'n slow tx rx fast2']
|
sample IQ data to use for calibration. |
required |
batch
|
int
|
sample size for RSP processing. Uses batch size |
1
|
Returns:
Type | Description |
---|---|
Float32[Array, 'doppler el az range']
|
Patch of the doppler-range-azimuth image which should be subracted from the zero-doppler bins of the range-doppler-angle spectrum. |
Source code in src/xwr/rsp/jax/spectrum.py
xwr.rsp.jax.PointCloud
¶
Get radar point cloud from post FFT cube.
To convert azimuth-elevation bin indices to azimuth-elevation angles, we use the property that the azimuth bin indices correspond to the sin of the angle
where the corrected antenna spacing is calculated byInfo
The antenna design frequency here refers to the grid alignment of the antenna array, which are typically 0.5 wavelengths apart at some nominal design frequency. Thus, you must correct by a corresponding scale factor when the chirp center frequency differs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
range_resolution
|
float
|
range fft resolution |
required |
doppler_resolution
|
float
|
doppler fft resolution |
required |
angle_fov
|
Sequence[float]
|
angle field of view in degrees for (elevation, azimuth). |
(20.0, 80.0)
|
angle_size
|
Sequence[int]
|
angle fft size for (elevation, azimuth). |
(128, 128)
|
antenna_spacing
|
float
|
antenna spacing in terms of wavelength (default 0.5). |
0.5
|
Source code in src/xwr/rsp/jax/aoa.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
__call__
¶
__call__(
cube: Float32[Array, "doppler ele azi range"],
mask: Bool[Array, "range doppler"],
) -> tuple[Bool[Array, "range doppler"], Float32[Array, "range doppler 4"]]
Get point cloud from radar cube and detection mask.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cube
|
Float32[Array, 'doppler ele azi range']
|
post fft spectrum amplitude. |
required |
mask
|
Bool[Array, 'range doppler']
|
CFAR detection mask. |
required |
Returns:
Type | Description |
---|---|
Bool[Array, 'range doppler']
|
mask of valid points (given the specified angular bounds) |
Float32[Array, 'range doppler 4']
|
all possible radar points |
Source code in src/xwr/rsp/jax/aoa.py
aoa
¶
Angle of arrival estimation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cube
|
Float32[Array, 'range doppler ele azi']
|
post fft spectrum amplitude. |
required |
Returns:
Name | Type | Description |
---|---|---|
ang |
Int[Array, 'range doppler 2']
|
detect angle index for every range doppler bin. |
Source code in src/xwr/rsp/jax/aoa.py
xwr.rsp.jax.RSPJax
¶
Base Radar Signal Processing with common functionality.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
window
|
bool | dict[Literal['range', 'doppler', 'azimuth', 'elevation'], bool]
|
whether to apply a hanning window. If |
False
|
size
|
dict[Literal['range', 'doppler', 'azimuth', 'elevation'], int]
|
target size for each axis after zero-padding, specified by axis. If an axis is not spacified, it is not padded. |
{}
|
Source code in src/xwr/rsp/jax/rsp.py
azimuth_aoa
¶
azimuth_aoa(
iq: Complex64[Array, "batch slow tx rx fast"]
| Int16[Array, "batch slow tx rx fast*2"],
) -> Int[Array, "batch doppler range"]
Estimate angle of arrival (AoA).
Note
The AOA bin resolution is determined by the number of bins this RSP instance is configured with.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iq
|
Complex64[Array, 'batch slow tx rx fast'] | Int16[Array, 'batch slow tx rx fast*2']
|
raw IQ data. |
required |
Returns:
Type | Description |
---|---|
Int[Array, 'batch doppler range']
|
Estimated angle of arrival (AoA) index for each range-Doppler bin. |