An ECRH ray tracer based on JAX
Project description
Raytrax
An ECRH ray tracer for fusion plasmas, built on JAX.
Raytrax simulates Electron Cyclotron Resonance Heating (ECRH) of magnetic confinement fusion plasmas. Powered by JAX, it features JIT-compiled ray tracing and automatic differentiation — making it well-suited for gradient-based beam optimization in fusion plant design.
Note: Raytrax is in early development. Expect API changes and incomplete validation. For details see the docs.
Usage
Load a magnetic equilibrium, define plasma profiles, and trace a beam:
import jax.numpy as jnp
import raytrax
import vmecpp
vmec_wout = vmecpp.VmecWOut.from_wout_file("w7x.nc")
mag_conf = raytrax.MagneticConfiguration.from_vmec_wout(vmec_wout)
rho = jnp.linspace(0, 1, 200)
profiles = raytrax.RadialProfiles(
rho=rho,
electron_density=2.0 * (1 - rho**2),
electron_temperature=3.0 * (1 - rho**2),
)
beam = raytrax.Beam(
position=jnp.array([6.6, 0.0, 0.0]),
direction=jnp.array([-0.985, 0.0, -0.174]),
frequency=140e9,
mode="O",
power=1e6,
)
result = raytrax.trace(mag_conf, profiles, beam)
print(f"Optical depth τ = {result.optical_depth:.3f}")
print(f"Absorbed fraction = {result.absorbed_power_fraction:.1%}")
print(f"Deposition at ρ = {result.deposition_rho_mean:.2f} ± {result.deposition_rho_std:.2f}")
Visualizations
Beam trace on a poloidal cross-section
3D visualization
Raytrax can render flux surfaces and beam trajectories in 3D using PyVista:
import pyvista as pv
from raytrax.plot.plot3d import plot_flux_surface_3d, plot_beam_profile_3d
plotter = pv.Plotter()
plot_flux_surface_3d(mag_conf, rho_value=1.0, plotter=plotter, opacity=0.25)
plot_beam_profile_3d(result.beam_profile, plotter=plotter, tube_radius=0.02)
plotter.export_html("scene.html") # interactive standalone HTML
Try out a live interactive version in the docs.
Jupyter Notebooks
Quick-start notebooks are in the notebooks/ directory.
Installation
python -m pip install raytrax
See the documentation for a full getting-started guide, theory background, and API reference.
Citing Raytrax
If you use Raytrax in your research, please cite it via Zenodo: doi:10.5281/zenodo.18924104.
Acknowledgements
The development of Raytrax is a collaboration between Proxima Fusion and the Munich University of Applied Sciences (HM) and was partially supported by the German Federal Ministry of Research, Technology and Space (BMFTR) under grant FPP-MC (13F1001B).
License
Raytrax is released under the MIT License. See LICENSE.md for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file raytrax-0.4.0.tar.gz.
File metadata
- Download URL: raytrax-0.4.0.tar.gz
- Upload date:
- Size: 587.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4add08bf497710141cb00a55f85eeb31c8feecec43f3341c35cef4b428bd2948
|
|
| MD5 |
3f39c029280c291ab1e2a86e9764d0c8
|
|
| BLAKE2b-256 |
42558ca32520038001f618a5e3f47cc5cac82c7823246c2e44f51643bababbb9
|
Provenance
The following attestation bundles were made for raytrax-0.4.0.tar.gz:
Publisher:
publish.yml on proximafusion/raytrax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
raytrax-0.4.0.tar.gz -
Subject digest:
4add08bf497710141cb00a55f85eeb31c8feecec43f3341c35cef4b428bd2948 - Sigstore transparency entry: 1197569337
- Sigstore integration time:
-
Permalink:
proximafusion/raytrax@03ef43d11daeca746cdaf9fe169deaca54e6ab2a -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/proximafusion
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@03ef43d11daeca746cdaf9fe169deaca54e6ab2a -
Trigger Event:
push
-
Statement type:
File details
Details for the file raytrax-0.4.0-py3-none-any.whl.
File metadata
- Download URL: raytrax-0.4.0-py3-none-any.whl
- Upload date:
- Size: 57.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3886cdbcba4508585544b9a5362432e5f071641ba96b6c085ae1d18f2d02d960
|
|
| MD5 |
627249ad0eabdef1f86817ca99c63726
|
|
| BLAKE2b-256 |
7eb60cf0aaabb75b1e7c654ebd066858c5f38903966d49b8af996241b3b66152
|
Provenance
The following attestation bundles were made for raytrax-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on proximafusion/raytrax
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
raytrax-0.4.0-py3-none-any.whl -
Subject digest:
3886cdbcba4508585544b9a5362432e5f071641ba96b6c085ae1d18f2d02d960 - Sigstore transparency entry: 1197569398
- Sigstore integration time:
-
Permalink:
proximafusion/raytrax@03ef43d11daeca746cdaf9fe169deaca54e6ab2a -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/proximafusion
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@03ef43d11daeca746cdaf9fe169deaca54e6ab2a -
Trigger Event:
push
-
Statement type: