Skip to main content

WiTwin Radar - Differentiable Radar Simulator

A GPU-accelerated, differentiable FMCW radar simulator for generating synthetic radar data from 3D scenes. It combines RayD/Dr.Jit ray tracing with custom CUDA kernels for scene simulation, signal generation, and downstream radar processing.

This module is derived from RF-Genesis.

Get Started

Python 3.10+ is required. Radar simulation uses the native Dirichlet CUDA backend and requires an NVIDIA GPU with CUDA. CPU construction remains useful for configuration and non-rendering helper workflows. This package depends on the base witwin package.

Linux and Windows are supported targets. Release wheels include prebuilt native CUDA extensions for supported Python/platform combinations. Source builds require a CUDA-enabled PyTorch build, NVIDIA driver, CUDA toolkit, ninja, and a working C++ compiler.

pip install witwin[radar]

Quick Start

import numpy as np
import torch

from witwin.radar import Radar, RadarConfig
from witwin.radar.sigproc import process_pc, process_rd

# FMCW radar configuration.
config = {
    "num_tx": 3,
    "num_rx": 4,
    "fc": 77e9,
    "slope": 60.012,
    "adc_samples": 256,
    "adc_start_time": 6,
    "sample_rate": 4400,
    "idle_time": 7,
    "ramp_end_time": 65,
    "chirp_per_frame": 128,
    "frame_per_second": 10,
    "num_doppler_bins": 128,
    "num_range_bins": 256,
    "num_angle_bins": 64,
    "power": 15,
    "tx_loc": [[0, 0, 0], [4, 0, 0], [2, 1, 0]],
    "rx_loc": [[-6, 0, 0], [-5, 0, 0], [-4, 0, 0], [-3, 0, 0]],
}

# Use the native CUDA solver.
radar = Radar(
    RadarConfig.from_dict(config),
    device="cuda",
    position=(0.0, 0.0, 0.0),
    target=(0.0, 0.0, -5.0),
    fov=60.0,
)

point = np.array([[0.0, 0.0, -3.0]], dtype=np.float32)
velocity = np.array([[0.0, 0.0, 0.01]], dtype=np.float32)


def interp(t):
    # Return target intensity and position at time t.
    positions = torch.tensor(point + velocity * t, dtype=torch.float32, device=radar.device)
    intensities = torch.ones((positions.shape[0],), dtype=torch.float32, device=radar.device)
    return intensities, positions


# Simulate one frame, then extract point cloud and RD map.
frame = radar.mimo(interp, t0=0)
pc = process_pc(radar, frame)
rd, _, ranges, vels = process_rd(radar, frame)

Scene API

Use Radar(..., position=..., target=..., fov=...) to define the radar pose, and Scene.add_* methods for scene assembly.

from witwin.core import Material, Structure
from witwin.radar import Radar, RadarConfig, Scene, TransformMotion

radar = Radar(
    RadarConfig.from_dict(config),
    device="cuda",
    position=(0.0, 0.0, 0.0),
    target=(0.0, 0.0, -1.0),
    fov=60.0,
)
scene = Scene(device="cpu")

scene.add_structure(
    Structure(
        name="car_body",
        geometry=car_body_mesh,
        material=Material(eps_r=3.0),
    )
)
scene.add_mesh(name="wheel_fl", vertices=wheel_vertices, faces=wheel_faces, dynamic=True)
scene.add_structure_motion(
    "wheel_fl",
    TransformMotion(
        axis=(0.0, 1.0, 0.0),
        angular_velocity=32.0,
        origin=(0.0, 0.0, 0.0),
        space="local",
    ),
)

frame = radar.simulate(
    scene,
    sampling="triangle",
    motion_sampling="per_chirp",
)

Available mutating scene methods:

  • Scene.add_structure(...)
  • Scene.add_mesh(...)
  • Scene.add_smpl(...)
  • Scene.add_structure_motion(...)
  • Scene.update_structure(...)
  • Scene.remove(...)

Features

  • Native Dirichlet CUDA kernels for chirp, frame, and MIMO generation
  • Ray tracing through RayD/Dr.Jit with differentiable scene support
  • Shared-core geometry and structure primitives
  • SMPL body support through Scene.add_smpl(...)
  • Optional per-structure rigid motion with parent inheritance
  • Multi-radar orchestration through Radar.simulate_group(...)
  • Torch-native DSP pipeline for range/Doppler processing and point-cloud extraction
  • Optional antenna pattern, polarization, noise-model, and receiver-chain configuration

Running Tests

cd radar
pytest tests/
pytest tests/ --gpu

Examples

Run the maintained Python examples from the radar/ root:

python -m examples.single_point
python -m examples.mesh_scene
python -m examples.humanbody
python -m examples.music_imaging
python -m examples.amass_pointcloud
python -m examples.gen_amass_video
python -m examples.rgbd_range_doppler --input path/to/depths.npy

amass_pointcloud and gen_amass_video additionally require AMASS BMLmovi data under data/BMLmovi_full/BMLmovi/. The rendering examples require RayD and CUDA; the SMPL examples also require models/smpl_models/. rgbd_range_doppler reads .npy/.npz depth or point-cloud sequences, and can read Azure Kinect .mkv files when pykinect_azure is installed. It assumes the depth camera view is the radar view by default.

Installation

Python 3.10+ is required. Install a CUDA-enabled PyTorch build for simulation and tracing. Linux and Windows are supported; source builds require the NVIDIA driver, CUDA toolkit, ninja, and a C/C++ compiler on PATH.

pip install witwin[radar]

Core dependencies include torch, numpy, drjit, rayd, tqdm, matplotlib, and scipy.

Citation

If this module or its original RF-Genesis work is relevant to your research, please cite:

@inproceedings{chen2023rfgenesis,
  author = {Chen, Xingyu and Zhang, Xinyu},
  title = {RF Genesis: Zero-Shot Generalization of mmWave Sensing through Simulation-Based Data Synthesis and Generative Diffusion Models},
  booktitle = {ACM Conference on Embedded Networked Sensor Systems (SenSys '23)},
  year = {2023},
  pages = {1-14},
  address = {Istanbul, Turkiye},
  publisher = {ACM, New York, NY, USA},
  url = {https://doi.org/10.1145/3625687.3625798},
  doi = {10.1145/3625687.3625798}
}

License

BSD-3-Clause

Developer

Xingyu Chen

Xingyu Chen

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

witwin_radar-0.2.0.tar.gz (1.2 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

witwin_radar-0.2.0-cp312-cp312-win_amd64.whl (276.1 kB view details)

Uploaded CPython 3.12Windows x86-64

witwin_radar-0.2.0-cp312-cp312-manylinux_2_35_x86_64.whl (258.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.35+ x86-64

witwin_radar-0.2.0-cp311-cp311-win_amd64.whl (276.9 kB view details)

Uploaded CPython 3.11Windows x86-64

witwin_radar-0.2.0-cp311-cp311-manylinux_2_35_x86_64.whl (258.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.35+ x86-64

witwin_radar-0.2.0-cp310-cp310-win_amd64.whl (276.0 kB view details)

Uploaded CPython 3.10Windows x86-64

witwin_radar-0.2.0-cp310-cp310-manylinux_2_35_x86_64.whl (257.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ x86-64

File details

Details for the file witwin_radar-0.2.0.tar.gz.

File metadata

  • Download URL: witwin_radar-0.2.0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for witwin_radar-0.2.0.tar.gz
Algorithm Hash digest
SHA256 be8fd7372355628daae42708c196806899739d437a91bbadb9ea33d20e5a143b
MD5 43ba5bd5db7a4a7acdae1029de325eed
BLAKE2b-256 2043249af7f3c32eab7f363dea6f3dcadcceeb29174c4142603ed283a7ebb245

See more details on using hashes here.

Provenance

The following attestation bundles were made for witwin_radar-0.2.0.tar.gz:

Publisher: publish-witwin-radar.yml on witwin-ai/witwin-radar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file witwin_radar-0.2.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for witwin_radar-0.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5cafd4eedff648c29fda917dbefe362a522ee84de3c45dfeccad9eb708a3eac0
MD5 9fb25a5e787bbc9e8891cfe0537029d2
BLAKE2b-256 544e66a66e36303f6581ee00d35673aceb7378260623a11c44663ed4859e3cc3

See more details on using hashes here.

Provenance

The following attestation bundles were made for witwin_radar-0.2.0-cp312-cp312-win_amd64.whl:

Publisher: publish-witwin-radar.yml on witwin-ai/witwin-radar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file witwin_radar-0.2.0-cp312-cp312-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for witwin_radar-0.2.0-cp312-cp312-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 e001ee7f7316f4d7116d6aa09c2e2e435f10d508f67f38ae0953f0a62f7c7a0c
MD5 cca53632fe568bd5ef6934ec7179edeb
BLAKE2b-256 fba92c4904164a91b70cd5f8396fd00d17ba791f8ee966761ea8f0410a5a91a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for witwin_radar-0.2.0-cp312-cp312-manylinux_2_35_x86_64.whl:

Publisher: publish-witwin-radar.yml on witwin-ai/witwin-radar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file witwin_radar-0.2.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for witwin_radar-0.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 d8def4dbfeff0e7247328518f3cbb70a2bf027d97635916497e980ce6f7e9206
MD5 ec02e767c506726c1d3d9182c2582d94
BLAKE2b-256 21d55c1910c92a06e0384996b9d1bb42a436cdbda3544ae57e0d7318bac8f938

See more details on using hashes here.

Provenance

The following attestation bundles were made for witwin_radar-0.2.0-cp311-cp311-win_amd64.whl:

Publisher: publish-witwin-radar.yml on witwin-ai/witwin-radar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file witwin_radar-0.2.0-cp311-cp311-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for witwin_radar-0.2.0-cp311-cp311-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 11cea5de332fd78cedd16b7ad7c6f5d8861b0ff3ff43134ceea8c87297117a50
MD5 e121125294fae1a3ee356053bf936e81
BLAKE2b-256 bce1169a32293f83c9de2c8b25e76b50e79d75168a5437eb5e42da76f7b875a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for witwin_radar-0.2.0-cp311-cp311-manylinux_2_35_x86_64.whl:

Publisher: publish-witwin-radar.yml on witwin-ai/witwin-radar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file witwin_radar-0.2.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for witwin_radar-0.2.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 2fa27f332fd2bda96771a2e640b8364e03aff124510739ed41b75a6ee36aa0cd
MD5 d44fd214aefbaf16f619c23a74811877
BLAKE2b-256 61332ef980dd1ed7022b0cda21da0cf1de50d49281cd67380bacb730614c29e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for witwin_radar-0.2.0-cp310-cp310-win_amd64.whl:

Publisher: publish-witwin-radar.yml on witwin-ai/witwin-radar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file witwin_radar-0.2.0-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for witwin_radar-0.2.0-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 55b8ee5ae742981124e8782a981e5272695edacfcd8652a044942be8a9e74189
MD5 225ca5b2244a13402bff1f530f094b3b
BLAKE2b-256 c70139aa4a4453243a24d50a8119fe7b79dd2775d3babc2bed4028d4f16a63c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for witwin_radar-0.2.0-cp310-cp310-manylinux_2_35_x86_64.whl:

Publisher: publish-witwin-radar.yml on witwin-ai/witwin-radar

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page