Skip to content

4269 inconsistent use of eps variable in functions#4282

Open
chris-ashe wants to merge 3 commits into
mainfrom
4269-inconsistent-use-of-eps-variable-in-functions
Open

4269 inconsistent use of eps variable in functions#4282
chris-ashe wants to merge 3 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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 on lines 3818 to 3824
result = physics.fields.calculate_surface_averaged_poloidal_field(
i_plasma_current,
c_plasma,
q95,
b_plasma_toroidal_on_axis,
aspect,
eps,
kappa,
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 3, 2026

Codecov Report

❌ Patch coverage is 90.90909% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.81%. Comparing base (906cf7d) to head (4066e1d).

Files with missing lines Patch % Lines
process/models/physics/plasma_current.py 88.23% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4282   +/-   ##
=======================================
  Coverage   48.81%   48.81%           
=======================================
  Files         151      151           
  Lines       29097    29091    -6     
=======================================
- Hits        14203    14202    -1     
+ Misses      14894    14889    -5     

☔ View full report in Codecov by Sentry.
📢 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
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