Skip to content
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
2768014
✨ Enhance species data handling by introducing SpeciesData, ProfileDa…
munechika-koyo Mar 9, 2026
0dbce44
✨ Add `solve_coronal_equilibrium` function for charge state distribut…
munechika-koyo Mar 9, 2026
afa87c9
✨ Refactor core profile loading functions to use dataclasses for impr…
munechika-koyo Mar 9, 2026
f023c33
✨ Refactor `warn_unsupported_species` function to use `SpeciesComposi…
munechika-koyo Mar 9, 2026
5d8e60a
✨ Introduce `ProfileInterporater` dataclass for core profile interpol…
munechika-koyo Mar 9, 2026
e06aa8e
♻️ Enhance error handling in `load_magnetic_field_data` function to r…
munechika-koyo Mar 9, 2026
09a56b0
✨ Add `VelocityData` dataclass for bulk velocity information of speci…
munechika-koyo Mar 10, 2026
babd1a6
✨ Enhance `_get_profile` function to support `name2` parameter for de…
munechika-koyo Mar 10, 2026
6045dcd
♻️ Refactor `load_core_plasma` function to streamline electron profil…
munechika-koyo Mar 10, 2026
2c4e8dc
✨ Enhance `ProfileInterporater` dataclass to include density, tempera…
munechika-koyo Mar 10, 2026
3d9c6b0
💡 Remove unrelated comment.
munechika-koyo Mar 10, 2026
9c2bddd
✨ Refactor `load_edge_profiles` and `load_edge_species` functions to …
munechika-koyo Mar 10, 2026
a49b938
✨ Refactor `load_edge_plasma` function to improve atomic data handlin…
munechika-koyo Mar 10, 2026
2d13513
📝 Fix docstrings
munechika-koyo Mar 10, 2026
48c00c1
📝 Update docstrings in UnitVector classes to make first sentence impe…
munechika-koyo Mar 10, 2026
24a9677
💡 Remove commented-out code in `_get_velocity_interpolators` function…
munechika-koyo Mar 10, 2026
4d4cf32
✏️ Fix typo in error message for `load_core_plasma` function to impro…
munechika-koyo Mar 10, 2026
595b6ea
📝 Update comments in `load_core_plasma` and `load_edge_plasma` functions
munechika-koyo Mar 10, 2026
4b69574
📝 Fix error messages in `load_edge_plasma` function to reference edge…
munechika-koyo Mar 10, 2026
45c8754
✨ Implement splitting ion_bundle functionality into `load_plasma`
munechika-koyo Mar 10, 2026
f9ab2ed
✨ Add patch functionality for JINTRAC IDS and update dataset registry
munechika-koyo Mar 10, 2026
d44057d
📝 Streamline codes and add atomic data
munechika-koyo Mar 14, 2026
72977c4
🔧 Update .gitattributes to include filters for ipynb files
munechika-koyo Mar 14, 2026
8a31126
♻️ Refactor edge plasma notebook
munechika-koyo Mar 16, 2026
d5ff3c8
✨ Enhance full plasma notebook with all species density plotting
munechika-koyo Mar 16, 2026
3eb8e58
🎨 Add VelocityData to exported module functions in species.py
munechika-koyo Mar 16, 2026
0211d64
✨ Add GridData to core profiles module exports
munechika-koyo Mar 16, 2026
8d3023f
📝 Update emission notebook for clarity and consistency in documentation
munechika-koyo Mar 16, 2026
dbf3e50
🔧 Update pre-commit hooks and add nbstripout dependency for Jupyter n…
munechika-koyo Mar 16, 2026
be8a5c8
🐛 Fix path handling in iter_jintrac and update data fetching in fix_j…
munechika-koyo Mar 16, 2026
b4388de
📝 Enhance documentation and mathematical expressions in solve_coronal…
munechika-koyo Mar 18, 2026
f975831
♻️ Refactor module's import and default params
munechika-koyo Mar 18, 2026
fb44be2
🔧 Add pyrefly check to pre-commit hooks for Python files
munechika-koyo Mar 18, 2026
a0ea8d3
🚚 Move _model module into ids/common subpackage
munechika-koyo Mar 19, 2026
598ff4a
🎨 Update z_min and z_max types to int in SpeciesData and related func…
munechika-koyo Mar 19, 2026
14ca0eb
♻️ Refactor load_edge_species and load_core_species
munechika-koyo Mar 19, 2026
4b90cae
♻️ Refactor plasma loading functions
munechika-koyo Mar 19, 2026
054be62
🎨 Refactor plasma loading tests to include checks for split ion bundl…
munechika-koyo Mar 19, 2026
8c7ad6d
♻️ Change pre-commit configuration to disable parallel execution
munechika-koyo Mar 19, 2026
1384fc1
🔧 Combine lint env with test one
munechika-koyo Mar 19, 2026
51bde7b
🔧 Update napoleon configuration to set use_rtype to False
munechika-koyo Mar 19, 2026
7efc620
👷 Remove pinned Pixi version
munechika-koyo Mar 19, 2026
5f2fa2d
🎨 Add deprecation warning for 'b_field_tor' field in load_magnetic_fi…
munechika-koyo Mar 19, 2026
60000e8
♻️ Refactor profile loading to use fields() for dataclass iteration
munechika-koyo Mar 19, 2026
7c8ba13
✏️ Rename ProfileInterporater to ProfileInterpolator
munechika-koyo Mar 19, 2026
49860f3
🔧 Update import paths and return type for load_magnetic_field function
munechika-koyo Mar 19, 2026
a3bcb94
♻️ Refactor velocity interpolator logic to use temporary variable for…
munechika-koyo Mar 19, 2026
f85c9bb
♻️ Refactor initialization of optional parameters in solve_coronal_eq…
munechika-koyo Mar 19, 2026
1cad201
📝 Add notebook for computing fractional abundances of Neon ions in co…
munechika-koyo Mar 19, 2026
133b03f
✏️ Fix function name typo
munechika-koyo Mar 20, 2026
dbc977d
🎨 Fix deprecation warning message formatting in load_magnetic_field_d…
munechika-koyo Mar 20, 2026
ded7605
✅ Update edge plasma profile tests to verify split ion species densities
munechika-koyo Mar 20, 2026
d0aab3e
💥 Made species dataclass instance mandatory for ProfileData field
munechika-koyo Mar 20, 2026
972ae39
🎨 Fix import paths for Interpolator1DArray and Interpolator2DArray in…
munechika-koyo Mar 20, 2026
847ec22
🔧 Update HTML title formatting in Sphinx configuration
munechika-koyo Mar 20, 2026
5eabaa0
🎨 Refactor species data handling to return SpeciesData directly inste…
munechika-koyo Mar 20, 2026
de5c103
📝 Update deprecation warning message and clarify docstring
munechika-koyo Mar 20, 2026
9365da9
📝 Fix return type annotations for species data functions
munechika-koyo Mar 20, 2026
e50bc9b
📝 Fix typo in docstring for load_magnetic_field function
munechika-koyo Mar 20, 2026
d9d73f9
🎨 Improve warn_unsupported_species function to use a temporary variab…
munechika-koyo Mar 20, 2026
ebfd5dc
✅ Refactor test_edge_plasma_profiles to handle multiple ion bundles a…
munechika-koyo Mar 20, 2026
da797fa
Refactor plasma tests to use neon element directly instead of symbol …
munechika-koyo Mar 20, 2026
3c2c28b
✨ Add fixture to populate OpenADAS repository before tests
munechika-koyo Mar 21, 2026
df861b8
✨ Add fixtures for SOLPS and JOREK IMAS datasets; refactor import for…
munechika-koyo Mar 21, 2026
859f1dd
📝 Update CHANGELOG.md to include new features and improvements for pl…
munechika-koyo Mar 21, 2026
e38440c
📝 Fix notebook not to use obsolete attrs
munechika-koyo Mar 21, 2026
05dce2f
🎨 Change SpeciesType from StrEnum to Enum to make it compatible with …
munechika-koyo Mar 21, 2026
645aac2
📝 Fix typo in emission notebook: correct "tangsten" to "tungsten"
munechika-koyo Mar 21, 2026
db80372
🚚 Rename the wrong filename
munechika-koyo Mar 21, 2026
d644717
📝 Update docstrings for load_plasma function parameters and fix argum…
munechika-koyo Mar 21, 2026
e65a83a
📝 Update example output in iter_jintrac docstring to reflect modified…
munechika-koyo Mar 21, 2026
1bf01a9
📝 Update glob pattern for miscellaneous notebooks in examples documen…
munechika-koyo Mar 21, 2026
3e950a6
🎨 Add density_fast attribute to ProfileInterpolator for fast density …
munechika-koyo Mar 21, 2026
9034810
📝 Fix condition checks for profile temperature and velocity in edge p…
munechika-koyo Mar 21, 2026
853c721
🎨 Enhance load_core_profiles to include velocity data handling and im…
munechika-koyo Mar 21, 2026
7d13cef
📝 Add TODO comments for tungsten ADF15 installation in emission notebook
munechika-koyo Mar 22, 2026
f9ef4ca
📝 Instantiate OpenADAS before data downloaded
munechika-koyo Mar 22, 2026
b80d24b
🐛 Fix reggression of loading magnetic field function
munechika-koyo Mar 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:
- name: 🟨 Set up Pixi
uses: prefix-dev/setup-pixi@v0.9.4
with:
pixi-version: v0.62.2 # NOTE: pin until https://github.com/prefix-dev/pixi/issues/5424 is resolved
environments: ${{ matrix.environment }}

- name: 🧪 Execute pytest
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
- name: 🟨 Set up Pixi
uses: prefix-dev/setup-pixi@v0.9.4
with:
pixi-version: v0.62.2 # NOTE: pin until https://github.com/prefix-dev/pixi/issues/5424 is resolved
environments: docs

- name: 📝 Build docs
Expand Down
43 changes: 26 additions & 17 deletions .lefthook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ output:
- skips # Print "skip" (i.e. no files matched)

pre-commit:
parallel: true
parallel: false
jobs:
- name: dprint
glob: "*.{json,jsonc,md,yaml,yml}"
Expand All @@ -29,25 +29,21 @@ pre-commit:
stage_fixed: true
run: pixi {run} taplo {staged_files}

- name: ruff
- name: ruff check
glob: "*.{py,pyi}"
group:
piped: true
jobs:
- name: ruff check
run: pixi {run} ruff check --fix {staged_files}
stage_fixed: true
- name: ruff format
run: pixi {run} ruff format {staged_files}
stage_fixed: true
stage_fixed: true
run: pixi {run} ruff check --fix {staged_files}

# - name: pyrefly
# glob: "*.{py,pyi}"
# run: pixi {run} pyrefly-check {staged_files}
- name: ruff format
glob: "*.{py,pyi}"
stage_fixed: true
skip:
- run: test ${CI} -eq 1
run: pixi {run} ruff format {staged_files}

# - name: mypy
# glob: "*.{py,pyi}"
# run: pixi {run} mypy {staged_files}
- name: pyrefly
glob: "*.{py,pyi}"
run: pixi {run} pyrefly-check {staged_files}

- name: typos
stage_fixed: true
Expand All @@ -69,3 +65,16 @@ pre-commit:
- name: cython-lint
glob: "*.{pyx,pxd}"
run: pixi {run} cython-lint {staged_files}

- name: nbstripout clean
glob: "*.ipynb"
stage_fixed: true
skip:
- run: test ${CI} -eq 1
run: pixi {run} nbstripout {staged_files}

- name: nbstripout check
glob: "*.ipynb"
only:
- run: test ${CI} -eq 1
run: pixi {run} nbstripout --verify {staged_files}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Support Python 3.14
- Add `visualize` function for bolometer camera geometry visualization using `plotly`
- Add ion bundle splitting support in `load_plasma` for edge/core plasma loading
- Add `solve_coronal_equilibrium` utility and corresponding fractional abundance notebook
- Add dataset patching utility and update dataset registry/fetchers for JINTRAC workflows
- Add new plasma data models (`SpeciesData`, `ProfileData`, `SpeciesComposition`, `VelocityData`) in common IDs utilities

### Changed

- Change pixi environment to use Python 3.14 as default
- Refactor core/edge profile loaders to use dataclass-driven species/profile handling
- Refactor magnetic field and equilibrium loading paths and improve interpolator imports/types
- Improve documentation notebooks and Sphinx configuration for plasma workflows
- Update CI/quality tooling (`pyrefly`, pre-commit hooks, notebook stripping, pixi tasks)

## [0.3.0] - 2026-01-30

Expand Down
165 changes: 165 additions & 0 deletions docs/notebooks/misc/fractional_ abundances.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "0",
"metadata": {},
"source": [
"# Fractional Abundances\n",
"\n",
"Here we compute the fractional abundances for Neon ions, assuming the coronal equilibrium model.\n",
"Let us plot the fractional abundances varying with the temperature for a fixed electron density.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import ultraplot as uplt\n",
"\n",
"from cherab.core.atomic.elements import neon\n",
"from cherab.imas.ids.common import solve_coronal_equilibrium\n",
"from cherab.openadas import OpenADAS\n",
"from cherab.openadas.install import install_adf11acd, install_adf11scd"
]
},
{
"cell_type": "markdown",
"id": "2",
"metadata": {},
"source": [
"Download the necessary atomic data from OpenADAS if not already available.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3",
"metadata": {},
"outputs": [],
"source": [
"atomic_data = OpenADAS(permit_extrapolation=True, missing_rates_return_null=False)\n",
"try:\n",
" atomic_data.ionisation_rate(neon, 1)\n",
"except RuntimeError:\n",
" install_adf11acd(neon, \"adf11/acd96/acd96_ne.dat\", download=True)\n",
" install_adf11scd(neon, \"adf11/scd96/scd96_ne.dat\", download=True)"
]
},
{
"cell_type": "markdown",
"id": "4",
"metadata": {},
"source": [
"Set the electron density and the range of electron temperatures.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5",
"metadata": {},
"outputs": [],
"source": [
"ELECTRON_DENSITY = 1e19\n",
"electron_temperatures = np.logspace(-0.2, 3.2, 100)"
]
},
{
"cell_type": "raw",
"id": "6",
"metadata": {
"raw_mimetype": "text/restructuredtext",
"vscode": {
"languageId": "raw"
}
},
"source": [
"The `.solve_coronal_equilibrium` function computes the fractional abundances by setting the total density to one."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7",
"metadata": {},
"outputs": [],
"source": [
"abundances = solve_coronal_equilibrium(\n",
" neon,\n",
" np.ones_like(electron_temperatures),\n",
" np.full_like(electron_temperatures, ELECTRON_DENSITY),\n",
" electron_temperatures,\n",
" atomic_data=atomic_data,\n",
")"
]
},
{
"cell_type": "markdown",
"id": "8",
"metadata": {},
"source": [
"Plot the fractional abundances as a function of the electron temperature.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9",
"metadata": {},
"outputs": [],
"source": [
"fig, ax = uplt.subplots(refaspect=1.2, refwidth=4)\n",
"lines = ax.plot(\n",
" electron_temperatures,\n",
" abundances.T,\n",
" cycle=\"tab20\",\n",
")\n",
"ax.legend(\n",
" lines,\n",
" [f\"Ne {i}+\" for i in range(neon.atomic_number + 1)],\n",
" ncols=1,\n",
" loc=\"right\",\n",
" frame=False,\n",
" fontcolor=\"w\",\n",
")\n",
"ax.format(\n",
" style=\"dark_background\",\n",
" xscale=\"log\",\n",
" yformatter=(\"percent\", 1),\n",
" tickminor=True,\n",
" tickdir=\"in\",\n",
" grid=True,\n",
" gridalpha=0.3,\n",
" xlabel=\"Electron Temperature [eV]\",\n",
" title=r\"Fractional Abundances, $n_\\mathrm{e} = 10^{19}$ m$^{-3}$\",\n",
")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "docs",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.14.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading
Loading