Solvers
deterministic, montecarlo, and path solver API reference
Overview#
WiTwin Channel has three solver packages, all following the same pattern:
result = wc.<solver>.solve(scene=scene, transmitter="tx", receiver="rm", config=config)All three are lazy-loaded on first access — import witwin.channel as wc and use wc.deterministic, wc.montecarlo, or wc.path directly.
Deterministic solver#
Fast, repeatable radiomap over a ReceiverGrid. Use this as your default solver.
result = wc.deterministic.solve(
scene=scene,
transmitter="tx",
receiver="rm",
config=wc.deterministic.Config(
num_samples=256,
max_bounces=2,
max_diffraction_order=1,
edge_policy=wc.EdgePolicy(edge_selection_mode="all_edges"),
),
)wc.deterministic.Config#
| Parameter | Default | Description |
|---|---|---|
num_samples | 10000 | Number of rays |
max_bounces | 2 | Maximum reflection bounces. Must be >= 0 |
max_diffraction_order | 1 | Maximum diffraction order. Must be >= 0 |
metric | "path_gain" | Output metric. One of "path_gain", "rss", "sinr" |
quadrature_mode | "center" | Cell quadrature mode. One of "center", "stratified_fixed_n" |
samples_per_cell | None | Samples per cell for "stratified_fixed_n" mode |
shadow_boundary_correction | False | Enable shadow boundary correction |
synthetic_array | True | Use synthetic antenna array |
edge_policy | None | Edge selection policy |
tuning | None | Advanced controls via wc.deterministic.Tuning |
wc.deterministic.solve() result#
Returns a RadioMapResult with:
| Field | Description |
|---|---|
path_gain | Signal path gain at every grid point |
rss | Received signal strength |
sinr | Signal-to-interference-plus-noise ratio |
components | Per-component breakdown ("los", "reflection", "diffraction") |
coords | Grid coordinates via RadioMapCoordinates |
Field solver#
The deterministic package also exposes solve_field() for computing the full EM field on a plane. See Field Simulation.
Monte Carlo solver#
Sampling-based radiomap using transmitter-driven ray integration. Use when you need stochastic integration over complex scenes.
result = wc.montecarlo.solve(
scene=scene,
transmitter="tx",
receiver="rm",
config=wc.montecarlo.Config(
num_samples=128,
max_bounces=1,
max_diffraction_order=1,
integrator_options=wc.montecarlo.IntegratorOptions(
integrator="basic",
samples_per_tx=4096,
seed=7,
),
),
)wc.montecarlo.Config#
| Parameter | Default | Description |
|---|---|---|
num_samples | 10000 | Number of rays |
max_bounces | 2 | Maximum reflection bounces. Must be >= 0 |
max_diffraction_order | 1 | Maximum diffraction order. Range [0, 3]. "basic" integrator supports [0, 1] only |
synthetic_array | True | Use synthetic antenna array |
edge_policy | None | Edge selection policy |
integrator_options | None | Integrator controls via IntegratorOptions |
filtering | None | Differentiable power filtering via FilterConfig |
tuning | None | Advanced controls via wc.montecarlo.Tuning |
wc.montecarlo.IntegratorOptions#
| Parameter | Default | Description |
|---|---|---|
integrator | "basic" | Integrator type. One of "basic", "bdpt" |
samples_per_tx | 65536 | Samples per transmitter |
seed | 0 | Random seed |
accumulation_backend | "auto" | Backend. One of "auto", "native_monte_carlo", "rayd_reflection_accumulation" |
rr_depth | None | Russian roulette start depth |
rr_prob | None | Russian roulette survival probability. Range (0, 1] |
stop_threshold | None | Ray contribution stop threshold |
ad | None | Force autodiff mode on or off |
wc.montecarlo.FilterConfig#
Optional differentiable power-domain filtering for gradient smoothing:
wc.montecarlo.FilterConfig(
reflection=wc.montecarlo.ComponentFilterConfig(method="gaussian", radius=1, sigma=1.0),
diffraction=wc.montecarlo.ComponentFilterConfig(method="bilateral", radius=2, sigma=1.0),
)wc.montecarlo.ComponentFilterConfig#
| Parameter | Default | Description |
|---|---|---|
method | "gaussian" | Filter method. One of "gaussian", "bilateral" |
radius | 1 | Filter radius in cells. Must be >= 0 |
sigma | 1.0 | Spatial sigma. Must be > 0 |
range_sigma | None | Range sigma for bilateral filter. Defaults to sigma |
blend | 1.0 | Blend weight. Range [0, 1] |
Result#
Returns a RadioMapResult with the same fields as the deterministic solver.
Path solver#
Discrete per-receiver path export. Use when you need CIR, CFR, or individual path data.
path_result = wc.path.solve(
scene=scene,
transmitter="tx",
receiver=["rx0", "rx1"],
config=wc.path.Config(
num_samples=256,
max_bounces=1,
max_diffraction_order=0,
max_num_paths=8,
return_geometry=True,
edge_policy=wc.EdgePolicy(edge_selection_mode="all_edges"),
),
)Note
The path solver requires named Receiver endpoints, not ReceiverGrid. Pass receiver names as a string or list of strings.
wc.path.Config#
| Parameter | Default | Description |
|---|---|---|
num_samples | 10000 | Number of rays |
max_bounces | 2 | Maximum reflection bounces. Must be >= 0 |
max_diffraction_order | 1 | Maximum diffraction order. Must be >= 0 |
max_num_paths | None | Maximum paths to return per receiver. Must be > 0 when set |
return_geometry | False | Return per-path vertex, normal, and object data |
synthetic_array | True | Use synthetic antenna array |
edge_policy | None | Edge selection policy |
tuning | None | Advanced controls via wc.path.Tuning |
PathResult methods#
| Method | Description |
|---|---|
.cir(normalize_delays=True) | Returns (coefficients, delays) as torch tensors |
.cfr(frequencies, normalize_delays=True) | Channel frequency response over subcarrier frequencies |
.taps(bandwidth, num_taps, normalize_delays=True) | Discrete channel taps at a given bandwidth |
.filter_by_type(*interaction_types) | Filter paths by InteractionType |
PathResult fields#
| Field | Description |
|---|---|
a | Complex path coefficients |
tau | Path delays |
theta_t, phi_t | Angle of departure (elevation, azimuth) |
theta_r, phi_r | Angle of arrival (elevation, azimuth) |
valid | Boolean mask for valid paths |
types | Interaction types per depth slot |
num_paths | Number of valid paths per receiver |
vertices | Path vertex positions (if return_geometry=True) |
normals | Surface normals at interaction points (if return_geometry=True) |
InteractionType#
wc.path.InteractionType.REFLECTION
wc.path.InteractionType.DIFFRACTION
wc.path.InteractionType.TRANSMISSION
wc.path.InteractionType.SCATTERINGNext Steps#
- Scene API — build scenes for simulation
- Neural Networks — differentiate through solver outputs