-
Notifications
You must be signed in to change notification settings - Fork 2
✨ Enhance plasma loading features #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all 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 0dbce44
✨ Add `solve_coronal_equilibrium` function for charge state distribut…
munechika-koyo afa87c9
✨ Refactor core profile loading functions to use dataclasses for impr…
munechika-koyo f023c33
✨ Refactor `warn_unsupported_species` function to use `SpeciesComposi…
munechika-koyo 5d8e60a
✨ Introduce `ProfileInterporater` dataclass for core profile interpol…
munechika-koyo e06aa8e
♻️ Enhance error handling in `load_magnetic_field_data` function to r…
munechika-koyo 09a56b0
✨ Add `VelocityData` dataclass for bulk velocity information of speci…
munechika-koyo babd1a6
✨ Enhance `_get_profile` function to support `name2` parameter for de…
munechika-koyo 6045dcd
♻️ Refactor `load_core_plasma` function to streamline electron profil…
munechika-koyo 2c4e8dc
✨ Enhance `ProfileInterporater` dataclass to include density, tempera…
munechika-koyo 3d9c6b0
💡 Remove unrelated comment.
munechika-koyo 9c2bddd
✨ Refactor `load_edge_profiles` and `load_edge_species` functions to …
munechika-koyo a49b938
✨ Refactor `load_edge_plasma` function to improve atomic data handlin…
munechika-koyo 2d13513
📝 Fix docstrings
munechika-koyo 48c00c1
📝 Update docstrings in UnitVector classes to make first sentence impe…
munechika-koyo 24a9677
💡 Remove commented-out code in `_get_velocity_interpolators` function…
munechika-koyo 4d4cf32
✏️ Fix typo in error message for `load_core_plasma` function to impro…
munechika-koyo 595b6ea
📝 Update comments in `load_core_plasma` and `load_edge_plasma` functions
munechika-koyo 4b69574
📝 Fix error messages in `load_edge_plasma` function to reference edge…
munechika-koyo 45c8754
✨ Implement splitting ion_bundle functionality into `load_plasma`
munechika-koyo f9ab2ed
✨ Add patch functionality for JINTRAC IDS and update dataset registry
munechika-koyo d44057d
📝 Streamline codes and add atomic data
munechika-koyo 72977c4
🔧 Update .gitattributes to include filters for ipynb files
munechika-koyo 8a31126
♻️ Refactor edge plasma notebook
munechika-koyo d5ff3c8
✨ Enhance full plasma notebook with all species density plotting
munechika-koyo 3eb8e58
🎨 Add VelocityData to exported module functions in species.py
munechika-koyo 0211d64
✨ Add GridData to core profiles module exports
munechika-koyo 8d3023f
📝 Update emission notebook for clarity and consistency in documentation
munechika-koyo dbf3e50
🔧 Update pre-commit hooks and add nbstripout dependency for Jupyter n…
munechika-koyo be8a5c8
🐛 Fix path handling in iter_jintrac and update data fetching in fix_j…
munechika-koyo b4388de
📝 Enhance documentation and mathematical expressions in solve_coronal…
munechika-koyo f975831
♻️ Refactor module's import and default params
munechika-koyo fb44be2
🔧 Add pyrefly check to pre-commit hooks for Python files
munechika-koyo a0ea8d3
🚚 Move _model module into ids/common subpackage
munechika-koyo 598ff4a
🎨 Update z_min and z_max types to int in SpeciesData and related func…
munechika-koyo 14ca0eb
♻️ Refactor load_edge_species and load_core_species
munechika-koyo 4b90cae
♻️ Refactor plasma loading functions
munechika-koyo 054be62
🎨 Refactor plasma loading tests to include checks for split ion bundl…
munechika-koyo 8c7ad6d
♻️ Change pre-commit configuration to disable parallel execution
munechika-koyo 1384fc1
🔧 Combine lint env with test one
munechika-koyo 51bde7b
🔧 Update napoleon configuration to set use_rtype to False
munechika-koyo 7efc620
👷 Remove pinned Pixi version
munechika-koyo 5f2fa2d
🎨 Add deprecation warning for 'b_field_tor' field in load_magnetic_fi…
munechika-koyo 60000e8
♻️ Refactor profile loading to use fields() for dataclass iteration
munechika-koyo 7c8ba13
✏️ Rename ProfileInterporater to ProfileInterpolator
munechika-koyo 49860f3
🔧 Update import paths and return type for load_magnetic_field function
munechika-koyo a3bcb94
♻️ Refactor velocity interpolator logic to use temporary variable for…
munechika-koyo f85c9bb
♻️ Refactor initialization of optional parameters in solve_coronal_eq…
munechika-koyo 1cad201
📝 Add notebook for computing fractional abundances of Neon ions in co…
munechika-koyo 133b03f
✏️ Fix function name typo
munechika-koyo dbc977d
🎨 Fix deprecation warning message formatting in load_magnetic_field_d…
munechika-koyo ded7605
✅ Update edge plasma profile tests to verify split ion species densities
munechika-koyo d0aab3e
💥 Made species dataclass instance mandatory for ProfileData field
munechika-koyo 972ae39
🎨 Fix import paths for Interpolator1DArray and Interpolator2DArray in…
munechika-koyo 847ec22
🔧 Update HTML title formatting in Sphinx configuration
munechika-koyo 5eabaa0
🎨 Refactor species data handling to return SpeciesData directly inste…
munechika-koyo de5c103
📝 Update deprecation warning message and clarify docstring
munechika-koyo 9365da9
📝 Fix return type annotations for species data functions
munechika-koyo e50bc9b
📝 Fix typo in docstring for load_magnetic_field function
munechika-koyo d9d73f9
🎨 Improve warn_unsupported_species function to use a temporary variab…
munechika-koyo ebfd5dc
✅ Refactor test_edge_plasma_profiles to handle multiple ion bundles a…
munechika-koyo da797fa
Refactor plasma tests to use neon element directly instead of symbol …
munechika-koyo 3c2c28b
✨ Add fixture to populate OpenADAS repository before tests
munechika-koyo df861b8
✨ Add fixtures for SOLPS and JOREK IMAS datasets; refactor import for…
munechika-koyo 859f1dd
📝 Update CHANGELOG.md to include new features and improvements for pl…
munechika-koyo e38440c
📝 Fix notebook not to use obsolete attrs
munechika-koyo 05dce2f
🎨 Change SpeciesType from StrEnum to Enum to make it compatible with …
munechika-koyo 645aac2
📝 Fix typo in emission notebook: correct "tangsten" to "tungsten"
munechika-koyo db80372
🚚 Rename the wrong filename
munechika-koyo d644717
📝 Update docstrings for load_plasma function parameters and fix argum…
munechika-koyo e65a83a
📝 Update example output in iter_jintrac docstring to reflect modified…
munechika-koyo 1bf01a9
📝 Update glob pattern for miscellaneous notebooks in examples documen…
munechika-koyo 3e950a6
🎨 Add density_fast attribute to ProfileInterpolator for fast density …
munechika-koyo 9034810
📝 Fix condition checks for profile temperature and velocity in edge p…
munechika-koyo 853c721
🎨 Enhance load_core_profiles to include velocity data handling and im…
munechika-koyo 7d13cef
📝 Add TODO comments for tungsten ADF15 installation in emission notebook
munechika-koyo f9ef4ca
📝 Instantiate OpenADAS before data downloaded
munechika-koyo b80d24b
🐛 Fix reggression of loading magnetic field function
munechika-koyo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.