Skip to content

Show seperate impurity density plot#4118

Open
chris-ashe wants to merge 4 commits intomainfrom
show_seperate_impurity_density_plot
Open

Show seperate impurity density plot#4118
chris-ashe wants to merge 4 commits intomainfrom
show_seperate_impurity_density_plot

Conversation

@chris-ashe
Copy link
Collaborator

Description

This pull request significantly refactors the density profile plotting logic in plot_proc.py to improve clarity, modularity, and the visualization of impurity species. The main changes include splitting the density and impurity plots into separate subplots, dynamically handling impurity species, improving axis scaling (including log scale for impurity densities), and updating subplot arrangements and annotations for better presentation.

Key changes:

Density and Impurity Profile Plotting Improvements

  • Refactored plot_n_profiles to use two subplots: one for main plasma densities and another for impurity densities, each with appropriate axis labels, legends, and units. Impurity densities are now plotted in units of 1e16 m⁻³ and can use a logarithmic y-axis if the data spans several orders of magnitude.
  • Dynamically plots individual impurity species (Be, C, N, O, Ne, Si, Ar, Fe, Ni, Kr, Xe, W) only if their densities are significant, making the impurity subplot more informative and less cluttered.

Profile Calculation and Data Handling

  • Improved construction of the electron density profile: now uses a consistent number of profile elements and a unified approach for both pedestal and non-pedestal cases, ensuring smoother and more accurate profile shapes.
  • Added extraction of impurity electron fractions for up to 14 species, enabling the new impurity plotting functionality.

Plot Layout and Annotation Updates

  • Updated subplot positions and sizes in main_plot to accommodate the new density/impurity subplot split and to improve overall figure layout.
  • Adjusted placement and formatting of annotation text boxes and legends throughout the plotting functions for better readability and alignment with the new subplot structure.
image

Data Output Enhancement

  • Modified the outplas method in physics.py to output impurity electron densities at each profile point when present, supporting more detailed diagnostics and post-processing.

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 requested a review from a team as a code owner March 4, 2026 11:28
@chris-ashe chris-ashe added Input/Output Files Issues related to the input and output data files Impurities Plasma impurities Plotting labels Mar 4, 2026
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 74 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.20%. Comparing base (891e46b) to head (d8d2a03).

Files with missing lines Patch % Lines
process/core/io/plot_proc.py 0.00% 71 Missing ⚠️
process/models/physics/physics.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4118      +/-   ##
==========================================
- Coverage   47.26%   47.20%   -0.06%     
==========================================
  Files         139      139              
  Lines       29420    29457      +37     
==========================================
  Hits        13906    13906              
- Misses      15514    15551      +37     

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

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

Labels

Impurities Plasma impurities Input/Output Files Issues related to the input and output data files Plotting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants