You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’ve been using openmc_source_plotter.plot_gamma_emission and found a small bug. It seems that if material.get_decay_photon_energy() (line 50) returns an openmc.stats.univariate.mixture object then the function fails because openmc.stats.univariate.mixture does not have a .p attribute. However, if it returns am openmc.stats.univariate.discrete object, the plotter works fine (as the example does).
I have attached a minimum working example of this code which returns the error:
plt = plot_gamma_emission(material=my_material, label_top=3)
File "/home/rbarker/miniforge3/envs/openmc_dev/lib/python3.9/site-packages/openmc_source_plotter/material.py", line 51, in plot_gamma_emission
for p in energy_dis.p:
AttributeError: 'Mixture' object has no attribute 'p'
I have also attached the materials.xml file needed to run this code.
Minimum working example:
import openmc
from openmc_source_plotter import plot_gamma_emission
# This example is modified from https://github.com/fusion-energy/openmc_source_plotter/blob/main/examples/example_gamma_spec_plot.py
# this path will need changing to point to your chain file
openmc.config["chain_file"] = "/home/rbarker/chain.xml"
my_materials = openmc.Materials.from_xml()
my_material = my_materials.pop()
print(my_material.get_decay_photon_energy(clip_tolerance=0.0))
# adds labels to the most active 3 gamma energies
plt = plot_gamma_emission(material=my_material, label_top=3)
plt.xscale("log")
plt.savefig("gamma_spec.png")
I’ve been using openmc_source_plotter.plot_gamma_emission and found a small bug. It seems that if
material.get_decay_photon_energy()
(line 50) returns anopenmc.stats.univariate.mixture
object then the function fails becauseopenmc.stats.univariate.mixture
does not have a .p attribute. However, if it returns amopenmc.stats.univariate.discrete
object, the plotter works fine (as the example does).I have attached a minimum working example of this code which returns the error:
I have also attached the materials.xml file needed to run this code.
Minimum working example:
materials.xml needed to run this file:
The text was updated successfully, but these errors were encountered: