Skip to content

Add PFLocationTypes enum for PF coil locations#4278

Open
chris-ashe wants to merge 5 commits into
mainfrom
add_pf_location_enum
Open

Add PFLocationTypes enum for PF coil locations#4278
chris-ashe wants to merge 5 commits into
mainfrom
add_pf_location_enum

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.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 71.42857% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 48.85%. Comparing base (ef00c94) to head (59df514).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
process/models/pfcoil.py 78.26% 5 Missing ⚠️
process/core/init.py 40.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4278      +/-   ##
==========================================
+ Coverage   48.83%   48.85%   +0.01%     
==========================================
  Files         151      151              
  Lines       29127    29138      +11     
==========================================
+ Hits        14223    14234      +11     
  Misses      14904    14904              

☔ 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 add_pf_location_enum branch from 54c9d09 to e134c9b Compare June 1, 2026 16:19
@chris-ashe chris-ashe marked this pull request as ready for review June 1, 2026 16:20
@chris-ashe chris-ashe requested a review from a team as a code owner June 1, 2026 16:20
Copilot AI review requested due to automatic review settings June 1, 2026 16:20
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 introduces a typed IntEnum for PF coil location modes and updates PF coil logic and initialization to use the enum instead of magic integers. It also includes small refactors to reuse existing derived variables for CS flux/geometry calculations, with corresponding test and documentation updates.

Changes:

  • Add PFLocationTypes(IntEnum) and replace i_pf_location == {1,2,3,4} checks/assignments with enum members.
  • Refactor CS-related calculations to use existing aggregated variables (vs_plasma_ramp_required, dz_cs_full, a_cs_poloidal) rather than recomputing equivalent expressions.
  • Update a PF coil unit test and the PF coil documentation to reflect the new enum/type references.

Reviewed changes

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

File Description
process/models/pfcoil.py Adds PFLocationTypes and replaces numeric i_pf_location comparisons; refactors CS flux/geometry usage and CS filament current calculation.
process/core/init.py Uses PFLocationTypes when setting/checking PF coil location defaults.
tests/unit/models/test_pfcoil.py Adds test mocking for a_cs_poloidal to match the updated CS filament current calculation.
documentation/source/eng-models/pf-coil.md Updates the “Positioning” section header to reference the enum/type.

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

Comment thread process/models/pfcoil.py
Comment thread process/core/init.py
init_superconducting_tf_coil_variables,
)
from process.data_structure.tfcoil_variables import init_tfcoil_variables
from process.models.pfcoil import PFLocationTypes
Comment thread documentation/source/eng-models/pf-coil.md
@timothy-nunn timothy-nunn self-assigned this Jun 3, 2026
@chris-ashe chris-ashe force-pushed the add_pf_location_enum branch from e134c9b to 6dbbd9e Compare June 3, 2026 13:13
Comment thread process/core/init.py Outdated
chris-ashe and others added 2 commits June 3, 2026 15:58
Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants