Skip to content

🎨 Plot PF mutual inductance matrix#4277

Open
chris-ashe wants to merge 4 commits into
mainfrom
plot_pf_mutual_ind_matrix
Open

🎨 Plot PF mutual inductance matrix#4277
chris-ashe wants to merge 4 commits into
mainfrom
plot_pf_mutual_ind_matrix

Conversation

@chris-ashe
Copy link
Copy Markdown
Collaborator

@chris-ashe chris-ashe commented Jun 1, 2026

This pull request introduces a new plotting function to visualize the mutual inductance between the plasma and PF/CS coils, and updates the summary plotting routines and data output to support this visualization. The main changes include adding the new plot, ensuring the necessary data is written to the MFILE, and updating the figure/page management to accommodate the new plot.

Visualization of PF/CS-Plasma Mutual Inductance:

  • Added a new function plot_pf_cs_plasma_mutual_inductance in summary.py to plot the mutual inductance matrix between plasma and PF/CS coils, including value annotations and customized axis labels.
  • Integrated the new plot into the summary plotting workflow by updating main_plot to call this function and adjusting subplot indices for subsequent plots to make space for the new figure.
  • Increased the number of pages/figures created in plot_summary from 36 to 37 to accommodate the additional plot.

Data Output Enhancements:

  • Modified pfcoil.py to output the mutual inductance matrix elements to the MFILE for use by the new plotting function, ensuring all necessary data is available for visualization.
  • Refactored the order of central solenoid existence checks and output in outpf to ensure consistent file structure and comments.
image

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 Input/Output Files Issues related to the input and output data files PF Coils CS Coil labels Jun 1, 2026
@chris-ashe chris-ashe changed the title Plot PF mutual inductance matrix 🎨 Plot PF mutual inductance matrix Jun 1, 2026
@chris-ashe chris-ashe marked this pull request as ready for review June 1, 2026 15:25
@chris-ashe chris-ashe requested a review from a team as a code owner June 1, 2026 15:25
Copilot AI review requested due to automatic review settings June 1, 2026 15:25
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 adds a new summary plot to visualise the PF/CS/plasma mutual inductance matrix, and updates PF coil output to write the mutual inductance elements into the MFILE so the plot can be populated. It also shifts summary page indices and increases the page count to accommodate the new figure.

Changes:

  • Added plot_pf_cs_plasma_mutual_inductance to render the PF/CS/plasma mutual inductance matrix from MFILE data.
  • Wrote ind_pf_cs_plasma_mutual[i,j] elements to the MFILE from the PF coil inductance output.
  • Updated summary figure/page indexing and increased plot summary page count from 36 to 37.

Reviewed changes

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

File Description
process/models/pfcoil.py Writes mutual inductance matrix elements to MFILE and tweaks CS existence output ordering.
process/core/io/plot/summary.py Adds the new mutual inductance matrix plot and shifts subsequent page indices; increases total pages.

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

Comment on lines +14940 to +14946
for coil in range(n_pf_cs_plasma_circuits):
for circuit in range(n_pf_cs_plasma_circuits):
mutual_inductance[coil, circuit] = m_file.get(
f"ind_pf_cs_plasma_mutual[{coil},_{circuit}]",
scan=scan,
)

Comment thread process/models/pfcoil.py
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 2.27273% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.30%. Comparing base (b97ed80) to head (1e48f3b).

Files with missing lines Patch % Lines
process/core/io/plot/summary.py 2.50% 39 Missing ⚠️
process/models/pfcoil.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4277      +/-   ##
==========================================
- Coverage   49.35%   49.30%   -0.06%     
==========================================
  Files         151      151              
  Lines       29407    29441      +34     
==========================================
+ Hits        14514    14515       +1     
- Misses      14893    14926      +33     

☔ 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 and others added 2 commits June 1, 2026 16:34
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@chris-ashe chris-ashe force-pushed the plot_pf_mutual_ind_matrix branch from 6eb8f57 to 1e48f3b Compare June 1, 2026 15:38
Copy link
Copy Markdown
Collaborator

@geograham geograham left a comment

Choose a reason for hiding this comment

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

Looks good. I would consider adding PF labels to the x and y-axis of the the plot, just to make it really clear.

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

Labels

CS Coil Input/Output Files Issues related to the input and output data files PF Coils

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants