Skip to main content

An ECRH ray tracer based on JAX

Project description

Raytrax

An ECRH ray tracer for fusion plasmas, built on JAX.

CI License: MIT Python ≥ 3.11 Documentation

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

ECRH beam trace on W7-X R-Z 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
3D visualization of W7-X flux surface and ECRH beam

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.

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).

Proxima Fusion      HM      BMFTR

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

raytrax-0.0.1.tar.gz (575.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raytrax-0.0.1-py3-none-any.whl (53.9 kB view details)

Uploaded Python 3

File details

Details for the file raytrax-0.0.1.tar.gz.

File metadata

  • Download URL: raytrax-0.0.1.tar.gz
  • Upload date:
  • Size: 575.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for raytrax-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1d64d8df96a5b9f4ba302e3ccb8beb4116338136e92eabea41ccb008340a3d19
MD5 4c4bf83e5df4f79c42b6a99d7a849d5a
BLAKE2b-256 e086f97ac7c9a016b00faeb55f3b31d25daf1f6dbaa4b6ce0a737008b109683b

See more details on using hashes here.

Provenance

The following attestation bundles were made for raytrax-0.0.1.tar.gz:

Publisher: publish.yml on proximafusion/raytrax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file raytrax-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: raytrax-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 53.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for raytrax-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cd629036f056dfb85cf081fd18fb159ac22d5a086933500f89b87871f4a230fb
MD5 1ab9891324711b81b25f170b2d1dd887
BLAKE2b-256 870d20c48f9511c277d57a90f05169965d5d1c222cbc034c9f4cfb18cf09ba9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for raytrax-0.0.1-py3-none-any.whl:

Publisher: publish.yml on proximafusion/raytrax

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page