raytrax 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- raytrax-0.0.1/.github/dependabot.yml +21 -0
- raytrax-0.0.1/.github/workflows/docs.yml +49 -0
- raytrax-0.0.1/.github/workflows/publish.yml +41 -0
- raytrax-0.0.1/.github/workflows/test.yml +49 -0
- raytrax-0.0.1/.gitignore +231 -0
- raytrax-0.0.1/.pre-commit-config.yaml +7 -0
- raytrax-0.0.1/CLAUDE.md +41 -0
- raytrax-0.0.1/CODEOWNERS +1 -0
- raytrax-0.0.1/LICENSE.md +21 -0
- raytrax-0.0.1/PKG-INFO +130 -0
- raytrax-0.0.1/README.md +97 -0
- raytrax-0.0.1/docs/3d-visualisation.md +66 -0
- raytrax-0.0.1/docs/acknowledgements.md +14 -0
- raytrax-0.0.1/docs/api.md +194 -0
- raytrax-0.0.1/docs/assets/bmftr.svg +35 -0
- raytrax-0.0.1/docs/assets/extra.css +15 -0
- raytrax-0.0.1/docs/assets/proxima.svg +73 -0
- raytrax-0.0.1/docs/assets/readme_3d.png +0 -0
- raytrax-0.0.1/docs/assets/readme_beam_trace.png +0 -0
- raytrax-0.0.1/docs/equilibrium.md +43 -0
- raytrax-0.0.1/docs/examples/README.md +8 -0
- raytrax-0.0.1/docs/examples/plot1d/README.md +4 -0
- raytrax-0.0.1/docs/examples/plot1d/plot_profiles.py +95 -0
- raytrax-0.0.1/docs/examples/plot2d/README.md +4 -0
- raytrax-0.0.1/docs/examples/plot2d/plot_beam_trace.py +162 -0
- raytrax-0.0.1/docs/examples/plot2d/plot_equilibrium.py +107 -0
- raytrax-0.0.1/docs/examples/poster/poster_w7x.py +515 -0
- raytrax-0.0.1/docs/getting-started.md +116 -0
- raytrax-0.0.1/docs/index.md +28 -0
- raytrax-0.0.1/docs/javascripts/mathjax.js +18 -0
- raytrax-0.0.1/docs/limitations.md +25 -0
- raytrax-0.0.1/docs/theory/absorption.md +84 -0
- raytrax-0.0.1/docs/theory/ray-tracing.md +82 -0
- raytrax-0.0.1/docs/theory.md +61 -0
- raytrax-0.0.1/gradient_optimization_example.py +194 -0
- raytrax-0.0.1/integration_tests/README.md +32 -0
- raytrax-0.0.1/integration_tests/conftest.py +3 -0
- raytrax-0.0.1/integration_tests/data/travis_w7x_reference.json +2116 -0
- raytrax-0.0.1/integration_tests/ecrh_w7x.py +475 -0
- raytrax-0.0.1/integration_tests/generate_travis_reference.py +81 -0
- raytrax-0.0.1/integration_tests/profile_w7x.py +303 -0
- raytrax-0.0.1/integration_tests/test_travis_comparison.py +257 -0
- raytrax-0.0.1/integration_tests/travis_wrapper.py +435 -0
- raytrax-0.0.1/mkdocs_gallery.yml +23 -0
- raytrax-0.0.1/notebooks/01_first_trace.ipynb +361 -0
- raytrax-0.0.1/notebooks/02_w7x_trace_and_visualization.ipynb +326 -0
- raytrax-0.0.1/notebooks/03_gradient_optimization.ipynb +351 -0
- raytrax-0.0.1/notebooks/README.md +9 -0
- raytrax-0.0.1/pyproject.toml +84 -0
- raytrax-0.0.1/scripts/generate_3d_html.py +79 -0
- raytrax-0.0.1/scripts/patch_gallery.py +77 -0
- raytrax-0.0.1/setup.cfg +4 -0
- raytrax-0.0.1/src/raytrax/__init__.py +20 -0
- raytrax-0.0.1/src/raytrax/api.py +271 -0
- raytrax-0.0.1/src/raytrax/equilibrium/__init__.py +1 -0
- raytrax-0.0.1/src/raytrax/equilibrium/data/w7x.json +711 -0
- raytrax-0.0.1/src/raytrax/equilibrium/fourier.py +291 -0
- raytrax-0.0.1/src/raytrax/equilibrium/interpolate.py +413 -0
- raytrax-0.0.1/src/raytrax/equilibrium/protocol.py +25 -0
- raytrax-0.0.1/src/raytrax/examples/__init__.py +24 -0
- raytrax-0.0.1/src/raytrax/examples/w7x.py +146 -0
- raytrax-0.0.1/src/raytrax/math/__init__.py +1 -0
- raytrax-0.0.1/src/raytrax/math/bessel.py +276 -0
- raytrax-0.0.1/src/raytrax/math/faddeeva.py +58 -0
- raytrax-0.0.1/src/raytrax/math/shkarofsky.py +116 -0
- raytrax-0.0.1/src/raytrax/math/utils.py +13 -0
- raytrax-0.0.1/src/raytrax/physics/__init__.py +1 -0
- raytrax-0.0.1/src/raytrax/physics/absorption.py +493 -0
- raytrax-0.0.1/src/raytrax/physics/dielectric_tensor.py +191 -0
- raytrax-0.0.1/src/raytrax/physics/dispersion.py +113 -0
- raytrax-0.0.1/src/raytrax/physics/distribution_function.py +81 -0
- raytrax-0.0.1/src/raytrax/physics/hamiltonian.py +119 -0
- raytrax-0.0.1/src/raytrax/physics/polarization.py +124 -0
- raytrax-0.0.1/src/raytrax/physics/power_flux.py +91 -0
- raytrax-0.0.1/src/raytrax/physics/quantities.py +51 -0
- raytrax-0.0.1/src/raytrax/plot/__init__.py +1 -0
- raytrax-0.0.1/src/raytrax/plot/plot1d.py +104 -0
- raytrax-0.0.1/src/raytrax/plot/plot2d.py +214 -0
- raytrax-0.0.1/src/raytrax/plot/plot3d.py +178 -0
- raytrax-0.0.1/src/raytrax/tracer/__init__.py +1 -0
- raytrax-0.0.1/src/raytrax/tracer/buffers.py +96 -0
- raytrax-0.0.1/src/raytrax/tracer/ray.py +50 -0
- raytrax-0.0.1/src/raytrax/tracer/solver.py +357 -0
- raytrax-0.0.1/src/raytrax/types.py +185 -0
- raytrax-0.0.1/src/raytrax.egg-info/PKG-INFO +130 -0
- raytrax-0.0.1/src/raytrax.egg-info/SOURCES.txt +112 -0
- raytrax-0.0.1/src/raytrax.egg-info/dependency_links.txt +1 -0
- raytrax-0.0.1/src/raytrax.egg-info/requires.txt +25 -0
- raytrax-0.0.1/src/raytrax.egg-info/top_level.txt +1 -0
- raytrax-0.0.1/tests/__init__.py +3 -0
- raytrax-0.0.1/tests/api_test.py +188 -0
- raytrax-0.0.1/tests/conftest.py +7 -0
- raytrax-0.0.1/tests/equilibrium/__init__.py +0 -0
- raytrax-0.0.1/tests/equilibrium/data_test.py +31 -0
- raytrax-0.0.1/tests/equilibrium/fourier_test.py +165 -0
- raytrax-0.0.1/tests/equilibrium/interpolate_test.py +683 -0
- raytrax-0.0.1/tests/fixtures.py +158 -0
- raytrax-0.0.1/tests/math/__init__.py +0 -0
- raytrax-0.0.1/tests/math/bessel_test.py +115 -0
- raytrax-0.0.1/tests/math/faddeeva_test.py +65 -0
- raytrax-0.0.1/tests/math/shkarofsky_test.py +218 -0
- raytrax-0.0.1/tests/math/utils_test.py +40 -0
- raytrax-0.0.1/tests/physics/__init__.py +0 -0
- raytrax-0.0.1/tests/physics/absorption_test.py +108 -0
- raytrax-0.0.1/tests/physics/dielectric_tensor_test.py +166 -0
- raytrax-0.0.1/tests/physics/dispersion_test.py +83 -0
- raytrax-0.0.1/tests/physics/polarization_test.py +70 -0
- raytrax-0.0.1/tests/physics/power_flux_test.py +98 -0
- raytrax-0.0.1/tests/plot/__init__.py +0 -0
- raytrax-0.0.1/tests/plot/plot2d_test.py +92 -0
- raytrax-0.0.1/tests/plot/plot3d_test.py +90 -0
- raytrax-0.0.1/tests/solver_test.py +123 -0
- raytrax-0.0.1/tests/types_test.py +71 -0
- raytrax-0.0.1/zensical.toml +79 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
- package-ecosystem: "pip"
|
|
4
|
+
directory: "/"
|
|
5
|
+
schedule:
|
|
6
|
+
interval: "weekly"
|
|
7
|
+
groups:
|
|
8
|
+
jax:
|
|
9
|
+
patterns:
|
|
10
|
+
- "jax*"
|
|
11
|
+
diffrax:
|
|
12
|
+
patterns:
|
|
13
|
+
- "diffrax"
|
|
14
|
+
- "interpax"
|
|
15
|
+
- "equinox"
|
|
16
|
+
- "optimistix"
|
|
17
|
+
|
|
18
|
+
- package-ecosystem: "github-actions"
|
|
19
|
+
directory: "/"
|
|
20
|
+
schedule:
|
|
21
|
+
interval: "weekly"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: Documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pages: write
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v5
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.13"
|
|
22
|
+
- name: Install system dependencies
|
|
23
|
+
run: sudo apt-get install -y libgl1 libegl1 xvfb
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: pip install ".[docs]"
|
|
26
|
+
- name: Generate gallery
|
|
27
|
+
run: |
|
|
28
|
+
mkdocs build -f mkdocs_gallery.yml
|
|
29
|
+
python scripts/patch_gallery.py
|
|
30
|
+
- name: Generate 3D HTML scenes
|
|
31
|
+
run: xvfb-run -a python scripts/generate_3d_html.py
|
|
32
|
+
- name: Build docs
|
|
33
|
+
run: zensical build --clean
|
|
34
|
+
- name: Upload pages artifact
|
|
35
|
+
if: github.ref == 'refs/heads/main'
|
|
36
|
+
uses: actions/upload-pages-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
path: site
|
|
39
|
+
|
|
40
|
+
deploy:
|
|
41
|
+
needs: build
|
|
42
|
+
if: github.ref == 'refs/heads/main'
|
|
43
|
+
environment:
|
|
44
|
+
name: github-pages
|
|
45
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/deploy-pages@v4
|
|
49
|
+
id: deployment
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- uses: actions/setup-python@v5
|
|
15
|
+
with:
|
|
16
|
+
python-version: "3.11"
|
|
17
|
+
|
|
18
|
+
- name: Build distribution
|
|
19
|
+
run: |
|
|
20
|
+
pip install build
|
|
21
|
+
python -m build
|
|
22
|
+
|
|
23
|
+
- uses: actions/upload-artifact@v4
|
|
24
|
+
with:
|
|
25
|
+
name: dist
|
|
26
|
+
path: dist/
|
|
27
|
+
|
|
28
|
+
publish:
|
|
29
|
+
needs: build
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
environment: pypi
|
|
32
|
+
permissions:
|
|
33
|
+
id-token: write # required for OIDC trusted publishing
|
|
34
|
+
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/download-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: dist
|
|
39
|
+
path: dist/
|
|
40
|
+
|
|
41
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: unit tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v6.0.2
|
|
14
|
+
- name: Set up Python
|
|
15
|
+
uses: actions/setup-python@v6.2.0
|
|
16
|
+
with:
|
|
17
|
+
python-version: '3.12'
|
|
18
|
+
- name: Install ruff
|
|
19
|
+
run: pip install ruff
|
|
20
|
+
- name: Ruff format check
|
|
21
|
+
run: ruff format --check .
|
|
22
|
+
- name: Ruff lint
|
|
23
|
+
run: ruff check .
|
|
24
|
+
|
|
25
|
+
build:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
strategy:
|
|
28
|
+
matrix:
|
|
29
|
+
python-version: ['3.11', '3.12', '3.13']
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v6.0.2
|
|
32
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
33
|
+
uses: actions/setup-python@v6.2.0
|
|
34
|
+
with:
|
|
35
|
+
python-version: ${{ matrix.python-version }}
|
|
36
|
+
- name: Install Python dependencies
|
|
37
|
+
run: |
|
|
38
|
+
python -m pip install --upgrade pip wheel
|
|
39
|
+
pip install pyvista vmecpp
|
|
40
|
+
pip install .[test,plot2d]
|
|
41
|
+
- name: Static type check with mypy
|
|
42
|
+
run: |
|
|
43
|
+
mypy --install-types --non-interactive --ignore-missing-imports src/raytrax
|
|
44
|
+
- name: Unit tests
|
|
45
|
+
run: |
|
|
46
|
+
pytest
|
|
47
|
+
- name: Integration tests
|
|
48
|
+
run: |
|
|
49
|
+
pytest integration_tests/ -m integration -v -s
|
raytrax-0.0.1/.gitignore
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Claude Code
|
|
2
|
+
.claude/
|
|
3
|
+
|
|
4
|
+
# Cached VMEC output (generated by get_w7x_equilibrium)
|
|
5
|
+
src/raytrax/equilibrium/data/w7x_wout.json
|
|
6
|
+
|
|
7
|
+
# Generated integration test output
|
|
8
|
+
integration_tests/data/rho_comparison.txt
|
|
9
|
+
|
|
10
|
+
# NetCDF files (VMEC)
|
|
11
|
+
*.nc
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# Byte-compiled / optimized / DLL files
|
|
15
|
+
__pycache__/
|
|
16
|
+
*.py[codz]
|
|
17
|
+
*$py.class
|
|
18
|
+
|
|
19
|
+
# C extensions
|
|
20
|
+
*.so
|
|
21
|
+
|
|
22
|
+
# ParaView files
|
|
23
|
+
*.vts
|
|
24
|
+
*.vtk
|
|
25
|
+
|
|
26
|
+
# Distribution / packaging
|
|
27
|
+
.Python
|
|
28
|
+
build/
|
|
29
|
+
develop-eggs/
|
|
30
|
+
dist/
|
|
31
|
+
downloads/
|
|
32
|
+
eggs/
|
|
33
|
+
.eggs/
|
|
34
|
+
lib/
|
|
35
|
+
lib64/
|
|
36
|
+
parts/
|
|
37
|
+
sdist/
|
|
38
|
+
var/
|
|
39
|
+
wheels/
|
|
40
|
+
share/python-wheels/
|
|
41
|
+
*.egg-info/
|
|
42
|
+
.installed.cfg
|
|
43
|
+
*.egg
|
|
44
|
+
MANIFEST
|
|
45
|
+
|
|
46
|
+
# PyInstaller
|
|
47
|
+
# Usually these files are written by a python script from a template
|
|
48
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
49
|
+
*.manifest
|
|
50
|
+
*.spec
|
|
51
|
+
|
|
52
|
+
# Installer logs
|
|
53
|
+
pip-log.txt
|
|
54
|
+
pip-delete-this-directory.txt
|
|
55
|
+
|
|
56
|
+
# Unit test / coverage reports
|
|
57
|
+
htmlcov/
|
|
58
|
+
.tox/
|
|
59
|
+
.nox/
|
|
60
|
+
.coverage
|
|
61
|
+
.coverage.*
|
|
62
|
+
.cache
|
|
63
|
+
nosetests.xml
|
|
64
|
+
coverage.xml
|
|
65
|
+
*.cover
|
|
66
|
+
*.py.cover
|
|
67
|
+
.hypothesis/
|
|
68
|
+
.pytest_cache/
|
|
69
|
+
cover/
|
|
70
|
+
|
|
71
|
+
# Translations
|
|
72
|
+
*.mo
|
|
73
|
+
*.pot
|
|
74
|
+
|
|
75
|
+
# Django stuff:
|
|
76
|
+
*.log
|
|
77
|
+
local_settings.py
|
|
78
|
+
db.sqlite3
|
|
79
|
+
db.sqlite3-journal
|
|
80
|
+
|
|
81
|
+
# Flask stuff:
|
|
82
|
+
instance/
|
|
83
|
+
.webassets-cache
|
|
84
|
+
|
|
85
|
+
# Scrapy stuff:
|
|
86
|
+
.scrapy
|
|
87
|
+
|
|
88
|
+
# Sphinx documentation
|
|
89
|
+
docs/_build/
|
|
90
|
+
|
|
91
|
+
# PyBuilder
|
|
92
|
+
.pybuilder/
|
|
93
|
+
target/
|
|
94
|
+
|
|
95
|
+
# Jupyter Notebook
|
|
96
|
+
.ipynb_checkpoints
|
|
97
|
+
|
|
98
|
+
# IPython
|
|
99
|
+
profile_default/
|
|
100
|
+
ipython_config.py
|
|
101
|
+
|
|
102
|
+
# pyenv
|
|
103
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
104
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
105
|
+
# .python-version
|
|
106
|
+
|
|
107
|
+
# pipenv
|
|
108
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
109
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
110
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
111
|
+
# install all needed dependencies.
|
|
112
|
+
#Pipfile.lock
|
|
113
|
+
|
|
114
|
+
# UV
|
|
115
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
116
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
117
|
+
# commonly ignored for libraries.
|
|
118
|
+
#uv.lock
|
|
119
|
+
|
|
120
|
+
# poetry
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
122
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
123
|
+
# commonly ignored for libraries.
|
|
124
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
125
|
+
#poetry.lock
|
|
126
|
+
#poetry.toml
|
|
127
|
+
|
|
128
|
+
# pdm
|
|
129
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
130
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
131
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
132
|
+
#pdm.lock
|
|
133
|
+
#pdm.toml
|
|
134
|
+
.pdm-python
|
|
135
|
+
.pdm-build/
|
|
136
|
+
|
|
137
|
+
# pixi
|
|
138
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
139
|
+
#pixi.lock
|
|
140
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
141
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
142
|
+
.pixi
|
|
143
|
+
|
|
144
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
145
|
+
__pypackages__/
|
|
146
|
+
|
|
147
|
+
# Celery stuff
|
|
148
|
+
celerybeat-schedule
|
|
149
|
+
celerybeat.pid
|
|
150
|
+
|
|
151
|
+
# SageMath parsed files
|
|
152
|
+
*.sage.py
|
|
153
|
+
|
|
154
|
+
# Environments
|
|
155
|
+
.env
|
|
156
|
+
.envrc
|
|
157
|
+
.venv
|
|
158
|
+
env/
|
|
159
|
+
venv/
|
|
160
|
+
ENV/
|
|
161
|
+
env.bak/
|
|
162
|
+
venv.bak/
|
|
163
|
+
|
|
164
|
+
# Spyder project settings
|
|
165
|
+
.spyderproject
|
|
166
|
+
.spyproject
|
|
167
|
+
|
|
168
|
+
# Rope project settings
|
|
169
|
+
.ropeproject
|
|
170
|
+
|
|
171
|
+
# mkdocs documentation
|
|
172
|
+
/site
|
|
173
|
+
/site_gallery_tmp/
|
|
174
|
+
|
|
175
|
+
# mkdocs-gallery generated output
|
|
176
|
+
/docs/generated/
|
|
177
|
+
|
|
178
|
+
# Generated 3D HTML scenes (built by scripts/generate_3d_html.py)
|
|
179
|
+
/docs/assets/3d_scene_*.html
|
|
180
|
+
|
|
181
|
+
# mypy
|
|
182
|
+
.mypy_cache/
|
|
183
|
+
.dmypy.json
|
|
184
|
+
dmypy.json
|
|
185
|
+
|
|
186
|
+
# Pyre type checker
|
|
187
|
+
.pyre/
|
|
188
|
+
|
|
189
|
+
# pytype static type analyzer
|
|
190
|
+
.pytype/
|
|
191
|
+
|
|
192
|
+
# Cython debug symbols
|
|
193
|
+
cython_debug/
|
|
194
|
+
|
|
195
|
+
# PyCharm
|
|
196
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
197
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
198
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
199
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
200
|
+
#.idea/
|
|
201
|
+
|
|
202
|
+
# Abstra
|
|
203
|
+
# Abstra is an AI-powered process automation framework.
|
|
204
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
205
|
+
# Learn more at https://abstra.io/docs
|
|
206
|
+
.abstra/
|
|
207
|
+
|
|
208
|
+
# Visual Studio Code
|
|
209
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
210
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
211
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
212
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
213
|
+
# .vscode/
|
|
214
|
+
|
|
215
|
+
# Ruff stuff:
|
|
216
|
+
.ruff_cache/
|
|
217
|
+
|
|
218
|
+
# PyPI configuration file
|
|
219
|
+
.pypirc
|
|
220
|
+
|
|
221
|
+
# Cursor
|
|
222
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
223
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
224
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
225
|
+
.cursorignore
|
|
226
|
+
.cursorindexingignore
|
|
227
|
+
|
|
228
|
+
# Marimo
|
|
229
|
+
marimo/_static/
|
|
230
|
+
marimo/_lsp/
|
|
231
|
+
__marimo__/
|
raytrax-0.0.1/CLAUDE.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
## Project Overview
|
|
2
|
+
|
|
3
|
+
Raytrax is an ECRH (Electron Cyclotron Resonance Heating) ray tracer for fusion plasmas, built on JAX.
|
|
4
|
+
It traces microwave beams through magnetized plasma, computing absorption and power deposition profiles.
|
|
5
|
+
Key features: JIT compilation via JAX, automatic differentiation for gradient-based beam optimization.
|
|
6
|
+
|
|
7
|
+
## Commands
|
|
8
|
+
|
|
9
|
+
### Build & Install
|
|
10
|
+
Ensure you are working in a virtualenv before pip-installing anything.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install -e ".[test]" # dev install with test deps
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Lint & Format
|
|
17
|
+
```bash
|
|
18
|
+
ruff check . # lint
|
|
19
|
+
ruff format --check . # format check
|
|
20
|
+
ruff format . # auto-format
|
|
21
|
+
ruff check --fix . # auto-fix lint issues
|
|
22
|
+
mypy --install-types --non-interactive --ignore-missing-imports src/raytrax
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Pre-commit hooks run ruff check + ruff format automatically.
|
|
26
|
+
|
|
27
|
+
### Tests
|
|
28
|
+
```bash
|
|
29
|
+
pytest # all unit tests
|
|
30
|
+
pytest tests/solver_test.py # single test file
|
|
31
|
+
pytest -k "test_name" # single test by name
|
|
32
|
+
pytest integration_tests/ -m integration -v -s # integration tests (slower, needs vmecpp)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Test files use the `*_test.py` naming convention. Fixtures for magnetic configurations (W7-X, tokamak) are in `tests/fixtures.py` and re-exported via `tests/conftest.py`.
|
|
36
|
+
|
|
37
|
+
### Key Patterns
|
|
38
|
+
- **Source layout**: `src/raytrax/` is the package root, with subpackages `tracer/` (ODE solver, ray/buffer types), `physics/` (Hamiltonian, absorption, dielectric tensor, etc.), `equilibrium/` (VMEC Fourier evaluation, cylindrical interpolation, `WoutLike` protocol), `math/` (Bessel, Faddeeva, Shkarofsky), `plot/`, `examples/`.
|
|
39
|
+
- **64-bit precision required**: JAX must have `jax_enable_x64 = True` before import.
|
|
40
|
+
- **Differentiability**: `trace(..., trim=False)` keeps fixed-size padded arrays for use with `jax.grad`/`jax.jacfwd`. The `trim=True` default slices to valid entries but breaks AD.
|
|
41
|
+
- **Stellarator symmetry**: The solver maps toroidal angles to the fundamental domain `[0, π/nfp]` and applies symmetry transforms for B-field evaluation.
|
raytrax-0.0.1/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @DavidMStraub
|
raytrax-0.0.1/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present Proxima Fusion GmbH <info@proximafusion.com> and David Straub <david.straub@hm.edu>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
raytrax-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: raytrax
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: An ECRH ray tracer based on JAX
|
|
5
|
+
Author-email: David Straub <straub@protonmail.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/proximafusion/raytrax
|
|
7
|
+
Requires-Python: >=3.11
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE.md
|
|
10
|
+
Requires-Dist: jax
|
|
11
|
+
Requires-Dist: jaxtyping
|
|
12
|
+
Requires-Dist: numpy
|
|
13
|
+
Requires-Dist: scipy
|
|
14
|
+
Requires-Dist: interpax
|
|
15
|
+
Requires-Dist: diffrax>=0.7.1
|
|
16
|
+
Requires-Dist: beartype
|
|
17
|
+
Requires-Dist: vmecpp
|
|
18
|
+
Requires-Dist: safetensors
|
|
19
|
+
Requires-Dist: matplotlib
|
|
20
|
+
Provides-Extra: test
|
|
21
|
+
Requires-Dist: pytest; extra == "test"
|
|
22
|
+
Requires-Dist: mypy; extra == "test"
|
|
23
|
+
Requires-Dist: ruff; extra == "test"
|
|
24
|
+
Requires-Dist: pre-commit; extra == "test"
|
|
25
|
+
Provides-Extra: docs
|
|
26
|
+
Requires-Dist: zensical; extra == "docs"
|
|
27
|
+
Requires-Dist: mkdocstrings-python; extra == "docs"
|
|
28
|
+
Requires-Dist: mkdocs-gallery; extra == "docs"
|
|
29
|
+
Requires-Dist: pyvista[jupyter]; extra == "docs"
|
|
30
|
+
Provides-Extra: plot3d
|
|
31
|
+
Requires-Dist: pyvista[jupyter]; extra == "plot3d"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# Raytrax
|
|
35
|
+
|
|
36
|
+
**An ECRH ray tracer for fusion plasmas, built on JAX.**
|
|
37
|
+
|
|
38
|
+
[](https://github.com/proximafusion/raytrax/actions/workflows/test.yml)
|
|
39
|
+
[](https://opensource.org/licenses/MIT)
|
|
40
|
+
[](https://www.python.org/)
|
|
41
|
+
[](https://proximafusion.github.io/raytrax/)
|
|
42
|
+
|
|
43
|
+
Raytrax simulates Electron Cyclotron Resonance Heating (ECRH) of magnetic confinement fusion plasmas. Powered by [JAX](https://docs.jax.dev), it features JIT-compiled ray tracing and automatic differentiation — making it well-suited for gradient-based beam optimization in fusion plant design.
|
|
44
|
+
|
|
45
|
+
> **Note:** Raytrax is in early development. Expect API changes and incomplete validation. For details [see the docs](https://proximafusion.github.io/raytrax/limitations).
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
Load a magnetic equilibrium, define plasma profiles, and trace a beam:
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
import jax.numpy as jnp
|
|
53
|
+
import raytrax
|
|
54
|
+
import vmecpp
|
|
55
|
+
|
|
56
|
+
vmec_wout = vmecpp.VmecWOut.from_wout_file("w7x.nc")
|
|
57
|
+
mag_conf = raytrax.MagneticConfiguration.from_vmec_wout(vmec_wout)
|
|
58
|
+
|
|
59
|
+
rho = jnp.linspace(0, 1, 200)
|
|
60
|
+
profiles = raytrax.RadialProfiles(
|
|
61
|
+
rho=rho,
|
|
62
|
+
electron_density=2.0 * (1 - rho**2),
|
|
63
|
+
electron_temperature=3.0 * (1 - rho**2),
|
|
64
|
+
)
|
|
65
|
+
beam = raytrax.Beam(
|
|
66
|
+
position=jnp.array([6.6, 0.0, 0.0]),
|
|
67
|
+
direction=jnp.array([-0.985, 0.0, -0.174]),
|
|
68
|
+
frequency=140e9,
|
|
69
|
+
mode="O",
|
|
70
|
+
power=1e6,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
result = raytrax.trace(mag_conf, profiles, beam)
|
|
74
|
+
|
|
75
|
+
print(f"Optical depth τ = {result.optical_depth:.3f}")
|
|
76
|
+
print(f"Absorbed fraction = {result.absorbed_power_fraction:.1%}")
|
|
77
|
+
print(f"Deposition at ρ = {result.deposition_rho_mean:.2f} ± {result.deposition_rho_std:.2f}")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Visualizations
|
|
81
|
+
|
|
82
|
+
### Beam trace on a poloidal cross-section
|
|
83
|
+
|
|
84
|
+
<img src="docs/assets/readme_beam_trace.png" alt="ECRH beam trace on W7-X R-Z cross-section" width="380"/>
|
|
85
|
+
|
|
86
|
+
### 3D visualization
|
|
87
|
+
|
|
88
|
+
Raytrax can render flux surfaces and beam trajectories in 3D using [PyVista](https://pyvista.org):
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import pyvista as pv
|
|
92
|
+
from raytrax.plot.plot3d import plot_flux_surface_3d, plot_beam_profile_3d
|
|
93
|
+
|
|
94
|
+
plotter = pv.Plotter()
|
|
95
|
+
plot_flux_surface_3d(mag_conf, rho_value=1.0, plotter=plotter, opacity=0.25)
|
|
96
|
+
plot_beam_profile_3d(result.beam_profile, plotter=plotter, tube_radius=0.02)
|
|
97
|
+
plotter.export_html("scene.html") # interactive standalone HTML
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
<img src="docs/assets/readme_3d.png" alt="3D visualization of W7-X flux surface and ECRH beam" width="600"/>
|
|
101
|
+
|
|
102
|
+
> Try out a **[live interactive version](https://proximafusion.github.io/raytrax/3d-visualisation/)** in the docs.
|
|
103
|
+
|
|
104
|
+
## Jupyter Notebooks
|
|
105
|
+
|
|
106
|
+
Quick-start notebooks are in the [`notebooks/`](notebooks/) directory.
|
|
107
|
+
|
|
108
|
+
## Installation
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
python -m pip install raytrax
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
See the [documentation](https://proximafusion.github.io/raytrax/) for a full getting-started guide, theory background, and API reference.
|
|
115
|
+
|
|
116
|
+
## Acknowledgements
|
|
117
|
+
|
|
118
|
+
The development of Raytrax is a collaboration between [Proxima Fusion](https://www.proximafusion.com) and the [Munich University of Applied Sciences (HM)](https://www.hm.edu) and was partially supported by the German Federal Ministry of Research, Technology and Space (BMFTR) under grant FPP-MC (13F1001B).
|
|
119
|
+
|
|
120
|
+
<div align="center">
|
|
121
|
+
<img src="https://upload.wikimedia.org/wikipedia/commons/d/d3/Logo_Proxima_Fusion.svg" alt="Proxima Fusion" width="200"/>
|
|
122
|
+
|
|
123
|
+
<img src="https://upload.wikimedia.org/wikipedia/de/1/1e/Hochschule_f%C3%BCr_angewandte_Wissenschaften_M%C3%BCnchen_logo.svg" alt="HM" width="160"/>
|
|
124
|
+
|
|
125
|
+
<img src="docs/assets/bmftr.svg" alt="BMFTR" width="200"/>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
Raytrax is released under the MIT License. See [LICENSE.md](LICENSE.md) for details.
|
raytrax-0.0.1/README.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Raytrax
|
|
2
|
+
|
|
3
|
+
**An ECRH ray tracer for fusion plasmas, built on JAX.**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/proximafusion/raytrax/actions/workflows/test.yml)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://www.python.org/)
|
|
8
|
+
[](https://proximafusion.github.io/raytrax/)
|
|
9
|
+
|
|
10
|
+
Raytrax simulates Electron Cyclotron Resonance Heating (ECRH) of magnetic confinement fusion plasmas. Powered by [JAX](https://docs.jax.dev), it features JIT-compiled ray tracing and automatic differentiation — making it well-suited for gradient-based beam optimization in fusion plant design.
|
|
11
|
+
|
|
12
|
+
> **Note:** Raytrax is in early development. Expect API changes and incomplete validation. For details [see the docs](https://proximafusion.github.io/raytrax/limitations).
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
Load a magnetic equilibrium, define plasma profiles, and trace a beam:
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
import jax.numpy as jnp
|
|
20
|
+
import raytrax
|
|
21
|
+
import vmecpp
|
|
22
|
+
|
|
23
|
+
vmec_wout = vmecpp.VmecWOut.from_wout_file("w7x.nc")
|
|
24
|
+
mag_conf = raytrax.MagneticConfiguration.from_vmec_wout(vmec_wout)
|
|
25
|
+
|
|
26
|
+
rho = jnp.linspace(0, 1, 200)
|
|
27
|
+
profiles = raytrax.RadialProfiles(
|
|
28
|
+
rho=rho,
|
|
29
|
+
electron_density=2.0 * (1 - rho**2),
|
|
30
|
+
electron_temperature=3.0 * (1 - rho**2),
|
|
31
|
+
)
|
|
32
|
+
beam = raytrax.Beam(
|
|
33
|
+
position=jnp.array([6.6, 0.0, 0.0]),
|
|
34
|
+
direction=jnp.array([-0.985, 0.0, -0.174]),
|
|
35
|
+
frequency=140e9,
|
|
36
|
+
mode="O",
|
|
37
|
+
power=1e6,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
result = raytrax.trace(mag_conf, profiles, beam)
|
|
41
|
+
|
|
42
|
+
print(f"Optical depth τ = {result.optical_depth:.3f}")
|
|
43
|
+
print(f"Absorbed fraction = {result.absorbed_power_fraction:.1%}")
|
|
44
|
+
print(f"Deposition at ρ = {result.deposition_rho_mean:.2f} ± {result.deposition_rho_std:.2f}")
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Visualizations
|
|
48
|
+
|
|
49
|
+
### Beam trace on a poloidal cross-section
|
|
50
|
+
|
|
51
|
+
<img src="docs/assets/readme_beam_trace.png" alt="ECRH beam trace on W7-X R-Z cross-section" width="380"/>
|
|
52
|
+
|
|
53
|
+
### 3D visualization
|
|
54
|
+
|
|
55
|
+
Raytrax can render flux surfaces and beam trajectories in 3D using [PyVista](https://pyvista.org):
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
import pyvista as pv
|
|
59
|
+
from raytrax.plot.plot3d import plot_flux_surface_3d, plot_beam_profile_3d
|
|
60
|
+
|
|
61
|
+
plotter = pv.Plotter()
|
|
62
|
+
plot_flux_surface_3d(mag_conf, rho_value=1.0, plotter=plotter, opacity=0.25)
|
|
63
|
+
plot_beam_profile_3d(result.beam_profile, plotter=plotter, tube_radius=0.02)
|
|
64
|
+
plotter.export_html("scene.html") # interactive standalone HTML
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
<img src="docs/assets/readme_3d.png" alt="3D visualization of W7-X flux surface and ECRH beam" width="600"/>
|
|
68
|
+
|
|
69
|
+
> Try out a **[live interactive version](https://proximafusion.github.io/raytrax/3d-visualisation/)** in the docs.
|
|
70
|
+
|
|
71
|
+
## Jupyter Notebooks
|
|
72
|
+
|
|
73
|
+
Quick-start notebooks are in the [`notebooks/`](notebooks/) directory.
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
python -m pip install raytrax
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
See the [documentation](https://proximafusion.github.io/raytrax/) for a full getting-started guide, theory background, and API reference.
|
|
82
|
+
|
|
83
|
+
## Acknowledgements
|
|
84
|
+
|
|
85
|
+
The development of Raytrax is a collaboration between [Proxima Fusion](https://www.proximafusion.com) and the [Munich University of Applied Sciences (HM)](https://www.hm.edu) and was partially supported by the German Federal Ministry of Research, Technology and Space (BMFTR) under grant FPP-MC (13F1001B).
|
|
86
|
+
|
|
87
|
+
<div align="center">
|
|
88
|
+
<img src="https://upload.wikimedia.org/wikipedia/commons/d/d3/Logo_Proxima_Fusion.svg" alt="Proxima Fusion" width="200"/>
|
|
89
|
+
|
|
90
|
+
<img src="https://upload.wikimedia.org/wikipedia/de/1/1e/Hochschule_f%C3%BCr_angewandte_Wissenschaften_M%C3%BCnchen_logo.svg" alt="HM" width="160"/>
|
|
91
|
+
|
|
92
|
+
<img src="docs/assets/bmftr.svg" alt="BMFTR" width="200"/>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
Raytrax is released under the MIT License. See [LICENSE.md](LICENSE.md) for details.
|