Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing y axis label for heating plots #2859

Merged

Conversation

shimwell
Copy link
Member

@shimwell shimwell commented Jan 26, 2024

While plotting some heating cross sections we noticed that the units on the Y axis were in barns when perhaps they should be in eV/collision or something else.

This PR adds special handeling if the heating or heating-local types are plotted.
It also checks that the cross sections are not mixing heat with non heat cross sections as these can't share a Y axis units

I've added tests for the new use cases

Here is a before and after screen shot
Screenshot from 2024-01-26 16-08-24

sample code for these plots

import matplotlib.pyplot as plt
import openmc

fig = openmc.plotter.plot_xs(
    reactions={
        "Be9": ["heating-local"],
        "Li6": ["heating"],
    },
)
plt.show()

tagging @rlbarker for your interest

Checklist

  • I have performed a self-review of my own code
  • I have followed the style guidelines for Python source files (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@giovanni-mariano
Copy link

Hello Jon,
thank you for fixing this: I think the unit should "eV x barn".

Best,
Giovanni

openmc/plotter.py Outdated Show resolved Hide resolved
@shimwell
Copy link
Member Author

shimwell commented Feb 7, 2024

Just to mention if this PR is successful then I would be keen to follow up with a PR that fixes the axis label when MT 444 damage is plotted. I think the units for the 444 reaction units are eV barn?

@shimwell shimwell added the Plots Changes related to plotting of models and results label Mar 30, 2024
@shimwell
Copy link
Member Author

Just wondering if anyone has had time to review this an if there are any changes needed.

@paulromano
Copy link
Contributor

Thanks for the ping @shimwell. Will take a look soon

openmc/plotter.py Outdated Show resolved Hide resolved
Copy link
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

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

I made a small fix to add the "damage-energy" score, which is also eV-barn. Good to go now; thanks!

@paulromano paulromano enabled auto-merge (squash) April 5, 2024 06:33
@shimwell
Copy link
Member Author

shimwell commented Apr 5, 2024

Thanks for adding damage energy. That subset change is also better than the way I was doing it. Many thanks for the review.

@paulromano paulromano merged commit 27bd315 into openmc-dev:develop Apr 5, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Plots Changes related to plotting of models and results
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants