WiTwin Core

WiTwin Core (pip install witwin) is the shared, solver-neutral world model of WiTwin - scenes, geometry, materials, antennas and motion.

WiTwin Core (witwin on PyPI, imported as witwin.core) describes a physical world in a form every WiTwin solver can read. A Scene holds structures (a geometry plus a material) and antenna endpoints. Optional trajectories and deformations make it move over time. Core does not simulate anything. Maxwell, Radar and Channel each take a Core scene and compile it into their own GPU resources.

Use Core directly when you:

  • build a scene once and hand it to more than one solver;
  • need differentiable geometry: signed distances, soft occupancy masks and triangle meshes that keep the PyTorch autograd graph;
  • write a solver or a tool that must understand WiTwin scenes.

This documentation covers witwin 0.4.0. It is a pure-Python package that needs CPython 3.10 to 3.14, PyTorch 2.10 or newer and NumPy 1.24 or newer. See Installation.

Example#

Describe a room with one wall and two antennas, and ask the wall for its complex permittivity at 3.5 GHz:

from witwin.core import AntennaState, Box, PhysicalMaterial, Scene, Structure
 
concrete = PhysicalMaterial(eps_r=5.24, sigma_e=0.05, name="concrete")
wall = Structure(Box(position=(4.0, 0.0, 1.5), size=(0.2, 6.0, 3.0)), concrete, name="wall")
scene = Scene(
    structures=[wall],
    endpoints=[AntennaState(1, "tx", (0.0, 0.0, 1.5)), AntennaState(2, "rx", (2.0, 0.0, 1.5))],
)
 
print(concrete.evaluate_at_frequency(3.5e9).eps_r)  # (5.24-0.25678719406460493j)

What Core provides#

AreaNames
WorldScene, SceneSnapshot, SceneVersions, Structure, MaterialAssignment
GeometryBox, Sphere, Cylinder, Cone, Ellipsoid, Pyramid, Prism, Torus, HollowBox, Mesh
MaterialsPhysicalMaterial, MaterialLayer, SurfaceRoughness, PhaseScreen, PowerLawDispersion
AntennasAntennaState, ReceiverGrid, AntennaPattern
MotionDynamicScene, LinearTrajectory, RigidMotion, DeformationState
IdentityStructureId, MaterialId and the other ID types, new_*_id, reserve_*_id
Mathquaternion helpers, normalize_vec3, ScalarLike, ComplexLike

The supported public API is exactly the set of names in witwin.core.__all__. Import from witwin.core. Other modules can change between releases.

How Core fits in WiTwin#

Core sits under the solvers. witwin-channel 0.5.0 requires witwin==0.4.0; witwin-maxwell 0.5.1 and witwin-radar 0.4.1 require witwin>=0.4,<0.5. Each solver installs Core for you. Maxwell re-exports the Core geometry classes, and its Material extends PhysicalMaterial. Channel and Radar take a Core Scene or DynamicScene as input.

Where to go next#

Core is released under the MIT license.