Skip to content

⚡ Enhance core functionality and documentation improvements - #38

Merged
munechika-koyo merged 29 commits into
masterfrom
develop
Aug 3, 2026
Merged

⚡ Enhance core functionality and documentation improvements#38
munechika-koyo merged 29 commits into
masterfrom
develop

Conversation

@munechika-koyo

Copy link
Copy Markdown
Member

Key changes include:

  • Added blending utilities and a new grid_radial module.

  • Introduced functions for loading GGD-related data and enhanced radiation loading capabilities.

  • Refactored cell subset ID handling and improved error handling in various functions.

  • Updated documentation for clarity and added tests for new features.

  • Removed unused classes and functions to streamline the codebase.

Separate blending function from plasma module and move it into math module
…m function to raise RuntimeError for missing rho_tor_norm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands CHERAB-IMAS radiation/emissivity loading and blending support by introducing reusable blending/grid utilities, improving radiation IDS parsing (core + GGD values, plus coefficient reconstruction), and adding a synthetic dataset + tests to exercise the new behavior.

Changes:

  • Extend load_radiation_emitter() to support dual IDS sources for emissivity values with duplicate-detection and improved validation/error messages.
  • Add new shared utilities: math.blend.blend_core_edge_functions() and ids.common.grid_radial (core grid + psi_norm support).
  • Add a synthetic iter_jintrac_radiation_values dataset plus tests and documentation touch-ups.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/emitter/test_radiation.py Adds regression tests for values-based radiation loading (core/GGD completion, duplicates) and earlier validation.
tests/conftest.py Adds session fixture for the new synthetic JINTRAC radiation-values dataset.
src/cherab/imas/plasma/equilibrium.py Tightens load_equilibrium() contract when returning a psi interpolator (raise instead of returning None).
src/cherab/imas/plasma/core.py Switches core grid + psi normalization utilities to the new ids.common.grid_radial module.
src/cherab/imas/plasma/blend.py Uses new shared blend helper instead of local implementation.
src/cherab/imas/plasma/blend.py Imports get_psi_norm/load_core_grid from ids.common.grid_radial to centralize grid logic.
src/cherab/imas/plasma/blend.py Replaces private blending logic with blend_core_edge_functions().
src/cherab/imas/math/blend.py New public utility for blending scalar/vector core/edge functions with optional axisymmetric mapping.
src/cherab/imas/math/init.py Re-exports blend_core_edge_functions from the new math submodule.
src/cherab/imas/ids/radiation/load_radiation.py Refactors radiation emissivity loading into load_core_emissivity() / load_ggd_emissivity() and introduces EmissivityData.
src/cherab/imas/ids/radiation/init.py Updates exports to the new emissivity loaders/dataclass.
src/cherab/imas/ids/core_profiles/load_profiles.py Removes GridData/load_core_grid from core_profiles loader (moved to common grid module).
src/cherab/imas/ids/core_profiles/init.py Updates public API exports after the grid refactor.
src/cherab/imas/ids/common/species.py Adjusts element/isotope selection and atom count handling in get_elements().
src/cherab/imas/ids/common/grid_radial.py New shared GridData, load_core_grid(), and get_psi_norm() utilities.
src/cherab/imas/ids/common/ggd/load_unstruct_2d.py Normalizes subset-id handling and casts IDS indices to int consistently.
src/cherab/imas/ids/common/ggd/load_data.py New helper get_ggd_subset_data() for extracting values/coefficients on a subset.
src/cherab/imas/ids/common/ggd/init.py Updates package purpose/exports to include non-grid GGD utilities.
src/cherab/imas/ids/common/_ids_numeric.py New helper get_ids_numeric_field() to coerce IDS numeric fields to float64 arrays.
src/cherab/imas/ids/common/init.py Re-exports new common utilities (grid_radial, get_ids_numeric_field).
src/cherab/imas/emitter/radiation.py Major refactor: dual-source value loading (core + GGD), blending, and improved coefficient-path validation.
src/cherab/imas/datasets/_registry.py Registers the new builtin dataset artifact.
src/cherab/imas/datasets/_builtin.py Implements synthetic iter_jintrac_radiation_values() dataset generation.
src/cherab/imas/datasets/init.py Exposes iter_jintrac_radiation_values() as a public dataset helper.
docs/source/index.md Removes emoji from the toctree caption.
docs/source/contributing.md Adds anchors, improves markdown links/URLs.
docs/source/api.md Adds anchors and updates heading formatting.
docs/notebooks/radiation/radiation_3d.ipynb Cleans up unused imports in the radiation 3D notebook.
CHANGELOG.md Adds 0.5.1 entry documenting the new dataset + radiation emitter improvements.
Comments suppressed due to low confidence (1)

src/cherab/imas/emitter/radiation.py:452

  • The coefficients path unconditionally indexes ids.grid_ggd[0] and ignores the grid_ggd= override parameter. If the IDS has an empty grid_ggd AOS, this will raise IndexError; and callers cannot supply an alternative grid for coefficient reconstruction.
        # Load GGD Grid
        grid = load_grid(
            ids.grid_ggd[0],
            with_subsets=False,

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/cherab/imas/ids/common/species.py Outdated
Comment thread src/cherab/imas/ids/common/ggd/load_data.py Outdated
Comment thread src/cherab/imas/ids/common/ggd/load_data.py
Comment thread src/cherab/imas/math/blend.py
Comment thread src/cherab/imas/emitter/radiation.py
Comment thread src/cherab/imas/emitter/radiation.py Outdated
Comment thread src/cherab/imas/emitter/radiation.py
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.83732% with 101 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.39%. Comparing base (659aa6e) to head (16962b4).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/cherab/imas/emitter/radiation.py 76.25% 22 Missing and 16 partials ⚠️
src/cherab/imas/math/blend.py 49.09% 14 Missing and 14 partials ⚠️
src/cherab/imas/datasets/_builtin.py 77.58% 6 Missing and 7 partials ⚠️
src/cherab/imas/ids/radiation/load_radiation.py 82.60% 7 Missing and 1 partial ⚠️
src/cherab/imas/ids/common/grid_radial.py 81.25% 5 Missing and 1 partial ⚠️
src/cherab/imas/ids/common/ggd/load_data.py 81.81% 2 Missing and 2 partials ⚠️
src/cherab/imas/ids/common/species.py 66.66% 1 Missing and 1 partial ⚠️
src/cherab/imas/plasma/equilibrium.py 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #38      +/-   ##
==========================================
+ Coverage   69.55%   71.39%   +1.83%     
==========================================
  Files          52       56       +4     
  Lines        3291     3506     +215     
  Branches      526      558      +32     
==========================================
+ Hits         2289     2503     +214     
+ Misses        766      755      -11     
- Partials      236      248      +12     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@munechika-koyo
munechika-koyo merged commit 54a8ed6 into master Aug 3, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants