Skip to content

Conversation

@chris-ashe
Copy link
Collaborator

@chris-ashe chris-ashe commented Jul 9, 2025

This pull request introduces a new interactive Sankey diagram plotting feature using Plotly and updates the documentation and codebase to use it instead of the previous Sankey plotting method. The most important changes are summarized below:

Documentation updates

  • Added a new section to documentation/usage/plotting.md describing how to use the plot_plotly_sankey script to generate an interactive HTML Sankey diagram for plant power balance, including usage instructions and an example figure.
image

Codebase changes

  • Updated imports in process/main.py to include plot_plotly_sankey and removed the import of the old plot_sankey module.
  • Changed the post-processing workflow in process/main.py to call plot_plotly_sankey.main() for generating Sankey diagrams, commenting out the old plot_sankey.main() call.

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 Jul 9, 2025
@chris-ashe chris-ashe added the Output Files Issues related to the output data files label Jul 9, 2025
@codecov-commenter
Copy link

codecov-commenter commented Jul 9, 2025

Codecov Report

❌ Patch coverage is 29.16667% with 34 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.20%. Comparing base (68d8058) to head (dc756c9).
⚠️ Report is 97 commits behind head on main.

Files with missing lines Patch % Lines
process/io/plot_plotly_sankey.py 28.26% 33 Missing ⚠️
process/main.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3711      +/-   ##
==========================================
- Coverage   46.67%   44.20%   -2.48%     
==========================================
  Files         122      123       +1     
  Lines       27804    31084    +3280     
==========================================
+ Hits        12977    13740     +763     
- Misses      14827    17344    +2517     

☔ 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 marked this pull request as ready for review September 17, 2025 08:06
Copy link
Collaborator

@j-a-foster j-a-foster left a comment

Choose a reason for hiding this comment

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

Happy with changes.

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.

The old plot_sankey.py file still exists. If its wrong and not used anymore, should we delete it?

@chris-ashe
Copy link
Collaborator Author

The old plot_sankey.py file still exists. If its wrong and not used anymore, should we delete it?

Since we cannot output numbers on top of the new Sankey atm then our old Sankey is the only one we can use to put in presentations etc. We should keep for now

chris-ashe and others added 2 commits September 23, 2025 13:23
Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>
Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>
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.

Missing images in the docs

```

<figure markdown>
![plotly_sankey_plot](../images/plotly_sankey.png){ width="100%"}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes reference to an image that does not exist

Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>
Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>
@timothy-nunn timothy-nunn merged commit c154c51 into main Sep 23, 2025
18 checks passed
@timothy-nunn timothy-nunn deleted the plotly_sankey branch September 23, 2025 14:19
ym1906 pushed a commit that referenced this pull request Oct 10, 2025
* ✨ Add Sankey diagram plotting for power flow visualization

* 🎨 Refactor Sankey diagram plotting: streamline data extraction, enhance node and link color definitions, and improve layout settings

* ✨ Add alpha particles back to plasma in Sankey diagram plotting

* ✨ Update Sankey diagram: refine alpha particle calculations and add blanket neutron multiplication

* ✨ Update HTML output filename in Sankey diagram plotting: strip 'MFILE' and enhance naming convention

* 🎨 Refactor node labels in Sankey diagram: simplify formatting and enhance readability

* ✨ Update Sankey diagram plotting: replace deprecated plot_sankey with plot_plotly_sankey for improved visualization

* 📝 Add interactive Sankey diagram section: introduce usage instructions and example for `plot_plotly_sankey`

* ✨ Add kaleido dependency for improved image export in development requirements

* 🎨 Refactor main function: remove unused code for saving Sankey diagram image

* Make plotly an optional dependency

* Update documentation/usage/plotting.md

Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>

* Update requirements_dev.txt

Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>

* Update process/main.py

Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>

* Update process/io/plot_plotly_sankey.py

Co-authored-by: Timothy <75321887+timothy-nunn@users.noreply.github.com>

---------

Co-authored-by: Timothy Nunn <timothy.nunn@ukaea.uk>
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

Labels

Output Files Issues related to the output data files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants