Simulation#
Point targets, propagation paths, scene sampling, and optional mesh ray tracing
live in pyradar.sim. ADC synthesis uses the same waveform, array, and
MIMO timing contracts as the processing pipeline.
Model-aware radar simulation.
The core point-target simulator depends only on NumPy. Mesh ray tracing is
loaded lazily and requires the simulation optional dependency.
- class pyradar.sim.PointTarget(position, velocity=<factory>, rcs=1.0, phase=0.0)[source]#
Bases:
objectIdeal isotropic point target in the radar FLU frame.
- Parameters:
- position:
Target position at time zero as
[x, y, z]in meters.- velocity:
Constant Cartesian velocity in meters per second.
- rcs:
Monostatic radar cross section in square meters. Its square root is used as the complex field amplitude before optional propagation loss.
- phase:
Additional reflection phase in radians.
- Parameters:
- position: NDArray[float64]#
- velocity: NDArray[float64]#
- class pyradar.sim.PropagationPath(pathLength, txId, rxId, pathRate=0.0, amplitude=1 + 0j)[source]#
Bases:
objectOne bistatic propagation path at the beginning of a frame.
pathRateis positive when the total TX-target-RX path length is increasing. Consequently, an approaching target produces positive Doppler frequency and has a negative path rate.
- class pyradar.sim.RangeImage(ranges, azimuth, elevation, pointIndices, features=None)[source]#
Bases:
objectNearest-return angular projection of a point scene.
- Parameters:
ranges (NDArray[float64])
azimuth (NDArray[float64])
elevation (NDArray[float64])
pointIndices (NDArray[int64])
features (NDArray | None)
- ranges: NDArray[float64]#
- azimuth: NDArray[float64]#
- elevation: NDArray[float64]#
- pointIndices: NDArray[int64]#
- class pyradar.sim.RayPath(points, hitReceiver, gain=1 + 0j)[source]#
Bases:
objectPiecewise-linear SBR path.
- points: NDArray[float64]#
- class pyradar.sim.RayTraceResult(origins, directions, hitMask, points, distances, triangleIndices)[source]#
Bases:
objectFirst mesh intersection for each input ray.
- Parameters:
origins (NDArray[float64])
directions (NDArray[float64])
hitMask (NDArray[bool])
points (NDArray[float64])
distances (NDArray[float64])
triangleIndices (NDArray[int64])
- origins: NDArray[float64]#
- directions: NDArray[float64]#
- points: NDArray[float64]#
- distances: NDArray[float64]#
- triangleIndices: NDArray[int64]#
- class pyradar.sim.TargetScene(targets)[source]#
Bases:
objectAn immutable collection of point targets.
- Parameters:
targets (tuple[PointTarget, ...])
- targets: tuple[PointTarget, ...]#
- classmethod from_points(points, *, velocities=None, rcs=1.0, phase=0.0)[source]#
Build one point target per row of an
(N, 3)point cloud.- Parameters:
- Return type:
- classmethod coerce(targets)[source]#
Normalize a target or target sequence into a scene.
- Parameters:
targets (PointTarget | Sequence[PointTarget] | TargetScene)
- Return type:
- class pyradar.sim.TrimeshRayTracer(mesh)[source]#
Bases:
objectLazy optional Trimesh first-hit and specular SBR backend.
- Parameters:
mesh (Any)
- classmethod from_file(path, *, process=False)[source]#
Load a mesh file without importing Trimesh at package import time.
- Parameters:
- Return type:
- trace(origins, directions)[source]#
Return the nearest mesh hit for every ray.
- Parameters:
origins (ArrayLike)
directions (ArrayLike)
- Return type:
- pyradar.sim.fresnel_schlick(cosine, incidentIndex, transmittedIndex)[source]#
Return Schlick’s unpolarized power-reflection approximation.
- pyradar.sim.linear_trajectory(start, stop, *, numFrames)[source]#
Return
(numFrames, 4, 4)FLU poses along a straight line.- Parameters:
start (ArrayLike)
stop (ArrayLike)
numFrames (int)
- Return type:
NDArray[float64]
- pyradar.sim.quantize_adc(frame, *, bitDepth=None, fullScale=None)[source]#
Quantize complex ADC components while retaining a complex array.
- pyradar.sim.reflect(direction, normal)[source]#
Specularly reflect one direction around a surface normal.
- Parameters:
direction (ArrayLike)
normal (ArrayLike)
- Return type:
NDArray[float64]
- pyradar.sim.refract(direction, normal, incidentIndex, transmittedIndex)[source]#
Apply Snell’s law, returning
Nonefor total internal reflection.
- pyradar.sim.render_range_image(points, *, radarPose=None, azimuthFov=(-1.5707963267948966, 1.5707963267948966), elevationFov=(-0.7853981633974483, 0.7853981633974483), angularResolution=(np.float64(0.017453292519943295), np.float64(0.017453292519943295)), maxRange=inf, features=None)[source]#
Project world points into a nearest-return azimuth/elevation image.
- pyradar.sim.sample_cone_directions(numRays, coneAngle, *, forward=(1.0, 0.0, 0.0), seed=None)[source]#
Uniformly sample unit directions within a cone in radians.
- pyradar.sim.sample_plane(*, width=1.0, height=1.0, numPoints=1000, center=(1.0, 0.0, 0.0), seed=None)[source]#
Sample a y-z plane facing the radar’s forward x direction.
- pyradar.sim.sample_sphere(*, radius=1.0, numPoints=1000, center=(0.0, 0.0, 0.0), seed=None)[source]#
Uniformly sample points on a sphere surface.
- pyradar.sim.simulate_adc(radar, targets, *, frameTime=0.0, propagationLoss=False, noisePower=0.0, seed=None, frameId=None)[source]#
Synthesize one raw ADC frame from ideal point targets.
- Parameters:
radar (Radar)
targets (PointTarget | Sequence[PointTarget] | TargetScene)
frameTime (float)
propagationLoss (bool)
noisePower (float)
seed (int | None)
- Return type:
- pyradar.sim.simulate_paths(radar, paths, *, noisePower=0.0, seed=None, timestamp=None, frameId=None)[source]#
Synthesize canonical raw ADC from fixed linear propagation paths.
The phase convention matches
pyradar.rsp.steering_vector(): an approaching path has negativepathRateand produces positive Doppler. MIMO coding and true emission times are taken fromradar.mimo.
- pyradar.sim.targets_to_paths(radar, targets, *, frameTime=0.0, propagationLoss=False)[source]#
Convert point targets into one bistatic path per TX/RX pair.
- Parameters:
radar (Radar)
targets (PointTarget | Sequence[PointTarget] | TargetScene)
frameTime (float)
propagationLoss (bool)
- Return type:
tuple[PropagationPath, …]