xwr.rsp
¶
Radar Signal Processing for batched 4D spectrum.
Image Axis Order
Elevation and azimuth axes are in "image order": increasing index is down and to the right, respectively.
Byte order: when do I sample_swap?
If you are using the xwr stack, use the default sample_swap=False,
which corresponds to MSB_LSB_IQ, the only
option supported by the source-available TI firmware. If processing data
collected using other systems (in particular, mmWave studio, which has its
own closed-source firmware which supports MSB_LSB_QI), you may need to
set sample_swap=True if this option was enabled.
To use the RSP:
-
Pick your backend. Currently, we support numpy, jax, and pytorch.
-
Select the appropriate radar model.
-
Import the RSP class matching your backend and radar:
Tip
Use
xwr.rsp.RSPas the type for a generic RSP, andRSP[np.ndarray],RSP[jax.Array],RSP[torch.Tensor], etc for a RSP with a specific backend.
xwr.rsp.RSP
¶
Abstract, backend-agnostic Radar Signal Processing base class.
Info
This class documents the public interface for all radar signal processing (RSP) classes, except where otherwise noted.
Type Parameters
TArray: Generic backend, e.g.,np.ndarray, jaxjax.Array, or torchTensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window
|
bool | Mapping[Literal['range', 'doppler', 'azimuth', 'elevation'], bool]
|
whether to apply a hanning window. If |
False
|
size
|
Mapping[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. |
{}
|
sample_swap
|
bool
|
if |
False
|
Source code in src/xwr/rsp/generic.py
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 243 244 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 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
__call__
¶
__call__(
x: Complex64[TArray, "#batch doppler tx rx _range"]
| Float32[TArray, "#batch doppler tx rx _range"]
| Int16[TArray, "#batch doppler tx rx _range"],
) -> Complex64[TArray, "#batch doppler2 el az _range"]
Process time signal data to compute elevation-azimuth spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Complex64[TArray, '#batch doppler tx rx _range'] | Float32[TArray, '#batch doppler tx rx _range'] | Int16[TArray, '#batch doppler tx rx _range']
|
IQ data in complex or interleaved int16 IQ format, or in-phase-only data in float32 format. |
required |
Returns:
| Type | Description |
|---|---|
Complex64[TArray, '#batch doppler2 el az _range']
|
Computed doppler-elevation-azimuth-range spectrum. |
Source code in src/xwr/rsp/generic.py
doppler_range
¶
doppler_range(
x: Complex64[TArray, "#batch doppler tx rx range"]
| Float32[TArray, "#batch doppler tx rx range"],
) -> Complex64[TArray, "#batch doppler2 tx rx range2"]
Calculate range-doppler spectrum from time signal data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Complex64[TArray, '#batch doppler tx rx range'] | Float32[TArray, '#batch doppler tx rx range']
|
IQ (complex64) or in-phase-only (float32) data. |
required |
Returns:
| Type | Description |
|---|---|
Complex64[TArray, '#batch doppler2 tx rx range2']
|
Computed range-doppler spectrum, with windowing if specified. |
Source code in src/xwr/rsp/generic.py
elevation_azimuth
¶
elevation_azimuth(
rd: Complex64[TArray, "#batch doppler tx rx range"],
) -> Complex64[TArray, "#batch doppler el az range"]
Calculate elevation-azimuth spectrum from range-doppler spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rd
|
Complex64[TArray, '#batch doppler tx rx range']
|
range-doppler spectrum. |
required |
Returns:
| Type | Description |
|---|---|
Complex64[TArray, '#batch doppler el az range']
|
Computed elevation-azimuth spectrum, with windowing and padding if specified. |
Source code in src/xwr/rsp/generic.py
fft
abstractmethod
¶
fft(
array: Complex64[TArray, ...] | Float32[TArray, ...],
axes: tuple[int, ...],
size: tuple[int, ...] | None = None,
shift: tuple[int, ...] | None = None,
) -> Complex64[TArray, ...]
Compute FFT on the specified axes of the array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
Complex64[TArray, ...] | Float32[TArray, ...]
|
Input array. |
required |
size
|
tuple[int, ...] | None
|
Target size for each axis after FFT (or |
None
|
axes
|
tuple[int, ...]
|
Axes along which to compute the FFT. |
required |
shift
|
tuple[int, ...] | None
|
Axes to shift after FFT, if any. |
None
|
Returns:
| Type | Description |
|---|---|
Complex64[TArray, ...]
|
FFT of the input array along the specified axes. If the input
array is real-valued, the output is the non-negative frequency
terms of the FFT along the specified axes (with length
|
Source code in src/xwr/rsp/generic.py
hann
abstractmethod
staticmethod
¶
hann(
x: Complex64[TArray, ...] | Float32[TArray, ...], axis: int
) -> Complex64[TArray, ...] | Float32[TArray, ...]
Apply a Hann window to the specified axis of the time signal data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
Complex64[TArray, ...] | Float32[TArray, ...]
|
time signal data. |
required |
axis
|
int
|
Axis along which to apply the Hann window. |
required |
Returns:
| Type | Description |
|---|---|
Complex64[TArray, ...] | Float32[TArray, ...]
|
Time signal data with the Hann window applied along the specified axis. |
Source code in src/xwr/rsp/generic.py
mimo_virtual_array
abstractmethod
¶
mimo_virtual_array(
rd: Complex64[TArray, "#batch doppler tx rx range"],
) -> Complex64[TArray, "#batch doppler elevation azimuth range"]
Set up MIMO virtual array from range-doppler spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rd
|
Complex64[TArray, '#batch doppler tx rx range']
|
complex range-doppler spectrum. |
required |
Returns:
| Type | Description |
|---|---|
Complex64[TArray, '#batch doppler elevation azimuth range']
|
Computed MIMO virtual array, in elevation-azimuth order. |
Source code in src/xwr/rsp/generic.py
xwr.rsp.iq_from_iiqq
¶
iq_from_iiqq(
iiqq: Int16[TArray, "... n"] | Complex64[TArray, "... _n"],
sample_swap: bool = False,
) -> Complex64[TArray, "... n2"]
Un-interleave IIQQ data.
Info
The default sample_swap = False corresponds to the
MSB_LSB_IQ byte order used by xwr.
In this case, MSB_LSB_IQ means that I is the MSB and Q is the LSB.
However, the data stream is little-endian, which means Q actually comes
before I, leading to the actual physical layout being QQII and so on.
Type Parameters
TArray: This function is multi-backend, and supports numpynp.ndarray, jaxjax.Array, and torchTensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iiqq
|
Int16[TArray, '... n'] | Complex64[TArray, '... _n']
|
interleaved IIQQ data; see |
required |
sample_swap
|
bool
|
if |
False
|
Returns:
| Type | Description |
|---|---|
Complex64[TArray, '... n2']
|
Complex IQ data. |
Source code in src/xwr/rsp/generic.py
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 | |
xwr.rsp.iqiq_from_iiqq
¶
iqiq_from_iiqq(
iiqq: Int16[TArray, "... n"], sample_swap: bool = False
) -> Int16[TArray, "... n/2 2"]
Un-interleave IIQQ data.
Type Parameters
TArray: This function is multi-backend, and supports numpynp.ndarray, jaxjax.Array, and torchTensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
iiqq
|
Int16[TArray, '... n']
|
interleaved IIQQ data; see |
required |
sample_swap
|
bool
|
if |
False
|
Returns:
| Type | Description |
|---|---|
Int16[TArray, '... n/2 2']
|
IQ data in an uninterleaved format with a trailing I/Q axis. |