A Python toolkit for open-source electromagnetic simulation with Palace and Gmsh. PalaceToolkit provides a declarative pipeline that takes you from geometry definition to post-processed S-parameters and far-field plots — no commercial licence required.
| Module | Description |
|---|---|
palacetoolkit.mesh |
Priority-based boolean pipeline for multi-material Gmsh models with automatic size-field grading. |
palacetoolkit.simulation |
Run Palace via downloaded runtime or optional Apptainer/SIF and extract S-parameters and impedance. |
palacetoolkit.verify_topology |
Validate that a 3D tetrahedral mesh is topologically consistent for Palace/MFEM. |
palacetoolkit.analytic |
Closed-form transmission-line formulas (CPW impedance, effective index, …). |
palacetoolkit.postpro |
Quick matplotlib plots of Palace S-parameter CSV files. |
palacetoolkit.viz |
Interactive PyVista mesh viewer with per-group colouring. |
palacetoolkit.utils |
Headless-safe visualisation helpers that export standalone HTML for docs and notebooks. |
- Python ≥ 3.8
- Gmsh (the
gmshPython package is pulled automatically)
python -m venv .venv
source .venv/bin/activate
pip install palace-toolkitThis installs palace-toolkit and, on Linux x86_64, fetches the matching
prebuilt Palace CPU runtime on first use.
Optional (Linux x86_64) prebuilt runtime install:
palace-toolkit-install-binarypalace-toolkit-checkExpected output includes:
Palace runtime check: OK- resolved runtime mode/path
- Palace version line from
--version
If you run inside WSL, you may need extra system libraries for runtime and plotting:
sudo apt update
sudo apt install -y libglu1-mesa-dev libgomp1 libxft2 openmpi-bin libopenmpi-dev libopenblas0
Matplotlib may default to a non-interactive backend (FigureCanvasAgg).
If you want interactive plot windows:
sudo apt install -y python3-tkThen set a GUI backend in ~/.config/matplotlib/matplotlibrc:
backend: TkAgg
- Stable releases of
palace-toolkitare validated against a matching stable release ofpalacetoolkit-palace-cpu. - The default user install path is
pip install palace-toolkit. - A local clone/editable workflow is still supported for contributors.
- Nightly Palace builds are supported for power users through opt-in source builds and are treated as best-effort (no stability guarantee across commits).
- If API/runtime behavior differs between stable and nightly Palace,
palace-toolkitstable behavior is defined by the stablepalacetoolkit-palace-cpuline.
See docs/getting-started/compatibility-policy.md for the full policy and release cadence.
palace-cpu-vX.Y.Ztriggers binary build/publish workflow forpalacetoolkit-palace-cpu.vX.Y.Ztriggers main package build/publish workflow forpalace-toolkit.- Both workflows also support manual dispatch from GitHub Actions.
See docs/examples/ notebooks for worked examples covering waveguides,
dipole antennas, horn antennas, and planar microwave circuits.
The documentation site is built with PyData Sphinx Theme. A justfile automates the full pipeline.
# Install docs dependencies (if not already)
pip install -e ".[docs]"
# Register the virtualenv as a Jupyter kernel
just ipykernel
# Full build: execute notebooks → build site
just docs-full
# Run documentation doctests (executes notebooks and fails on errors)
just doctest
# Or run each step individually:
just nbrun # execute docs example notebooks with papermill
just nbdocs # no-op (Sphinx renders .ipynb directly)
just docs # build the Sphinx static site (strict mode)
# Serve locally for development
just serve # starts a dev server on http://localhost:8080The documentation site is deployed to GitHub Pages. On every push to main,
the .github/workflows/docs.yml workflow builds the Sphinx site and publishes
it automatically.
- In the GitHub repository settings: Settings → Pages → Build and deployment → Source: GitHub Actions.
- The docs site will be available at
https://<owner>.github.io/<repository>/.
-
Build the site locally:
pip install -e ".[docs]" just ipykernel just docs-full -
Push the built
site/contents (or just push tomain— the workflow rebuilds and deploys from the source).
You can also trigger a deploy manually from the Actions tab using the
PalaceToolkit Docs workflow (workflow_dispatch).
The previous EpsilonForge.com deploy setup (SST + AWS CloudFront Router) has been removed from this repository. See
DEPLOYING-DOCS.mdif you need to reproduce that setup in another package.
| Recipe | Description |
|---|---|
just nbclean |
Strip cell outputs from docs example notebooks for clean commits. |
- Interactive 3D viewer for docs — Currently, mesh visualisations in the
documentation are static PNG screenshots. A future enhancement will embed an
interactive VTK.js viewer powered by
trame or PyVista's
export_html, giving readers the ability to rotate, pan, and inspect 3D meshes directly in the browser without leaving the documentation page.