Skip to content

Conversation

@chris-ashe
Copy link
Collaborator

@chris-ashe chris-ashe commented Jan 19, 2026

This pull request enhances the post-optimization reporting for constraint handling in process/scan.py. The main improvements involve adding more detailed output for both equality and inequality constraints, including physical values, units, symbols, and bounds, which should make debugging and analysis easier.

Enhanced constraint reporting:

  • Added output of residuals, constraint values, and units for equality constraints using process_output.ovarre, improving the detail of post-optimization logs.
  • For inequality constraints, now calculate and output the physical value, symbol, units, and physical bound for each constraint, and include these in the output file for better traceability.

Output formatting improvements:

  • Updated the table headers for inequality constraint reporting to include "Physical constraint bound" for clearer presentation of results.

image 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 self-assigned this Jan 19, 2026
@chris-ashe chris-ashe added the Input/Output Files Issues related to the input and output data files label Jan 19, 2026
@codecov-commenter
Copy link

codecov-commenter commented Jan 19, 2026

Codecov Report

❌ Patch coverage is 1.82927% with 161 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.62%. Comparing base (5ea7543) to head (41f0c58).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
process/io/plot_proc.py 1.97% 149 Missing ⚠️
process/scan.py 0.00% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4049      +/-   ##
==========================================
+ Coverage   46.49%   46.62%   +0.12%     
==========================================
  Files         123      123              
  Lines       28777    29530     +753     
==========================================
+ Hits        13381    13769     +388     
- Misses      15396    15761     +365     

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

…lace dashed line with arrow annotation, and remove relative change text display
…ght, add z-order for layering, and improve text annotation with dynamic color and background
@jonmaddock
Copy link
Contributor

@chris-ashe could you add an image of the new output here?

@chris-ashe
Copy link
Collaborator Author

@chris-ashe could you add an image of the new output here?

Have added to main PR text now

Copy link
Contributor

@jonmaddock jonmaddock left a comment

Choose a reason for hiding this comment

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

Great to have this working, such an improvement to our visualisation! Main points are about calculating stuff that has either been calculated already (I think) or should have been, e.g. normalisation of constraint/bound values.

constraint_bound = con2[i]

# assumes f-value is 1
# -cc because sign is reversed in constraint_eqns
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you be totally clear here: after the sign change here, a constraint > 0 is violated, right? i.e. the convention.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

From my understanding and by the data the plots make it seems to be the correct way. @timothy-nunn what do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

In PROCESS, a negative cc indicates that a constraint is violated

# Plot main plasma information
plot_main_plasma_information(
figs[3].add_subplot(111, aspect="equal"),
figs[4].add_subplot(111, aspect="equal"),
Copy link
Contributor

Choose a reason for hiding this comment

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

This churn is a bit of a pain. Could figs just be appended to?

@jonmaddock
Copy link
Contributor

This looks fantastic now!

@chris-ashe chris-ashe requested a review from a team as a code owner January 22, 2026 09:54
Copy link
Collaborator

@timothy-nunn timothy-nunn left a comment

Choose a reason for hiding this comment

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

I'm not sure the equality constraint plot is doing anything for me. Its quite hard to meaningfully plot the residuals of these constraints especially given the different orders of magnitude. Would this be better as just a table?

The inequality bar chart should show margin so the bars should come from the right for $\leq$ constraints.

@timothy-nunn
Copy link
Collaborator

@chris-ashe when you have actioned all of Jon's comments can you please re-request his review

@chris-ashe chris-ashe requested a review from jonmaddock January 23, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Input/Output Files Issues related to the input and output data files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants