Architecture and Source Map¶
This page is the shortest path from the public API to the underlying analytical kernels.
Layered structure¶
The repository is organized in layers.
Public API layer¶
This layer handles:
object construction,
compatibility-oriented
getB/getH/getJ/getMbehavior,source/sensor formatting,
path and orientation semantics,
pixel aggregation,
squeeze and broadcasting behavior.
Object base layer¶
This layer handles:
shared object state,
path mutation semantics,
orientation storage and caching,
validation of constructor and motion inputs,
lightweight style compatibility.
Geometry and kernel layer¶
This is where the actual field formulas live.
Source wrappers¶
Current-driven sources:
Magnet sources:
Miscellaneous sources:
How getB flows through the code¶
A typical high-level getB call follows this path:
Validate inputs and normalize source/sensor descriptors.
Prepare source tensors and sensor tensors, reusing caches where possible.
Group homogeneous source families for efficient batched evaluation.
Call the matching analytical kernel.
Rotate the resulting field back to the global frame.
Apply sensor aggregation and Magpylib-compatible squeeze behavior.
The orchestration lives in functional.py.
Where to profile¶
If the issue is:
compile time or HLO size: start in
scripts/profile_kernels.pyhigh-level
getBoverhead: start inscripts/profile_getB_jit.pylarge loop/coil workloads: start in
scripts/profile_wham_workload.py