Skip to content

Commit

Permalink
switched to plotly
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Jul 19, 2022
1 parent ff81157 commit 1220df6
Show file tree
Hide file tree
Showing 7 changed files with 243 additions and 260 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,6 @@ _version.py

# output xml files from openmc
*.xml

*.html
*.png
10 changes: 5 additions & 5 deletions examples/plot_multiple_materials.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from openmc_depletion_plotter import plot_materials
from openmc_depletion_plotter import plot_material
import openmc

my_mat = openmc.Material()
Expand All @@ -22,7 +22,7 @@
my_mat_2.set_density('g/cm3', 7.7)
my_mat_2.volume = 1

plot_materials(
[my_mat, my_mat_2],
filenames=['my_mat_1.png', 'my_mat_2.png']
)
for mat, filename in zip([my_mat, my_mat_2], ['my_mat_1.png', 'my_mat_2.png']):
plotly_figure=plot_material(mat)
plotly_figure.write_image(filename)

10 changes: 9 additions & 1 deletion examples/plot_single_material.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@
my_mat.add_element('Al', 0.5)
my_mat.add_element('B', 0.5)
my_mat.add_element('Co', 0.5)
my_mat.add_element('Cs', 0.5)
my_mat.add_nuclide('Fe60', 0.1)
my_mat.add_nuclide('Fe61',0.2)
my_mat.add_nuclide('Fe62',0.3)
my_mat.set_density('g/cm3', 7.7)
my_mat.volume = 1

plot_material(my_mat, filename='my_mat_on_isotope_chart.png')
plotly_figure = plot_material(my_mat)

plotly_figure.write_html('my_mat_on_isotope_chart.html')
plotly_figure.write_image('my_mat_on_isotope_chart.png')
plotly_figure.show()
4 changes: 3 additions & 1 deletion openmc_depletion_plotter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@

__all__ = ["__version__"]

from .core import plot_material, plot_materials
from .core import plot_material
from .utils import find_most_abundant_nuclides_in_material
from .utils import find_most_abundant_nuclides_in_materials
from .utils import get_nuclide_atom_densities_from_materials
from .utils import find_most_active_nuclides_in_material
from .utils import find_most_active_nuclides_in_materials
from .utils import get_nuclide_activities_from_materials
from .utils import get_atoms_from_material
Loading

0 comments on commit 1220df6

Please sign in to comment.