About using plot_xs method

Hi everyone;

I’m trying to plot cross-section of different neutron poisons by using plot_xs method included in openmc. It works fine for individual plotting but what I need (for comparative purposes) is to plot different XS (for different nuclide e.g: Gd, Sm and Boron) on the same plot. Something like this:


Which I did it by using data files from nndc, but the option with OpenMC, is very tempting because it will allow to generate Macroscopic XS for natural elements much more easier.

Thanks a lot

The plot_xs returns a matplotlib.figure.Figure so you could extract the info from this and build up a combined figure.

I tend to make use of the calculate_cexs function when combining cross section data into a single plot. By the way this website can combine isotopes or materials into a plot or extract the data for you.

It uses OpenMC under the hood and you can see the source code uses calculate_cexs.

Thank you very much @Shimwell for this sharing. It is a wonderful tool.

Best regards

@Shimwell
I’m trying to use XSPlot and I found it very useful and it made easily the job for natural element (including differet isotopes) and mixture with different element fractions, but I was not able to generale the XS for each element separately on the same plot. Is there any way to reproduce the equivalent of the figure I gave as an example.
Thanks again

I made this plot with the isotope plotter and it looks quite similar to the plot you have attached at the top, but this is for isotopes not for elements. I have not quite got the ability to plot elements but I should look into adding that in the future

many thanks @Shimwell; indeed the isotope plotter is able to give several XS on the same plot…it will be nice if the same option will be available on the material plotter.
What I can do, is to plot each element alone and download the data, it will be easier to plot them on the same figure using matplotlib. It will be just tricky to set the x-axis correctly when plotting different data sets with different xdata on the same intervall, but it will be possible.

@Shimwell
Finally, I am able to generate the desired plot, by using the calculate_cexs method as you suggested in the beginning, it much more simple than I thought, here the example:

En1, data1 = openmc.calculate_cexs(‘Nd’, ‘element’, [’(n,gamma)’])
En2, data2 = openmc.calculate_cexs(‘Sm’, ‘element’, [’(n,gamma)’])
En3, data3 = openmc.calculate_cexs(‘Gd’, ‘element’, [’(n,gamma)’])
En4, data4 = openmc.calculate_cexs(‘B’, ‘element’, [’(n,a)’])

plt.loglog(En1, data1[0])
plt.loglog(En2, data2[0])
plt.loglog(En3, data3[0])
plt.loglog(En4, data4[0])
plt.grid(True)
plt.savefig(‘Figure00.png’, dpi=300)

Thanks lot for your help and your time

2 Likes

That looks great congrats, that function is super useful

1 Like