Skip to content

Add pulse timings dataclass - #4497

Open
chris-ashe wants to merge 10 commits into
mainfrom
add_pulse_timings_dataclass
Open

Add pulse timings dataclass#4497
chris-ashe wants to merge 10 commits into
mainfrom
add_pulse_timings_dataclass

Conversation

@chris-ashe

@chris-ashe chris-ashe commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

This pull request refactors how pulse timing and cumulative time points are handled throughout the codebase by introducing and consistently applying the PulseTimings class. This change improves code clarity, reduces duplication, and centralizes pulse timing logic, making it easier to maintain and extend. The update affects plotting routines, model calculations, and output formatting for pulse-related data.

Pulse timing refactor and centralization:

  • Replaced manual cumulative time calculations in plotting functions (e.g., plot_current_profiles_over_time, plot_system_power_profiles_over_time, plot_cs_stress_time_profile) with usage of the new PulseTimings class, ensuring consistent time axis generation and annotation across all plots.

  • Updated model logic in physics.py and pfcoil.py to use PulseTimings for all derived pulse timing values, such as total pulse time, plasma-present time, and no-burn time, removing duplicated cumulative sum logic.

  • Modified power system models (power.py) to pass PulseTimings as an argument to the PF coil power calculation routines (pfpwr), ensuring all power calculations use unified pulse timing data.
    Output and labeling improvements:

  • Standardized the use of pulse time labels and cumulative time points in output routines and plot annotations, using properties from PulseTimings for axis tick labels and time column headers.

Cleanup and removal of legacy code:

  • Removed legacy time label arrays and manual cumulative time calculations from times_variables.py and related model files, reducing code redundancy.

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

codecov-commenter commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.53933% with 28 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.38%. Comparing base (6dbb302) to head (02e6759).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
process/core/io/plot/summary.py 7.69% 12 Missing ⚠️
process/models/pfcoil.py 16.66% 5 Missing ⚠️
process/models/pulse.py 90.38% 5 Missing ⚠️
process/models/physics/physics.py 20.00% 4 Missing ⚠️
process/models/power.py 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4497      +/-   ##
==========================================
+ Coverage   49.30%   49.38%   +0.08%     
==========================================
  Files         151      151              
  Lines       29611    29640      +29     
==========================================
+ Hits        14599    14638      +39     
+ Misses      15012    15002      -10     

☔ View full report in Codecov by Harness.
📢 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 marked this pull request as ready for review August 4, 2026 12:31
@chris-ashe
chris-ashe requested a review from a team as a code owner August 4, 2026 12:31
@clmould clmould self-assigned this Aug 5, 2026
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.

3 participants