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

Task 01 Part 4 Broken? #300

Open
VadanKhan opened this issue Nov 10, 2024 · 1 comment
Open

Task 01 Part 4 Broken? #300

VadanKhan opened this issue Nov 10, 2024 · 1 comment

Comments

@VadanKhan
Copy link

It seems that this section is out of date, certainly not agreeing with the youtube videos.
The plots are not interactive as in the videos, which is a shame (and when I try to copy the code I get this error on imports:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[19], line 6
      3 from openmc.data import REACTION_MT
      4 import matplotlib.pyplot as plt
----> 6 import plotting_utils
      7 from plotting_utils import create_temperature_plot_for_isotope

ModuleNotFoundError: No module named 'plotting_utils'

)

I had to edit both snippets to add show the legends: plt.legend()
And the first plot did not iterate over multiple temperatures, I added this.

Could this section be updated, as so far the package has been great at touring the features of the package.

Updated Tungsten Temperature Iterative Plot

energy = np.linspace(1, 2000, 50000)  # sets the energy range from 1 to 2000eV, this is were resonances are

mt_number = REACTION_MT["(n,total)"]  # looks up the MT number for the total reaction

h5_file = f"/WMP_Library/074186.h5"  # 074186 is W186

isotope_multipole = openmc.data.WindowedMultipole.from_hdf5(h5_file)  # loads up the WMP cross section file

temperatures = [100, 200, 300, 400, 500, 750, 1000, 1500, 2000] # temperature in kelvin to plot

fig, ax = plt.subplots()

for temperature in temperatures:
    ax.plot(
        energy,
        isotope_multipole(energy, temperature)[mt_number],
        label=f"Tungsten 186 at {temperature} Kelvin",
    )

ax.set_yscale('log')
ax.set_ylabel('Microscopic cross section [barns]')
ax.set_xlabel('Energy [eV]')

plt.legend()
plt.show()
@shimwell
Copy link
Member

Hi @VadanKhan

In this case the youtube video is out of date. It is difficult to find the time to keep the youtube videos up to date.

It would be great if you are able to make a PR for adding the temperature iteration on the first example and the legends if you have time.

If not, no worries I can tidy this up next week. Thanks for bringing it up.

As for the interactive examples these are no longer included as we switched to using the inbuild openmc code for plotting and that uses matplotlib. If you are keen then these can be made with plotly package and the openmc calculate _cexs function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants