diff --git a/.github/workflows/ci_with_install.yml b/.github/workflows/ci_with_install.yml index fd0adee..3cc1df3 100644 --- a/.github/workflows/ci_with_install.yml +++ b/.github/workflows/ci_with_install.yml @@ -39,7 +39,7 @@ jobs: python examples/example_plot_source_position.py python examples/example_plot_two_source_energies.py pip install openmc_plasma_source - python examples/example_plot_plasma_source_position.py + # python examples/example_plot_plasma_source_position.py - name: Run test_utils run: | diff --git a/examples/example_get_particle_data.py b/examples/example_get_particle_data.py index 823d104..2603844 100644 --- a/examples/example_get_particle_data.py +++ b/examples/example_get_particle_data.py @@ -1,8 +1,8 @@ import openmc -import openmc_source_plotter as osp +import openmc_source_plotter # overwrites the openmc.source method # initialises a new source object -my_source = osp.SourceWithPlotting() +my_source = openmc.Source() # sets the location of the source to x=0 y=0 z=0 my_source.space = openmc.stats.Point((0, 0, 0)) diff --git a/examples/example_plot_plasma_source_position.py b/examples/example_plot_plasma_source_position.py index 51cf991..84826c6 100644 --- a/examples/example_plot_plasma_source_position.py +++ b/examples/example_plot_plasma_source_position.py @@ -21,6 +21,8 @@ shafranov_factor=0.44789, triangularity=0.270, ion_temperature_beta=6, + angles=(0, 3.14), # makes a sector of 0 radians to 3.14 radians + sample_size=100, # reduces the number of samples from a default of 1000 to reduce plot time ).make_openmc_sources() diff --git a/examples/example_plot_source_direction.py b/examples/example_plot_source_direction.py index c863e7b..30e6412 100644 --- a/examples/example_plot_source_direction.py +++ b/examples/example_plot_source_direction.py @@ -1,8 +1,8 @@ -import openmc_source_plotter as osp import openmc +import openmc_source_plotter # overwrites the openmc.source method # initializes a new source object -my_source = osp.SourceWithPlotting() +my_source = openmc.Source() # sets the direction to isotropic my_source.angle = openmc.stats.Isotropic() diff --git a/examples/example_plot_source_energy.py b/examples/example_plot_source_energy.py index 2753b3e..e2608a5 100644 --- a/examples/example_plot_source_energy.py +++ b/examples/example_plot_source_energy.py @@ -1,8 +1,8 @@ -from openmc_source_plotter import SourceWithPlotting import openmc +import openmc_source_plotter # overwrites the openmc.source method # initialise a new source object -my_source = SourceWithPlotting() +my_source = openmc.Source() # sets the energy distribution to a Muir distribution neutrons my_source.energy = openmc.stats.Muir(e0=14080000.0, m_rat=5.0, kt=20000.0) diff --git a/examples/example_plot_source_position.py b/examples/example_plot_source_position.py index 2ae769b..d45f712 100644 --- a/examples/example_plot_source_position.py +++ b/examples/example_plot_source_position.py @@ -1,8 +1,8 @@ -from openmc_source_plotter import SourceWithPlotting import openmc +import openmc_source_plotter # overwrites the openmc.source method # initialises a new source object -my_source = SourceWithPlotting() +my_source = openmc.Source() # the distribution of radius is just a single value radius = openmc.stats.Discrete([10], [1]) diff --git a/examples/example_plot_two_source_energies.py b/examples/example_plot_two_source_energies.py index 020669e..c057f90 100644 --- a/examples/example_plot_two_source_energies.py +++ b/examples/example_plot_two_source_energies.py @@ -1,14 +1,14 @@ -import openmc_source_plotter as osp import openmc +import openmc_source_plotter # overwrites the openmc.source method # initialises a new source object -my_dt_source = osp.SourceWithPlotting() +my_dt_source = openmc.Source() # sets the energy distribution to a Muir distribution DT neutrons my_dt_source.energy = openmc.stats.Muir(e0=14080000.0, m_rat=5.0, kt=20000.0) # initialises a new source object -my_dd_source = osp.SourceWithPlotting() +my_dd_source = openmc.Source() # sets the energy distribution to a Muir distribution DD neutrons my_dd_source.energy = openmc.stats.Muir(e0=2080000.0, m_rat=2.0, kt=20000.0) diff --git a/openmc_source_plotter/__init__.py b/openmc_source_plotter/__init__.py index fe4ba44..ed9e345 100644 --- a/openmc_source_plotter/__init__.py +++ b/openmc_source_plotter/__init__.py @@ -13,4 +13,4 @@ __all__ = ["__version__"] -from .core import SourceWithPlotting +from .core import Source diff --git a/openmc_source_plotter/core.py b/openmc_source_plotter/core.py index a1c99fd..c44dcea 100644 --- a/openmc_source_plotter/core.py +++ b/openmc_source_plotter/core.py @@ -10,7 +10,7 @@ import plotly.graph_objects -class SourceWithPlotting(openmc.Source): +class Source(openmc.Source): r"""Inherits and extents the openmc.Source class to add source plotting methods for energy, direction and position. Source sampling methods are also provided for convenience. Additional methods are plot_source_energy(), @@ -188,3 +188,6 @@ def plot_source_direction( ) return figure + + +openmc.Source = Source diff --git a/tests/test_core.py b/tests/test_core.py index 35f5b1b..2edb047 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1,5 +1,5 @@ -from openmc_source_plotter import SourceWithPlotting import openmc +import openmc_source_plotter import numpy as np import plotly.graph_objects as go import pytest @@ -8,7 +8,7 @@ @pytest.fixture def test_source(): # initialises a new source object - my_source = SourceWithPlotting() + my_source = openmc.Source() # sets the location of the source to x=0 y=0 z=0 my_source.space = openmc.stats.Point((0, 0, 0))