Skip to content

4269 inconsistent use of eps variable in functions - #4282

Merged
clmould merged 8 commits into
mainfrom
4269-inconsistent-use-of-eps-variable-in-functions
Jun 5, 2026
Merged

4269 inconsistent use of eps variable in functions#4282
clmould merged 8 commits into
mainfrom
4269-inconsistent-use-of-eps-variable-in-functions

Conversation

@chris-ashe

Copy link
Copy Markdown
Collaborator

Description

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.

Copilot AI review requested due to automatic review settings June 3, 2026 07:58
@chris-ashe
chris-ashe requested a review from a team as a code owner June 3, 2026 07:58
@chris-ashe chris-ashe added Bug Something isnt working Plasma current labels Jun 3, 2026
@chris-ashe chris-ashe linked an issue Jun 3, 2026 that may be closed by this pull request

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 standardizes how inverse aspect ratio (eps) is handled across plasma current / field calculations by deriving it from aspect where appropriate, and aligns naming (ipcur_plasma) to reduce ambiguity in physics routines.

Changes:

  • Remove explicit eps arguments from Peng-related calculations and compute eps = 1 / aspect internally.
  • Rename plasma current parameter from ip to cur_plasma in the surface-averaged poloidal field calculation and its call sites.
  • Reformat reference sections in docstrings for consistency.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/unit/models/physics/test_physics.py Updates unit tests to match revised function signatures/inputs and expected numeric outputs.
process/models/physics/plasma_fields.py Adjusts surface-averaged poloidal field API (cur_plasma, derive eps) and uses PlasmaCurrentModel enum for model selection.
process/models/physics/plasma_current.py Updates Peng scaling to derive eps from aspect, removes the older poloidal-field helper, and switches several calls to keyword arguments for clarity.
process/models/physics/physics.py Updates the physics model to call the revised poloidal-field routine with cur_plasma and without eps.

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

Comment on lines 321 to 331
# Peng scaling for double null divertor; TARTs [STAR Code]
elif model == PlasmaCurrentModel.PENG_DIVERTOR_SCALING:
plasma_current = 1.0e6 * self.calculate_plasma_current_peng(
q95,
aspect_ratio,
eps,
rminor,
b_plasma_toroidal_on_axis,
kappa,
triang,
q95=q95,
aspect=aspect_ratio,
eps=eps,
rminor=rminor,
b_plasma_toroidal_on_axis=b_plasma_toroidal_on_axis,
kappa=kappa,
triang=triang,
)
Comment thread tests/unit/models/physics/test_physics.py Outdated
@codecov-commenter

codecov-commenter commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.95652% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.69%. Comparing base (906cf7d) to head (cbb0c26).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
process/models/physics/plasma_current.py 88.23% 2 Missing ⚠️
process/models/physics/physics.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4282      +/-   ##
==========================================
- Coverage   48.81%   48.69%   -0.12%     
==========================================
  Files         151      151              
  Lines       29097    29290     +193     
==========================================
+ Hits        14203    14263      +60     
- Misses      14894    15027     +133     

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

@chris-ashe
chris-ashe force-pushed the 4269-inconsistent-use-of-eps-variable-in-functions branch from 7b1cfda to 177d4a5 Compare June 3, 2026 08:18
…s variable and update parameter names for clarity
@chris-ashe
chris-ashe force-pushed the 4269-inconsistent-use-of-eps-variable-in-functions branch from 177d4a5 to 4066e1d Compare June 3, 2026 12:20
Comment thread tests/unit/models/physics/test_physics.py Outdated
Comment thread tests/unit/models/physics/test_physics.py Outdated
Comment thread tests/unit/models/physics/test_physics.py Outdated
Comment thread process/models/physics/plasma_current.py Outdated
chris-ashe and others added 2 commits June 5, 2026 11:01
Co-authored-by: clmould <86794332+clmould@users.noreply.github.com>
Co-authored-by: clmould <86794332+clmould@users.noreply.github.com>
@chris-ashe
chris-ashe requested a review from clmould June 5, 2026 10:04
@chris-ashe
chris-ashe force-pushed the 4269-inconsistent-use-of-eps-variable-in-functions branch from 75a7a11 to 4f61407 Compare June 5, 2026 10:15

@clmould clmould left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just 1 small change but all good otherwise

Comment thread process/models/physics/plasma_current.py Outdated
chris-ashe and others added 2 commits June 5, 2026 13:12
Co-authored-by: clmould <86794332+clmould@users.noreply.github.com>
@clmould
clmould merged commit d86c108 into main Jun 5, 2026
10 of 11 checks passed
@clmould
clmould deleted the 4269-inconsistent-use-of-eps-variable-in-functions branch June 5, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isnt working Plasma current

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent use of eps variable in functions

5 participants