A standalone magpylib-based toolkit for
magnetic-field calculation, visualization, and coil-parameter optimization.
It is independent of the surrounding Quasar C++/HIP framework — it shares only
the YAML-deck ergonomics and the out.npz key contract of quasar.coil so
post-processing transfers.
All quantities are SI: positions in meters, currents in amperes, fields in tesla.
cd coil_design
uv sync # creates .venv and installs magpylib>=5, numpy, scipy, matplotlib, pyyaml# Compute B at the observation points in a deck; writes out.npz next to it
uv run coil-design run examples/single_loop/input.yaml
# Plot coil geometry and/or a field map (headless: writes a PNG)
uv run coil-design plot examples/helmholtz/input.yaml --save helmholtz.png
# Optimize free coil parameters toward a deck-defined objective
uv run coil-design optimize examples/helmholtz/input.yamlB_xyz—(N, 3)magnetic flux density in tesla.B_magnitude—(N,)|B|per observation point.dims— observation shape ([N]for a line,[ny, nx]for a grid).observation_kind—"point","line", or"grid2d".
units: SI
conductors:
- name: loop
current_A: 1.0
geometry:
type: circular_loop # circular_loop | polyline | helmholtz | solenoid
center_xyz: [0.0, 0.0, 0.0]
axis_xyz: [0.0, 0.0, 1.0]
radius_m: 0.1
observation:
type: line # point | line | grid2d
start_xyz: [0.0, 0.0, 0.0]
end_xyz: [0.0, 0.0, 0.2]
n_points: 5
output:
path: out.npzSee examples/*/README.md for per-case detail and analytical references.
uv run pytest -q