Add generic vol avg profile function - #4568
Conversation
|
Am I mistaken here or is all of the changes hiding the main change which is just this?: |
Yes, still WIP and needs cherry-picked |
73dbd76 to
a68739d
Compare
…ng parameter descriptions and raising conditions
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4568 +/- ##
=======================================
Coverage 49.85% 49.85%
=======================================
Files 151 151
Lines 29875 29893 +18
=======================================
+ Hits 14894 14903 +9
- Misses 14981 14990 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
timothy-nunn
left a comment
There was a problem hiding this comment.
If you implement my suggestions below, then it should be possible to use this new function to replace at least some uses of integrate.simpson within the PROCESS repository.
| ) | ||
|
|
||
|
|
||
| def calculate_vol_avg_of_profile(profile_x: np.ndarray, profile_y: np.ndarray) -> float: |
There was a problem hiding this comment.
| def calculate_vol_avg_of_profile(profile_x: np.ndarray, profile_y: np.ndarray) -> float: | |
| def calculate_vol_avg_of_profile(profile_x: np.ndarray, profile_y: np.ndarray, dx: float | None = None) -> float: |
I would add an ability for the user to specify dx themselves. If a dx is not provided (is None), then calculate dx as it currently is.
…vity function for D-T and D-3He fusion calculations, enhancing clarity and maintainability of the code.
timothy-nunn
left a comment
There was a problem hiding this comment.
Happy with code, requesting modeller to check docs etc
|
Just noticed pre-commit is failing |
…tions and utilize calculate_vol_avg_of_profile for improved clarity and maintainability
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
calculate_vol_avg_of_profile()toprocess/models/physics/profiles.py, which computes the volume-averaged value of a normalized radial profile, including comprehensive input validation.Documentation improvements
plasma_profiles.mdthat 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: