Skip to content

Add generic vol avg profile function - #4568

Open
chris-ashe wants to merge 3 commits into
mainfrom
add_generic_vol_avg_profile_func
Open

Add generic vol avg profile function#4568
chris-ashe wants to merge 3 commits into
mainfrom
add_generic_vol_avg_profile_func

Conversation

@chris-ashe

@chris-ashe chris-ashe commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces a new utility function for calculating the volume-averaged value of a radially normalized profile and adds detailed documentation explaining the mathematical derivation behind this calculation. These changes improve both code reusability and the clarity of the underlying physics for future developers and users.

New functionality

  • Added calculate_vol_avg_of_profile() to process/models/physics/profiles.py, which computes the volume-averaged value of a normalized radial profile, including comprehensive input validation.

Documentation improvements

  • Added a new section to plasma_profiles.md that explains the derivation and usage of the volume-averaging calculation, including all relevant equations and context.

Checklist

I confirm that I have completed the following checks:

  • My changes follow the PROCESS style guide
  • I have justified any large differences in the regression tests caused by this pull request in the comments.
  • I have added new tests where appropriate for the changes I have made.
  • If I have had to change any existing unit or integration tests, I have justified this change in the pull request comments.
  • If I have made documentation changes, I have checked they render correctly.
  • I have added documentation for my change, if appropriate.

@chris-ashe chris-ashe added the Profiles Relating to the plasma profiles label Aug 28, 2026
@je-cook

je-cook commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Am I mistaken here or is all of the changes hiding the main change which is just this?:

    return 2.0 * sp.integrate.simpson(
        profile_y * profile_x,
        x=profile_x,
        dx=profile_x[1] - profile_x[0],
    )

@chris-ashe

Copy link
Copy Markdown
Collaborator Author

Am I mistaken here or is all of the changes hiding the main change which is just this?:

    return 2.0 * sp.integrate.simpson(
        profile_y * profile_x,
        x=profile_x,
        dx=profile_x[1] - profile_x[0],
    )

Yes, still WIP and needs cherry-picked

@chris-ashe
chris-ashe force-pushed the add_generic_vol_avg_profile_func branch from 73dbd76 to a68739d Compare September 2, 2026 09:49
…ng parameter descriptions and raising conditions
@chris-ashe
chris-ashe marked this pull request as ready for review September 2, 2026 09:54
@chris-ashe
chris-ashe requested a review from a team as a code owner September 2, 2026 09:54
@codecov-commenter

codecov-commenter commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 10.00000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.84%. Comparing base (bd5e644) to head (6bee04b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
process/models/physics/profiles.py 10.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4568      +/-   ##
==========================================
- Coverage   49.85%   49.84%   -0.02%     
==========================================
  Files         151      151              
  Lines       29875    29885      +10     
==========================================
+ Hits        14894    14895       +1     
- Misses      14981    14990       +9     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Profiles Relating to the plasma profiles

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants