diff --git a/src/openmc_depletion_plotter/app.py b/src/openmc_depletion_plotter/app.py index f078a96..6c8e49b 100644 --- a/src/openmc_depletion_plotter/app.py +++ b/src/openmc_depletion_plotter/app.py @@ -89,7 +89,7 @@ def main(): activity_or_atoms = st.sidebar.selectbox( label="Plot", - options=("activity", "number of atoms"), + options=("activity", "number of atoms", "decay heat"), index=0, key="activity_or_atoms", help="", @@ -201,6 +201,21 @@ def main(): include_total=include_total, path=materials_file.name, ) + elif activity_or_atoms == "decay heat": + plot = plot_decay_heat_vs_time( + excluded_material=material_to_exclude, + time_units=time_units, + show_top=show_top, + x_scale=x_scale, + y_scale=y_scale, + include_total=include_total, + # x_axis_title=None, + plotting_backend=backend, + # units="W/g", # TODO add drop down option + # threshold=None, + title="Decay heat of nuclides in material", + material_index=material_index, + ) elif activity_or_atoms == "number of atoms": plot = results.plot_atoms_vs_time( # todo allow no materials to be excluded diff --git a/tests/cross_sections.xml b/tests/cross_sections.xml index 02a6e87..8b3740c 100644 --- a/tests/cross_sections.xml +++ b/tests/cross_sections.xml @@ -1,4 +1,693 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/depletion_results.h5 b/tests/depletion_results.h5 new file mode 100644 index 0000000..e14bf1d Binary files /dev/null and b/tests/depletion_results.h5 differ diff --git a/tests/test_plots.py b/tests/test_plots.py index 407df97..b8fea81 100644 --- a/tests/test_plots.py +++ b/tests/test_plots.py @@ -5,8 +5,8 @@ import math from pathlib import Path -openmc.config['cross_sections'] = Path(__file__).parent / 'cross_sections.xml' -openmc.config['chain_file'] = Path(__file__).parent / 'chain-nndc-b7.1.xml' +# openmc.config['cross_sections'] = Path(__file__).parent / 'cross_sections.xml' +# openmc.config['chain_file'] = Path(__file__).parent / 'chain-nndc-b7.1.xml' #TODO plot # openmc.deplete.PredictorIntegrator plot_pulse_schedule @@ -30,6 +30,22 @@ def test_default_isotope_charts(): def test_default_time_plots(): + my_material = openmc.Material() + my_material.add_nuclide('Fe56', 1, percent_type='ao') + my_material.set_density('g/cm3', 10.49) + + results = openmc.deplete.ResultsList.from_hdf5("tests/depletion_results.h5") + + plot = results.plot_atoms_vs_time(excluded_material=my_material) + assert isinstance(plot, plotly.graph_objs._figure.Figure) + + plot = results.plot_activity_vs_time() + assert isinstance(plot, plotly.graph_objs._figure.Figure) + + plot = results.plot_decay_heat_vs_time() + assert isinstance(plot, plotly.graph_objs._figure.Figure) + +def produce_depletion_results_file(): # makes a simple material my_material = openmc.Material() my_material.add_nuclide('Fe56', 1, percent_type='ao') @@ -100,15 +116,4 @@ def test_default_time_plots(): source_rates=source_rates ) - integrator.integrate() - - results = openmc.deplete.ResultsList.from_hdf5("depletion_results.h5") - - plot = results.plot_atoms_vs_time(excluded_material=my_material) - assert isinstance(plot, plotly.graph_objs._figure.Figure) - - plot = results.plot_activity_vs_time() - assert isinstance(plot, plotly.graph_objs._figure.Figure) - - plot = results.plot_decay_heat_vs_time() - assert isinstance(plot, plotly.graph_objs._figure.Figure) + integrator.integrate() \ No newline at end of file